From: Stefano Lattarini Date: Thu, 2 Jun 2011 15:05:51 +0000 (+0200) Subject: tests: use `$SHELL' to run the shell scripts from `lib/' X-Git-Tag: ng-0.5a~89^2~201 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f977d00e0a3ab9af3555bb3bc8ea78726cb7a143;p=thirdparty%2Fautomake.git tests: use `$SHELL' to run the shell scripts from `lib/' This should offer greater testsuite coverage for those developers that override CONFIG_SHELL at configure time in order to test more shells on a single system, instead of just the default `/bin/sh'. This change also fixes few spurious failures in tests using the `xsi-shell' requirement, where inconsistencies could crop up if the shell probed for XSI features (which, by default, is $SHELL) was not the same shell later used to run the scripts using those features (which was hard-coded to `/bin/sh'). Such failures have already occurred in practice, for examples on Solaris systems which had also GNU Bash installed. * tests/ar-lib.test: Run the `ar-lib' script with `$SHELL', rather than directly with `./ar-lib', which would make run unconditionally with `/bin/sh'. * tests/compile.test: Likewise, but for the `compile' script. * tests/compile2.test: Likewise. * tests/compile3.test: Likewise. * tests/compile4.test: Likewise. * tests/compile5.test: Likewise. * tests/compile6.test: Likewise. * tests/instsh2.test: Likewise, but for the `install' script. * tests/instsh3.test: Likewise. * tests/mkinst3.test: Likewise, but for the `mkinstalldirs' script. * tests/missing.test: Likewise, but for the `missing' script. * tests/missing2.test: Likewise. * tests/missing3.test: Likewise. * tests/missing5.test: Likewise. --- diff --git a/ChangeLog b/ChangeLog index df6cb05cd..35c98a144 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,33 @@ +2011-06-02 Stefano Lattarini + + tests: use `$SHELL' to run the shell scripts from `lib/' + This should offer greater testsuite coverage for those developers + that override CONFIG_SHELL at configure time in order to test more + shells on a single system, instead of just the default `/bin/sh'. + This change also fixes few spurious failures in tests using the + `xsi-shell' requirement, where inconsistencies could crop up if + the shell probed for XSI features (which, by default, is $SHELL) + was not the same shell later used to run the scripts using those + features (which was hard-coded to `/bin/sh'). Such failures have + already occurred in practice, for examples on Solaris systems + which had also GNU Bash installed. + * tests/ar-lib.test: Run the `ar-lib' script with `$SHELL', rather + than directly with `./ar-lib', which would make run unconditionally + with `/bin/sh'. + * tests/compile.test: Likewise, but for the `compile' script. + * tests/compile2.test: Likewise. + * tests/compile3.test: Likewise. + * tests/compile4.test: Likewise. + * tests/compile5.test: Likewise. + * tests/compile6.test: Likewise. + * tests/instsh2.test: Likewise, but for the `install' script. + * tests/instsh3.test: Likewise. + * tests/mkinst3.test: Likewise, but for the `mkinstalldirs' script. + * tests/missing.test: Likewise, but for the `missing' script. + * tests/missing2.test: Likewise. + * tests/missing3.test: Likewise. + * tests/missing5.test: Likewise. + 2011-06-02 Stefano Lattarini silent-rules tests: fix spurious failures with Sun Studio C++ diff --git a/tests/ar-lib.test b/tests/ar-lib.test index 7168ecd3a..06c9c00be 100755 --- a/tests/ar-lib.test +++ b/tests/ar-lib.test @@ -36,51 +36,51 @@ END chmod +x ./lib # Check if ar-lib can create an archive with "cr" -opts=`./ar-lib ./lib cr foo.lib foo.obj` +opts=`$SHELL ar-lib ./lib cr foo.lib foo.obj` test x"$opts" = x"lib -NOLOGO -OUT:foo.lib foo.obj" # Check if ar-lib can update an existing archive with "r" touch foo.lib -opts=`./ar-lib ./lib r foo.lib foo.obj` +opts=`$SHELL ar-lib ./lib r foo.lib foo.obj` test x"$opts" = x"lib -NOLOGO -OUT:foo.lib foo.lib foo.obj" # Check if ar-lib passes on @FILE with "r" -opts=`./ar-lib ./lib r foo.lib @list` +opts=`$SHELL ar-lib ./lib r foo.lib @list` test x"$opts" = x"lib -NOLOGO -OUT:foo.lib foo.lib @list" # Check if ar-lib can delete a member from an archive with "d" -opts=`./ar-lib ./lib d foo.lib foo.obj` +opts=`$SHELL ar-lib ./lib d foo.lib foo.obj` test x"$opts" = x"lib -NOLOGO -REMOVE:foo.obj foo.lib" # Check if ar-lib can delete members in an @FILE echo foo.obj > foolist -opts=`./ar-lib ./lib d foo.lib @foolist` +opts=`$SHELL ar-lib ./lib d foo.lib @foolist` test x"$opts" = x"lib -NOLOGO -REMOVE:foo.obj foo.lib" # Check if ar-lib can list archive members with "t" -opts=`./ar-lib ./lib t foo.lib` +opts=`$SHELL ar-lib ./lib t foo.lib` test x"$opts" = x"lib -NOLOGO -LIST foo.lib" # Check if ar-lib can extract archive members with "x" touch fake.lib -opts=`./ar-lib ./lib x fake.lib` +opts=`$SHELL ar-lib ./lib x fake.lib` test x"$opts" = x"lib -NOLOGO -EXTRACT:fake.obj fake.lib" # Check if ar-lib can extract specified archive members with "x" -opts=`./ar-lib ./lib x foo.lib foo.obj` +opts=`$SHELL ar-lib ./lib x foo.lib foo.obj` test x"$opts" = x"lib -NOLOGO -EXTRACT:foo.obj foo.lib" # Check if ar-lib can extract members in an @FILE -opts=`./ar-lib ./lib x foo.lib @foolist` +opts=`$SHELL ar-lib ./lib x foo.lib @foolist` test x"$opts" = x"lib -NOLOGO -EXTRACT:foo.obj foo.lib" # Check if ar-lib passes -lib and -LTCG through to the wrappee -opts=`./ar-lib ./lib -lib -LTCG x foo.lib foo.obj` +opts=`$SHELL ar-lib ./lib -lib -LTCG x foo.lib foo.obj` test x"$opts" = x"lib -lib -LTCG -NOLOGO -EXTRACT:foo.obj foo.lib" # Check if ar-lib can extract backslashed members touch fake2.lib -opts=`./ar-lib ./lib x fake2.lib` +opts=`$SHELL ar-lib ./lib x fake2.lib` test x"$opts" = x"lib -NOLOGO -EXTRACT:dir\\fake2.obj fake2.lib" : diff --git a/tests/compile.test b/tests/compile.test index 8427bad09..59717fb2b 100755 --- a/tests/compile.test +++ b/tests/compile.test @@ -22,7 +22,7 @@ cp "$top_testsrcdir/lib/compile" . # -o 'a c' should not be stripped because 'a c' is not an object # (it does not matter whether touch creates ./-- or not) -./compile touch a.o -- -o 'a c' a.c +$SHELL compile touch a.o -- -o 'a c' a.c test -f 'a c' test -f ./-o test -f a.o @@ -30,14 +30,14 @@ test -f a.c rm -f 'a c' ./-o a.o a.c -./compile touch a.o -- -o 'a c.o' a.c +$SHELL compile touch a.o -- -o 'a c.o' a.c test -f 'a c.o' test ! -f ./-o test ! -f a.o test -f a.c # Make sure `compile' works for .obj too. -./compile touch a.obj -- -o ac.obj a.c +$SHELL compile touch a.obj -- -o ac.obj a.c test ! -f a.obj test ac.obj diff --git a/tests/compile2.test b/tests/compile2.test index a466dc413..35c3d4698 100755 --- a/tests/compile2.test +++ b/tests/compile2.test @@ -57,7 +57,7 @@ amtest_lock='slist_o.d' export amtest_source amtest_object amtest_obj amtest_lock : > "$amtest_source" -./compile ./mycc -c "$amtest_source" -o "$amtest_object" +$SHELL compile ./mycc -c "$amtest_source" -o "$amtest_object" test -f "$amtest_object" @@ -78,7 +78,7 @@ amtest_lock='slist_o.d' export amtest_source amtest_object amtest_obj amtest_lock : > "$amtest_source" -./compile ./mycc -c "$amtest_source" -o "$amtest_object" +$SHELL compile ./mycc -c "$amtest_source" -o "$amtest_object" test -f "$amtest_object" : diff --git a/tests/compile3.test b/tests/compile3.test index f949d1c2d..141a17a6e 100755 --- a/tests/compile3.test +++ b/tests/compile3.test @@ -30,23 +30,23 @@ END chmod +x ./cl # Check if compile handles "-o foo", -I, -l, -L, -Xlinker -Wl, -opts=`LIB= ./compile ./cl foo.c -o foo -lbar -Lgazonk -Ibaz -Xlinker foobar -Wl,-foo,bar` +opts=`LIB='' $SHELL compile ./cl foo.c -o foo -lbar -Lgazonk -Ibaz -Xlinker foobar -Wl,-foo,bar` test x"$opts" = x"foo.c -Fefoo bar.lib -Ibaz -link -LIBPATH:gazonk foobar -foo bar" # Check if compile handles "-o foo.obj" -opts=`./compile ./cl -c foo.c -o foo.obj -Ibaz` +opts=`$SHELL compile ./cl -c foo.c -o foo.obj -Ibaz` test x"$opts" = x"-c foo.c -Fofoo.obj -Ibaz" # Check if compile handles "-o foo.o" -opts=`./compile ./cl -c foo.c -o foo.o -Ibaz` +opts=`$SHELL compile ./cl -c foo.c -o foo.o -Ibaz` test x"$opts" = x"-c foo.c -Fofoo.o -Ibaz" # Check if compile handles "foo.cc" as C++. -opts=`./compile ./cl -c foo.cc -o foo.o -Ibaz` +opts=`$SHELL compile ./cl -c foo.cc -o foo.o -Ibaz` test x"$opts" = x"-c -Tpfoo.cc -Fofoo.o -Ibaz" # Check if compile clears the "eat" variable properly. -opts=`eat=1 ./compile ./cl -c foo.c -o foo.obj -Ibaz` +opts=`eat=1 $SHELL compile ./cl -c foo.c -o foo.obj -Ibaz` test x"$opts" = x"-c foo.c -Fofoo.obj -Ibaz" : diff --git a/tests/compile4.test b/tests/compile4.test index cf8d6cb7d..a54a2721b 100755 --- a/tests/compile4.test +++ b/tests/compile4.test @@ -66,7 +66,7 @@ $AUTOMAKE -a ./configure $MAKE -./compile cl $CPPFLAGS $CFLAGS -c -o "$absmainobj" "$absmainc" +$SHELL compile cl $CPPFLAGS $CFLAGS -c -o "$absmainobj" "$absmainc" # cl expects archives to be named foo.lib, not libfoo.a so # make a simple copy here if needed. This is a severe case @@ -76,7 +76,7 @@ if test -f sub/libfoo.a; then cp sub/libfoo.a sub/foo.lib fi -./compile cl $CFLAGS $LDFLAGS -L"$absfoodir" "$absmainobj" -o main -lfoo +$SHELL compile cl $CFLAGS $LDFLAGS -L"$absfoodir" "$absmainobj" -o main -lfoo ./main diff --git a/tests/compile5.test b/tests/compile5.test index cd8baee3c..d2aa21079 100755 --- a/tests/compile5.test +++ b/tests/compile5.test @@ -67,7 +67,7 @@ pwd=`pwd` # Check if "compile cl" transforms absolute file names to # host format (e.g /somewhere -> c:/msys/1.0/somewhere). -res=`./compile ./cl -L"$pwd" | sed -e 's/-link -LIBPATH://'` +res=`$SHELL ./compile ./cl -L"$pwd" | sed -e 's/-link -LIBPATH://'` case $res in ?:[\\/]*) diff --git a/tests/compile6.test b/tests/compile6.test index 02feb4b6d..fc39f1045 100755 --- a/tests/compile6.test +++ b/tests/compile6.test @@ -41,42 +41,42 @@ mkdir lib :> lib/bar.dll.lib # Check if compile library search correctly -opts=`./compile ./cl foo.c -o foo -Llib -lbar -lfoo` +opts=`$SHELL compile ./cl foo.c -o foo -Llib -lbar -lfoo` test x"$opts" = x"foo.c -Fefoo lib/bar.dll.lib $syslib/foo.lib -link -LIBPATH:lib" # Check if -static makes compile avoid bar.dll.lib -opts=`./compile ./cl foo.c -o foo -Llib -static -lbar -lfoo` +opts=`$SHELL compile ./cl foo.c -o foo -Llib -static -lbar -lfoo` test x"$opts" = x"foo.c -Fefoo lib/bar.lib $syslib/foo.lib -link -LIBPATH:lib" :> syslib/bar.lib :> syslib/bar.dll.lib # Check if compile finds bar.dll.lib in syslib -opts=`./compile ./cl foo.c -o foo -lbar -lfoo` +opts=`$SHELL compile ./cl foo.c -o foo -lbar -lfoo` test x"$opts" = x"foo.c -Fefoo $syslib/bar.dll.lib $syslib/foo.lib" # Check if compile prefers -L over $LIB -opts=`./compile ./cl foo.c -o foo -Llib -lbar -lfoo` +opts=`$SHELL compile ./cl foo.c -o foo -Llib -lbar -lfoo` test x"$opts" = x"foo.c -Fefoo lib/bar.dll.lib $syslib/foo.lib -link -LIBPATH:lib" mkdir lib2 :> lib2/bar.dll.lib # Check if compile avoids bar.dll.lib in lib2 when -static -opts=`./compile ./cl foo.c -o foo -Llib2 -static -lbar -lfoo` +opts=`$SHELL compile ./cl foo.c -o foo -Llib2 -static -lbar -lfoo` test x"$opts" = x"foo.c -Fefoo $syslib/bar.lib $syslib/foo.lib -link -LIBPATH:lib2" # Check if compile gets two different bar libraries when -static # is added in the middle -opts=`./compile ./cl foo.c -o foo -Llib2 -Llib -lbar -static -lbar` +opts=`$SHELL compile ./cl foo.c -o foo -Llib2 -Llib -lbar -static -lbar` test x"$opts" = x"foo.c -Fefoo lib2/bar.dll.lib lib/bar.lib -link -LIBPATH:lib2 -LIBPATH:lib" # Check if compile gets the correct bar.dll.lib -opts=`./compile ./cl foo.c -o foo -Llib -Llib2 -lbar -lfoo` +opts=`$SHELL compile ./cl foo.c -o foo -Llib -Llib2 -lbar -lfoo` test x"$opts" = x"foo.c -Fefoo lib/bar.dll.lib $syslib/foo.lib -link -LIBPATH:lib -LIBPATH:lib2" # Check if compile gets the correct bar.dll.lib -opts=`./compile ./cl foo.c -o foo -Llib2 -Llib -lbar -lfoo` +opts=`$SHELL compile ./cl foo.c -o foo -Llib2 -Llib -lbar -lfoo` test x"$opts" = x"foo.c -Fefoo lib2/bar.dll.lib $syslib/foo.lib -link -LIBPATH:lib2 -LIBPATH:lib" mkdir "sys lib2" @@ -87,11 +87,11 @@ LIB="$syslib2;$LIB" # Check if compile handles spaces in $LIB and that it prefers the order # in a multi-component $LIB. -opts=`./compile ./cl foo.c -o foo -lfoo` +opts=`$SHELL compile ./cl foo.c -o foo -lfoo` test x"$opts" = x"foo.c -Fefoo $syslib2/foo.dll.lib" # Check if compile handles the 2nd directory in a multi-component $LIB. -opts=`./compile ./cl foo.c -o foo -static -lfoo` +opts=`$SHELL compile ./cl foo.c -o foo -static -lfoo` test x"$opts" = x"foo.c -Fefoo $syslib/foo.lib" : diff --git a/tests/instsh2.test b/tests/instsh2.test index 2019b357f..294e1fada 100755 --- a/tests/instsh2.test +++ b/tests/instsh2.test @@ -19,95 +19,95 @@ . ./defs || Exit 1 # Basic errors -./install-sh && Exit 1 -./install-sh -m 644 dest && Exit 1 +$SHELL install-sh && Exit 1 +$SHELL install-sh -m 644 dest && Exit 1 # Directories # It should be OK to create no directory. We sometimes need # this when directory are conditionally defined. -./install-sh -d +$SHELL install-sh -d # One directory. -./install-sh -d d0 +$SHELL install-sh -d d0 test -d d0 # Multiple directories (for make installdirs). -./install-sh -d d1 d2 d3 d4 +$SHELL install-sh -d d1 d2 d3 d4 test -d d1 test -d d2 test -d d3 test -d d4 # Subdirectories -./install-sh -d p1/p2/p3 p4//p5//p6// +$SHELL install-sh -d p1/p2/p3 p4//p5//p6// test -d p1/p2/p3 test -d p4/p5/p6 # Files. : > x -./install-sh -c -m 644 x y +$SHELL install-sh -c -m 644 x y test -f x test -f y -./install-sh -m 644 y z +$SHELL install-sh -m 644 y z test -f y test -f z # Multiple files -./install-sh -m 644 -c x z d1 +$SHELL install-sh -m 644 -c x z d1 test -f x test -f z test -f d1/x test -f d1/z -./install-sh -m 644 x z d2// +$SHELL install-sh -m 644 x z d2// test -f x test -f z test -f d2/x test -f d2/z -./install-sh -t d3 -m 644 x z +$SHELL install-sh -t d3 -m 644 x z test -f x test -f z test -f d3/x test -f d3/z -./install-sh -t d4// -m 644 x z +$SHELL install-sh -t d4// -m 644 x z test -f x test -f z test -f d4/x test -f d4/z -./install-sh -T x d3/y +$SHELL install-sh -T x d3/y test -f x test -f d3/y -./install-sh -T x d3 && Exit 1 -./install-sh -T x d4// && Exit 1 +$SHELL install-sh -T x d3 && Exit 1 +$SHELL install-sh -T x d4// && Exit 1 # Ensure that install-sh works with names that include spaces. touch 'a b' mkdir 'x y' -./install-sh 'a b' 'x y' +$SHELL install-sh 'a b' 'x y' test -f x\ \ y/a\ \ b test -f 'a b' # Ensure we do not run into `test' operator precedence bugs with Tru64 sh. for c in = '(' ')' '!'; do - ./install-sh $c 2>stderr && { cat stderr >&2; Exit 1; } + $SHELL install-sh $c 2>stderr && { cat stderr >&2; Exit 1; } cat stderr >&2 grep 'test: ' stderr && Exit 1 # Skip tests if the file system is not capable. mkdir ./$c || continue rmdir ./$c - ./install-sh -d $c/$c/$c + $SHELL install-sh -d $c/$c/$c rm -rf ./$c - ./install-sh -d $c d5/$c/$c + $SHELL install-sh -d $c d5/$c/$c test -d ./$c test -d d5/$c/$c - ./install-sh x $c + $SHELL install-sh x $c test -f ./$c/x rm -f ./$c/x - ./install-sh -t $c x + $SHELL install-sh -t $c x test -f ./$c/x rm -rf ./$c ( : > ./$c ) || continue - ./install-sh $c x d5/$c/$c + $SHELL install-sh $c x d5/$c/$c test -f d5/$c/$c/x test -f d5/$c/$c/$c rm -f d5/$c/$c/? - ./install-sh -t d5/$c/$c $c x + $SHELL install-sh -t d5/$c/$c $c x test -f d5/$c/$c/x test -f d5/$c/$c/$c done diff --git a/tests/instsh3.test b/tests/instsh3.test index da5041905..788cf1dea 100755 --- a/tests/instsh3.test +++ b/tests/instsh3.test @@ -23,18 +23,20 @@ required=non-root touch -t $old_timestamp foo \ || skip_ "touch utility doesn't accept '-t' option" -./install-sh -d d1 +$SHELL install-sh -d d1 # Do not change the timestamps when using -C. echo foo >file -./install-sh -C file d1 +$SHELL install-sh -C file d1 TZ=UTC0 touch -t $old_timestamp d1/file -./install-sh -C file d1 +$SHELL install-sh -C file d1 is_newest file d1/file echo foo1 >file -./install-sh -C file d1 +$SHELL install-sh -C file d1 diff file d1/file # Rights must be updated. -./install-sh -C -m 444 file d1 +$SHELL install-sh -C -m 444 file d1 test -r d1/file test ! -w d1/file + +: diff --git a/tests/missing.test b/tests/missing.test index 2e6d8d382..0e6d0ea49 100755 --- a/tests/missing.test +++ b/tests/missing.test @@ -32,7 +32,7 @@ $AUTOMAKE --add-missing # Make sure we do use missing, even if the user exported AUTOCONF. # (We cannot export this new value, because it would be used by Automake # when tracing, and missing is no good for this.) -MYAUTOCONF="./missing --run $AUTOCONF" +MYAUTOCONF="$SHELL ./missing --run $AUTOCONF" unset AUTOCONF ./configure AUTOCONF="$MYAUTOCONF" diff --git a/tests/missing2.test b/tests/missing2.test index 88e6b27a6..304c3a6d5 100755 --- a/tests/missing2.test +++ b/tests/missing2.test @@ -33,7 +33,7 @@ $AUTOCONF $AUTOMAKE --add-missing # See missing.test for explanations about this. -MYAUTOCONF="./missing --run $AUTOCONF" +MYAUTOCONF="$SHELL missing --run $AUTOCONF" unset AUTOCONF ./configure AUTOCONF="$MYAUTOCONF" diff --git a/tests/missing3.test b/tests/missing3.test index 21b5e4fa7..f0b6907b8 100755 --- a/tests/missing3.test +++ b/tests/missing3.test @@ -20,31 +20,40 @@ # b7cb8259 assumed not to exist. -./missing b7cb8259 --version 2>stderr && { cat stderr >&2; Exit 1; } +$SHELL missing b7cb8259 --version 2>stderr \ + && { cat stderr >&2; Exit 1; } cat stderr >&2 grep . stderr && Exit 1 -./missing b7cb8259 --grep 2>stderr && { cat stderr >&2; Exit 1; } +$SHELL missing b7cb8259 --grep 2>stderr \ + && { cat stderr >&2; Exit 1; } cat stderr >&2 grep WARNING stderr -./missing --run b7cb8259 --version && Exit 1 -./missing --run b7cb8259 --grep 2>stderr && { cat stderr >&2; Exit 1; } +$SHELL missing --run b7cb8259 --version && Exit 1 +$SHELL missing --run b7cb8259 --grep 2>stderr \ + && { cat stderr >&2; Exit 1; } cat stderr >&2 grep WARNING stderr # missing itself it known to exist :) -./missing ./missing --version 2>stderr && { cat stderr >&2; Exit 1; } +$SHELL missing ./missing --version 2>stderr \ + && { cat stderr >&2; Exit 1; } cat stderr >&2 grep . stderr && Exit 1 -./missing ./missing --grep 2>stderr && { cat stderr >&2; Exit 1; } +$SHELL missing ./missing --grep 2>stderr \ + && { cat stderr >&2; Exit 1; } cat stderr >&2 grep WARNING stderr -./missing --run ./missing --version 2>stderr || { cat stderr >&2; Exit 1; } +$SHELL missing --run ./missing --version 2>stderr \ + || { cat stderr >&2; Exit 1; } cat stderr >&2 grep . stderr && Exit 1 -./missing --run ./missing --grep 2>stderr && { cat stderr >&2; Exit 1; } +$SHELL missing --run ./missing --grep 2>stderr \ + && { cat stderr >&2; Exit 1; } cat stderr >&2 grep WARNING stderr && Exit 1 grep Unknown stderr + +: diff --git a/tests/missing5.test b/tests/missing5.test index 010b344d2..91e585780 100755 --- a/tests/missing5.test +++ b/tests/missing5.test @@ -33,9 +33,9 @@ AC_OUTPUT EOF for tool in $needed_tools; do - cat >$tool.in <$tool.in <