This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFA:] libffi-dg.exp: Replace \n with \r?\n in dg-output


Tested on in-progress CRIS port (fixes the ^M mismatches) and
x86 FC3 (so it doesn't mess up anything on a system that doesn't
need this fix).

CC to the dejagnu list in the hope that something to help
without the assumption needed below will appear in a future
version.

Ok to commit?

libffi:

	* testsuite/lib/libffi-dg.exp (libffi-dg-test-1): Replace \n with
	\r?\n in output tests.

Index: libffi-dg.exp
===================================================================
RCS file: /cvs/gcc/gcc/libffi/testsuite/lib/libffi-dg.exp,v
retrieving revision 1.11
diff -u -p -r1.11 libffi-dg.exp
--- libffi-dg.exp	24 Nov 2004 04:39:39 -0000	1.11
+++ libffi-dg.exp	17 Apr 2005 19:59:53 -0000
@@ -28,6 +28,22 @@ load_gcc_lib wrapper.exp
 # Define libffi callbacks for dg.exp.
 
 proc libffi-dg-test-1 { target_compile prog do_what extra_tool_flags } {
+
+    # To get all \n in dg-output test strings to match printf output
+    # in a system that outputs it as \015\012 (i.e. not just \012), we
+    # need to change all \n into \r?\n.  As there is no dejagnu flag
+    # or hook to do that, we simply change the text being tested.
+    # Unfortunately, we have to know that the variable is called
+    # dg-output-text and lives in the caller of libffi-dg-test, which
+    # is two calls up.  Overriding proc dg-output would be longer and
+    # would necessarily have the same assumption.
+    upvar 2 dg-output-text output_match
+
+    if { [llength $output_match] > 1 } {
+	set x [regsub -all "\n" [lindex $output_match 1] "\r?\n"]
+	set output_match [lreplace $output_match 1 1 $x]
+    }
+
     # Set up the compiler flags, based on what we're going to do.
 
     set options [list]

brgds, H-P


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]