* testsuite/lib/libffi-dg.exp (libffi-dg-test-1): Replace \n with
authorhp <hp@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 18 Apr 2005 16:31:10 +0000 (16:31 +0000)
committerhp <hp@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 18 Apr 2005 16:31:10 +0000 (16:31 +0000)
\r?\n in output tests.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@98329 138bc75d-0d04-0410-961f-82ee72b054a4

libffi/ChangeLog
libffi/testsuite/lib/libffi-dg.exp

index a9c2c07..bea9a89 100644 (file)
@@ -1,3 +1,8 @@
+2005-04-18  Hans-Peter Nilsson  <hp@axis.com>
+
+       * testsuite/lib/libffi-dg.exp (libffi-dg-test-1): Replace \n with
+       \r?\n in output tests.
+
 2005-04-12  Mike Stump  <mrs@apple.com>
 
        * configure: Regenerate.
index 49c7705..7b98711 100644 (file)
@@ -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]