automake-patches
[Top][All Lists]
Advanced

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

tests: avoid failing command substitution in errexit mode.


From: Ralf Wildenhues
Subject: tests: avoid failing command substitution in errexit mode.
Date: Sun, 16 Jan 2011 14:22:53 +0100
User-agent: Mutt/1.5.20 (2010-08-04)

Quoting
http://autobuild.josefsson.org/automake/log-201101150748140530000.txt

| FAIL: vartypos.test (exit: 1)
| =============================
| 
| 
/tmp/am/build-alphaev67-dec-osf5.1/tests:/tmp/local/alphaev67-dec-osf5.1/bin:/tmp/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/opt/svr4/bin:/etc:/usr/etc:/usr/dt/bin:/usr/bin/X11:/usr/ucb
| + set -e 
| + pwd 
| /tmp/am/build-alphaev67-dec-osf5.1/tests/vartypos.dir
| + cat 
| + cat 
| + aclocal-1.11a -Werror 
| + AUTOMAKE_fails 
| + AUTOMAKE_run 1 
| expected_exitcode=1
| + shift 
| exitcode=0
| + automake-1.11a --foreign -Werror -Wall 
| exitcode=1
| + cat stderr 
| automake: warnings are treated as errors
| Makefile.am:2: warning: variable `nodist_foo_SOURCES' is defined but no 
program or
| Makefile.am:2: library has `foo' as canonical name (possible typo)
| Makefile.am:1: warning: variable `foo_SOURCES' is defined but no program or
[...]
| Makefile.am:13: warning: variable `libfoo_a_DEPENDENCIES' is defined but no 
program or
| Makefile.am:13: library has `libfoo_a' as canonical name (possible typo)
| + cat stdout 
| + test 1 = 1 
| + grep -v  .libfoo_a.  
| + grep as canonical stderr 
| + grep -v  .foo.  
| 
| FAIL: vartypo2.test (exit: 1)
| =============================
| 
| 
/tmp/am/build-alphaev67-dec-osf5.1/tests:/tmp/local/alphaev67-dec-osf5.1/bin:/tmp/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/opt/svr4/bin:/etc:/usr/etc:/usr/dt/bin:/usr/bin/X11:/usr/ucb
| vartypo2: running libtoolize --version
| libtoolize (GNU libtool 1.3075 2009-02-01) 2.2.7a
| Written by Gary V. Vaughan <address@hidden>, 2003
| 
| Copyright (C) 2009 Free Software Foundation, Inc.
| This is free software; see the source for copying conditions.  There is NO
| warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
| + set -e 
| + pwd 
| /tmp/am/build-alphaev67-dec-osf5.1/tests/vartypo2.dir
| + cat 
| + cat 
| + libtoolize 
| libtoolize: putting auxiliary files in `.'.
| libtoolize: linking file `./ltmain.sh'
| libtoolize: You should add the contents of the following files to 
`aclocal.m4':
[...]
| + aclocal-1.11a -Werror -Wno-syntax -I 
/tmp/am/build-alphaev67-dec-osf5.1/../automake/m4 -I 
/tmp/local/alphaev67-dec-osf5.1/share/aclocal 
| + AUTOMAKE_fails --add-missing 
| + AUTOMAKE_run 1 --add-missing 
| expected_exitcode=1
| + shift 
| exitcode=0
| + automake-1.11a --foreign -Werror -Wall --add-missing 
| exitcode=1
| + cat stderr 
| configure.in:4: installing `./config.guess'
| configure.in:4: installing `./config.sub'
| automake: warnings are treated as errors
| Makefile.am:3: warning: variable `EXTRA_libfoo_la_SOURCES' is defined but no 
program or
| Makefile.am:3: library has `libfoo_la' as canonical name (possible typo)
[...]
| Makefile.am:5: library has `libfoo_la' as canonical name (possible typo)
| + cat stdout 
| + test 1 = 1 
| + grep -v  .libfoo_la.  
| + grep as canonical stderr 


Ah, Tru64 and IRIX sh seem to exit upon a failed command substution when
'set -e' is enabled.  I'm not even sure whether that's conforming to
some version of Posix or not.  This issue is similar to this from
autoconf.texi:

     When `set -e' is in effect, a failed command substitution in
     Solaris `/bin/sh' cannot be ignored, even with `||'.

          $ /bin/sh -c 'set -e; foo=`false` || echo foo; echo bar'
          $ bash -c 'set -e; foo=`false` || echo foo; echo bar'
          foo
          bar

but apparently not the same, as these two tests pass in the Solaris
logs.

Fortunately, the issue is easily avoided here.  I'll be pushing the
patch below to master shortly.

Cheers,
Ralf

    tests: avoid failing command substitution in errexit mode.
    
    * tests/vartypo2.test, tests/vartypos.test: Rewrite to not use
    a command substitution with a nonzero exit status, that causes
    IRIX and Tru64/OSF sh to fail the whole test.

diff --git a/tests/vartypo2.test b/tests/vartypo2.test
index a212c2b..f811bbc 100755
--- a/tests/vartypo2.test
+++ b/tests/vartypo2.test
@@ -53,7 +53,7 @@ AUTOMAKE_fails --add-missing
 # Makefile.am:5: library has `libfoo_la' as canonical name (possible typo)
 
 
-test -z "`grep 'as canonical' stderr | grep -v ' .libfoo_la. '`"
+grep 'as canonical' stderr | grep -v ' .libfoo_la. ' && Exit 1
 test `grep 'variable.*is defined but' stderr | wc -l` = 6
 
 # If we add a global -Wnone, all warnings should disappear.
diff --git a/tests/vartypos.test b/tests/vartypos.test
index fe4f8e6..03747ed 100755
--- a/tests/vartypos.test
+++ b/tests/vartypos.test
@@ -71,7 +71,8 @@ AUTOMAKE_fails
 # Makefile.am:13: warning: variable `libfoo_a_DEPENDENCIES' is defined but no 
program or
 # Makefile.am:13: library has `libfoo_a' as canonical name (possible typo)
 
-test -z "`grep 'as canonical' stderr | grep -v ' .foo. ' | grep -v ' 
.libfoo_a. '`"
+grep 'as canonical' stderr | grep -v ' .foo. ' | grep -v ' .libfoo_a. ' \
+  && Exit 1
 test `grep 'variable.*is defined but' stderr | wc -l` = 13
 
 # If we add a global -Wnone, all warnings should disappear.



reply via email to

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