autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: FYI: 75-gary-canonicalize-strerror-test.patch


From: Gary V. Vaughan
Subject: Re: FYI: 75-gary-canonicalize-strerror-test.patch
Date: Fri, 10 Oct 2003 16:12:37 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20030925 Thunderbird/0.3

Akim Demaille wrote:
 > Applied to HEAD of GNU m4.
 > Bleh!  This is all wrong since it relies on knowledge of the internals
 > of AT_CHECK.  But it will allow the `modules: importing' check to work
 > until we figure out how to do it properly.

That's not the way to go IMO.  See my chapter in gp2 (and maybe in
autoconf.texi I don't remember) on Autotest, especially wrappers.  See
tests/m4 to.

Agreed.  But unless we generate an error on the test host, and be careful of
paths and filenames in the error string, it is difficult to write a wrapper to canonicalize arbitrary stderr output on the fly.

I'm applying this to HEAD which is a good compromise I think.

Cheers,
        Gary.
--
  ())_.  Gary V. Vaughan    gary@(lilith.warpmail.net|gnu.org)
  ( '/   Research Scientist http://www.oranda.demon.co.uk       ,_())____
  / )=   GNU Hacker         http://www.gnu.org/software/libtool  \'      `&
`(_~)_   Tech' Author       http://sources.redhat.com/autobook   =`---d__/
Index: ChangeLog
from  Gary V. Vaughan  <address@hidden>
        * tests/modules.at (modules: importing): Apply some lateral
        thinking, and use AT_CHECK to compare the output of a sed pass
        over stderr against the canonical strerror string.

Index: tests/modules.at
===================================================================
RCS file: /cvsroot/m4/m4/tests/modules.at,v
retrieving revision 1.8
diff -u -p -u -r1.8 modules.at
--- tests/modules.at 10 Oct 2003 14:12:12 -0000 1.8
+++ tests/modules.at 10 Oct 2003 15:04:25 -0000
@@ -340,6 +340,11 @@ AT_CLEANUP
 
 # Importing a symbol from a not yet loaded module
 
+# This test is ugly, because we need to canonicalize strerror strings
+# to match our test.  So we save STDERR to a file, and run another check
+# which edits that file and compares it to the canonical STDERR output
+# from the first command:
+
 AT_SETUP([modules: importing])
 
 AT_DATA([[input.m4]],
@@ -373,11 +378,19 @@ m4: input.m4: 6: Warning: cannot load sy
 m4: input.m4: 7: cannot open module `no_such': no_such.so: cannot open shared 
object file: No such file or directory
 ]])
 
-AT_CHECK_M4([-m load input.m4 2>acterr], 1, expout, ignore)
+AT_CHECK_M4([-m load input.m4], 1, expout, stderr)
+
+# The expected stderr from the m4 invocation above becomes the expected
+# stdout of the following sed invocation to canonicalize the strerror message.
+# Note that the choice of file name affects the behaviour of AT_CHECK, so
+# we retain experr above for consistency with the rest of the testsuite, but
+# rename it here to make it play nicely with AT_CHECK:
+rm -f expout
+mv experr expout
+
+AT_CHECK([sed '/^m4: input.m4: 7:/ {
+    s,\(7:[[^:]]*:\).*$,\1 no_such.so: cannot open shared object file: No such 
file or directory, }' stderr], 0, expout)
 
-sed '/^m4: input.m4: 7:/ {
-    s,\(7:[[^:]]*:\).*$,\1 no_such.so: cannot open shared object file: No such 
file or directory, }' < acterr > editerr
-$at_diff experr editerr || echo 1 > $at_status_file
 
 AT_CLEANUP
 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]