]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
tests: allow for unstable fortran output ordering.
authorGary V. Vaughan <gary@gnu.org>
Sat, 6 Oct 2012 04:47:56 +0000 (11:47 +0700)
committerGary V. Vaughan <gary@gnu.org>
Sat, 6 Oct 2012 04:51:23 +0000 (11:51 +0700)
Due to differences in line-endings between C stdout and Fortran
stdout, as well as unpredictable output ordering between
platforms and runtimes, weaken success criteria to not require
the entire output of fortran programs to match a test case.
* itests/fcdemo.at, tests/f77demo.at (_LT_CHECK_EXECUTE):
Improve comments, and weaken test case to grep for a known line
in the f77 runtime output.

Signed-off-by: Gary V. Vaughan <gary@gnu.org>
tests/f77demo.at
tests/fcdemo.at

index 5978b3d4a476f6145d2363f90fbd65dd11b33c64..a06af37a1d70858099632cdb6a434e841fe11350 100644 (file)
@@ -245,10 +245,10 @@ LT_AT_AUTOHEADER
 m4_define([_LT_CHECK_EXECUTE],
 [LT_AT_MAKE
 
-# Oddly, the output of dynamically linked fprogram differs depending
-# on whether it is redirected to a file or sent to stdout, so we
-# just check return status, and ignore output.
-# Advice on this weirdness from a Fortran user much appreciated!
+# Due to differences in line-endings between C stdout and Fortran
+# stdout, as well as unpredictable output ordering between platforms
+# and runtimes, we can't reliably check the output here... although
+# it should be some variation of the following:
 LT_AT_HOST_DATA([expout],
 [[ Welcome to GNU libtool Fortran demo!
  Real programmers write in FORTRAN.
@@ -260,8 +260,13 @@ LT_AT_HOST_DATA([expout],
  fsub3 returned, saying that 4 *           2  =           8
  fsub3 is ok!
 ]])
-LT_AT_EXEC_CHECK([./fprogram], 0, [ignore])
+LT_AT_EXEC_CHECK([./fprogram], 0, [stdout])
 
+# A weaker output content check that is agnostic to the issues above.
+AT_CHECK([grep 'Welcome to GNU libtool Fortran demo!' stdout],
+         [0], [ignore])
+
+# Similarly, we can't reliably compare actual output with the following.
 LT_AT_HOST_DATA([expout],
 [[Welcome to GNU libtool mixed C/Fortran demo!
 The C subroutine returned, claiming that 2*2 = 4
@@ -276,7 +281,11 @@ The C wrapper to the fortran subroutine returned,
 claiming that 2*2 = 4
 The Fortran 77 subroutine is ok!
 ]])
-LT_AT_EXEC_CHECK([./cprogram], 0, [expout])
+LT_AT_EXEC_CHECK([./cprogram], 0, [stdout])
+
+# A weaker output content check that is agnostic to the issues above.
+AT_CHECK([grep 'Welcome to GNU libtool mixed C/Fortran demo!' stdout],
+         [0], [ignore])
 ])
 
 
@@ -293,18 +302,6 @@ _LT_SETUP
 
 LT_AT_CHECK_CONFIG([--disable-shared],
                    [^build_old_libs=yes], [^build_libtool_libs=no])
-
-LT_AT_HOST_DATA([expout],
-[[ Welcome to GNU libtool Fortran demo!
- Real programmers write in FORTRAN.
- fsub called
- fsubf called
- fsub returned, saying that 2 *           2  =           4
- fsub is ok!
- fsub3 called
- fsub3 returned, saying that 4 *           2  =           8
- fsub3 is ok!
-]])
 _LT_CHECK_EXECUTE
 
 AT_CLEANUP
index 0ade9bbb30721f5ab3081887e403d6f11cafb0a3..0ac44313f9d513650dee57b29830bea5a5ad190e 100644 (file)
@@ -259,10 +259,10 @@ LT_AT_AUTOHEADER
 m4_define([_LT_CHECK_EXECUTE],
 [LT_AT_MAKE
 
-# Oddly, the output of dynamically linked fprogram differs depending
-# on whether it is redirected to a file or sent to stdout, so we
-# just check return status, and ignore output.
-# Advice on this weirdness from a Fortran user much appreciated!
+# Due to differences in line-endings between C stdout and Fortran
+# stdout, as well as unpredictable output ordering between platforms
+# and runtimes, we can't reliably check the output here... although
+# it should be some variation of the following:
 LT_AT_HOST_DATA([expout],
 [[ Welcome to GNU libtool Fortran demo!
  Real programmers write in FORTRAN.
@@ -274,8 +274,13 @@ LT_AT_HOST_DATA([expout],
  fsub3 returned, saying that 4 *           2  =           8
  fsub3 is ok!
 ]])
-LT_AT_EXEC_CHECK([./fprogram], 0, [ignore])
+LT_AT_EXEC_CHECK([./fprogram], 0, [stdout])
 
+# A weaker output content check that is agnostic to the issues above.
+AT_CHECK([grep 'Welcome to GNU libtool Fortran demo!' stdout],
+         [0], [ignore])
+
+# Similarly, we can't reliably compare actual output with the following.
 LT_AT_HOST_DATA([expout],
 [[Welcome to GNU libtool mixed C/Fortran demo!
 The C subroutine returned, claiming that 2*2 = 4
@@ -290,7 +295,11 @@ The C wrapper to the fortran subroutine returned,
 claiming that 2*2 = 4
 The Fortran subroutine is ok!
 ]])
-LT_AT_EXEC_CHECK([./cprogram], 0, [expout])
+LT_AT_EXEC_CHECK([./cprogram], 0, [stdout])
+
+# A weaker output content check that is agnostic to the issues above.
+AT_CHECK([grep 'Welcome to GNU libtool mixed C/Fortran demo!' stdout],
+         [0], [ignore])
 ])