diff options
author | Stefano Lattarini <stefano.lattarini@gmail.com> | 2012-06-14 13:13:58 +0200 |
---|---|---|
committer | Stefano Lattarini <stefano.lattarini@gmail.com> | 2012-06-22 14:24:38 +0200 |
commit | 6e713425a0dcede167924e7691e95ab5e54e399c (patch) | |
tree | 4ce8cbe368733dc0049b5b690b13e0e3123d7a3a | |
parent | d0dc448517d3a61ba55e62dd76b9a42b68bef8f8 (diff) | |
download | automake-6e713425a0dcede167924e7691e95ab5e54e399c.tar.gz |
tests: use more POSIX shell features our test scripts
Since commit 'v1.12-36-g2d68fd9' of 2012-05-07, "configure: search a
sturdy POSIX shell to be used in the testsuite", the shell running
our test script is assured to be a POSIX-conforming shell, so we can
use the more modern and flexible idioms and features that we couldn't
use when we also aimed at compatibility with non-POSIX Bourne shells,
like Solaris /bin/sh.
* t/README: Suggest to use POSIX shell features liberally in test cases,
with possible exception of Makefile recipes and configure shell code.
* Several tests: Adjust to use more POSIX shell features; e.g., $(...)
rather than `...`, $((...)) rather than `expr ...`, "if ! CMD; then ..."
instead of "if CMD; then :; else ...", and so on.
In several places, when using the 'test' built-in, prefer '-eq' over
'=' for numeric comparisons, and prefer "grep -c PATTERN FILE" over
"grep PATTERN FILE | wc -l".
Throw in other low-hanging easy improvements and fixlets while we are
at it.
* t/ax/depcomp.sh, t/ax/tap-summary-aux.sh, t/ax/tap-functions.sh,
defs, defs-static.in: Likewise.
Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
326 files changed, 908 insertions, 867 deletions
@@ -254,7 +254,7 @@ cross_compiling () # Resolve ties in favor of FILE. is_newest () { - is_newest_files=`find "$@" -prune -newer "$1"` + is_newest_files=$(find "$@" -prune -newer "$1") test -z "$is_newest_files" } @@ -344,7 +344,7 @@ extract_configure_help () am__opt_re='' am__var_re='' case $1 in --*'=') am__opt_re="^ $1";; - --*'[=]') am__opt_re='^ '`printf '%s\n' "$1" | sed 's/...$//'`'\[=';; + --*'[=]') am__opt_re='^ '$(printf '%s\n' "$1" | sed 's/...$//')'\[=';; --*) am__opt_re="^ $1( .*|$)";; *) am__var_re="^ $1( .*|$)";; esac @@ -507,24 +507,10 @@ seq_ () 3) seq_first=$1 seq_incr=$2 seq_last=$3;; *) fatal_ "seq_: too many arguments";; esac - # Try to avoid forks if possible. - case "$BASH_VERSION" in - ""|[12].*) - : Not bash, or a too old bash version. ;; - *) - # Use eval to protect dumber shells from parsing errors. - eval 'for ((i = seq_first; i <= seq_last; i += seq_incr)); do - echo $i - done' - return 0;; - esac - # Else, use GNU seq if available. - seq "$@" && return 0 - # Otherwise revert to a slower loop using expr(1). i=$seq_first while test $i -le $seq_last; do echo $i - i=`expr $i + $seq_incr` + i=$(($i + $seq_incr)) done } @@ -561,12 +547,12 @@ count_test_results () # Avoid spurious failures with shells with "overly sensible" # errexit shell flag, such as e.g., Solaris /bin/sh. set +e - test `grep -c '^PASS:' stdout` -eq $pass || rc=1 - test `grep -c '^XFAIL:' stdout` -eq $xfail || rc=1 - test `grep -c '^SKIP:' stdout` -eq $skip || rc=1 - test `grep -c '^FAIL:' stdout` -eq $fail || rc=1 - test `grep -c '^XPASS:' stdout` -eq $xpass || rc=1 - test `grep -c '^ERROR:' stdout` -eq $error || rc=1 + test $(grep -c '^PASS:' stdout) -eq $pass || rc=1 + test $(grep -c '^XFAIL:' stdout) -eq $xfail || rc=1 + test $(grep -c '^SKIP:' stdout) -eq $skip || rc=1 + test $(grep -c '^FAIL:' stdout) -eq $fail || rc=1 + test $(grep -c '^XPASS:' stdout) -eq $xpass || rc=1 + test $(grep -c '^ERROR:' stdout) -eq $error || rc=1 grep "^# TOTAL: *$total$" stdout || rc=1 grep "^# PASS: *$pass$" stdout || rc=1 grep "^# XFAIL: *$xfail$" stdout || rc=1 @@ -602,7 +588,8 @@ commented_sed_unindent_prog=' unindent () { if test x"$sed_unindent_prog" = x; then - sed_unindent_prog=`printf '%s\n' "$commented_sed_unindent_prog" | sed -e "s/ *# .*//"` + sed_unindent_prog=$(printf '%s\n' "$commented_sed_unindent_prog" \ + | sed -e "s/ *# .*//") fi sed "$sed_unindent_prog" ${1+"$@"} } @@ -787,10 +774,8 @@ do MAKE=$make_ am__using_gmake='' test "$MAKE" = : && break echo "$me: determine whether $MAKE is GNU make" - # Don't use "&&" here, or a bug of 'set -e' present in some - # versions of the BSD shell will be triggered. We add the - # dummy "else" branch for extra safety. - if using_gmake; then break; else :; fi + using_gmake && break + : For shells with busted 'set -e'. done test "$MAKE" = : && skip_all_ "this test requires GNU make" export MAKE @@ -862,12 +847,13 @@ do "the '--html' option" ;; mingw) - uname_s=`uname -s || echo UNKNOWN` + uname_s=$(uname -s || echo UNKNOWN) echo "$me: system name: $uname_s" case $uname_s in MINGW*) ;; *) skip_all_ "this test requires MSYS in MinGW mode" ;; esac + unset uname_s ;; non-root) # Skip this test case if the user is root. @@ -894,9 +880,7 @@ do # Don't use "&&" here, to avoid a bug of 'set -e' present in # some (even relatively recent) versions of the BSD shell. # We add the dummy "else" branch for extra safety. - if cross_compiling; then - skip_all_ "doesn't work in cross-compile mode" - else :; fi + ! cross_compiling || skip_all_ "doesn't work in cross-compile mode" ;; python) # Python doesn't support --version, it has -V @@ -278,6 +278,22 @@ Do Do not ------ + In test scripts, prefer using POSIX constructs over their old + Bourne-only equivalents: + + - use $(...), not `...`, for command substitution; + - use $((...), not `expr ...`, for arithmetic processing; + - liberally use '!' to invert the exit status of a command, e.g., + in idioms like "if ! CMD; then ...", instead of relying on clumsy + paraphrases like "if CMD; then :; else ...". + - prefer use of ${param%pattern} and ${param#pattern} parameter + expansions over processing by 'sed' or 'expr'. + + Note however that, when writing Makefile recipes or shell code in a + configure.ac, you should still use `...` instead, because the Autoconf + generated configure scripts do not ensure they will find a truly POSIX + shell (even though they will prefer and use it *if* it's found). + Do not test an Automake error with "$AUTOMAKE && Exit 1", or in three years we'll discover that this test failed for some other bogus reason. This happened many times. Better use something like diff --git a/t/ac-output-old.tap b/t/ac-output-old.tap index 5ba3d3e3a..06b17caa2 100755 --- a/t/ac-output-old.tap +++ b/t/ac-output-old.tap @@ -146,7 +146,7 @@ mkdir subdir command_ok_ "aclocal and AC_OUTPUT ($cur)" $ACLOCAL command_ok_ "automake and AC_OUTPUT ($cur)" $AUTOMAKE command_ok_ "foo.in mentioned two times in Makefile.in ($cur)" \ - test `$FGREP foo.in Makefile.in | wc -l` -eq 2 + test $($FGREP -c 'foo.in' Makefile.in) -eq 2 # This ought to work as well. command_ok_ "'automake -a -f' and AC_OUTPUT ($cur)" \ diff --git a/t/acloca13.sh b/t/acloca13.sh index e91a534ed..aab2dafb6 100755 --- a/t/acloca13.sh +++ b/t/acloca13.sh @@ -61,9 +61,11 @@ $sleep touch m4/otherfile.m4 $sleep $ACLOCAL -I m4 -test `ls -1t aclocal.m4 m4/otherfile.m4 | sed 1q` = aclocal.m4 +test $(ls -1t aclocal.m4 m4/otherfile.m4 | sed 1q) = aclocal.m4 $AUTOCONF $AUTOMAKE ./configure $MAKE distcheck + +: diff --git a/t/acloca14.sh b/t/acloca14.sh index ba1f07228..c36538f08 100755 --- a/t/acloca14.sh +++ b/t/acloca14.sh @@ -91,7 +91,7 @@ EOF $MAKE # Because c.m4 has changed, aclocal.m4 must have been rebuilt. -test `ls -1t aclocal.m4 stamp | sed 1q` = aclocal.m4 +test $(ls -1t aclocal.m4 stamp | sed 1q) = aclocal.m4 # However, since FOO is not used, f.m4 should not be included # and the contents of aclocal.m4 should remain the same diff aclocal.m4 stamp diff --git a/t/acloca15.sh b/t/acloca15.sh index 690c06c67..01d11de03 100755 --- a/t/acloca15.sh +++ b/t/acloca15.sh @@ -42,6 +42,6 @@ $ACLOCAL -I m4 $FGREP AM_SOME_MACRO aclocal.m4 && Exit 1 $FGREP AM_MORE_MACRO aclocal.m4 && Exit 1 $FGREP 'm4_include([m4/more.m4])' aclocal.m4 -test 1 = `grep m4_include aclocal.m4 | wc -l` +test 1 = $(grep m4_include aclocal.m4 | wc -l) : diff --git a/t/acloca18.sh b/t/acloca18.sh index c0510e10d..4ae03ff07 100755 --- a/t/acloca18.sh +++ b/t/acloca18.sh @@ -128,7 +128,7 @@ grep 'installing.*4/m1\.m4' stderr $ACLOCAL -I 5 2>stderr && { cat stderr >&2; Exit 1; } cat stderr >&2 -test `grep -c 'ill-formed serial' stderr` -eq 3 +test $(grep -c 'ill-formed serial' stderr) -eq 3 $ACLOCAL -I 6 2>stderr && { cat stderr >&2; Exit 1; } cat stderr >&2 diff --git a/t/aclocal-install-absdir.sh b/t/aclocal-install-absdir.sh index b07f7fac9..1c9938ebf 100755 --- a/t/aclocal-install-absdir.sh +++ b/t/aclocal-install-absdir.sh @@ -26,7 +26,7 @@ mkdir loc sys echo 'AM_DUMMY_MACRO' >> configure.ac echo 'AC_DEFUN([AM_DUMMY_MACRO], [:])' >> sys/foo.m4 -cwd=`pwd` || fatal_ "cannot get current working directory" +cwd=$(pwd) || fatal_ "cannot get current working directory" env ACLOCAL_PATH="$cwd/sys" $ACLOCAL --verbose --install -I "$cwd/loc" diff sys/foo.m4 loc/foo.m4 diff --git a/t/aclocal-install-mkdir.sh b/t/aclocal-install-mkdir.sh index ba4be2a64..86cf8031a 100755 --- a/t/aclocal-install-mkdir.sh +++ b/t/aclocal-install-mkdir.sh @@ -36,7 +36,7 @@ ACLOCAL="$ACLOCAL --system-acdir=sys-acdir" $ACLOCAL -I foo --install test -f foo/my-defs.m4 -$ACLOCAL --install -I "`pwd`/bar" +$ACLOCAL --install -I "$(pwd)/bar" test -f bar/my-defs.m4 $ACLOCAL --install -I baz/sub/sub2 @@ -54,10 +54,10 @@ ls zardoz2 | grep . && Exit 1 # Directories in ACLOCAL_PATH should never be created if they don't # exist. -ACLOCAL_PATH="`pwd`/none:`pwd`/none2" $ACLOCAL --install && Exit 1 +ACLOCAL_PATH="$(pwd)/none:$(pwd)/none2" $ACLOCAL --install && Exit 1 test ! -d none test ! -d none2 -ACLOCAL_PATH="`pwd`/none:`pwd`/none2" $ACLOCAL --install -I x +ACLOCAL_PATH="$(pwd)/none:$(pwd)/none2" $ACLOCAL --install -I x test -f x/my-defs.m4 test ! -d none test ! -d none2 diff --git a/t/aclocal-path-install-serial.sh b/t/aclocal-path-install-serial.sh index 8a2b22c59..c238a7868 100755 --- a/t/aclocal-path-install-serial.sh +++ b/t/aclocal-path-install-serial.sh @@ -57,7 +57,7 @@ win () mkdir sdir pdir m4 -ACLOCAL="$ACLOCAL --system-acdir=`pwd`/sdir" +ACLOCAL="$ACLOCAL --system-acdir=$(pwd)/sdir" ACLOCAL_PATH=./pdir; export ACLOCAL_PATH cat > sdir/foo.m4 << 'END' diff --git a/t/aclocal-path-install.sh b/t/aclocal-path-install.sh index a9a8b97c6..71d718cec 100755 --- a/t/aclocal-path-install.sh +++ b/t/aclocal-path-install.sh @@ -26,7 +26,7 @@ END mkdir acdir pdir ldir -ACLOCAL="$ACLOCAL --system-acdir=`pwd`/acdir" +ACLOCAL="$ACLOCAL --system-acdir=$(pwd)/acdir" ACLOCAL_PATH=./pdir; export ACLOCAL_PATH cat > acdir/foo.m4 << 'END' diff --git a/t/aclocal-path-nonexistent.sh b/t/aclocal-path-nonexistent.sh index 8c42ddc65..3eb042aad 100755 --- a/t/aclocal-path-nonexistent.sh +++ b/t/aclocal-path-nonexistent.sh @@ -27,7 +27,7 @@ END mkdir mdir echo 'AC_DEFUN([AM_FOO], [am--foo])' > mdir/foo.m4 -ACLOCAL_PATH=./nonesuch:./mdir:`pwd`/nonesuch2:nonesuch3 $ACLOCAL +ACLOCAL_PATH=./nonesuch:./mdir:$(pwd)/nonesuch2:nonesuch3 $ACLOCAL $AUTOCONF $FGREP 'am--foo' configure diff --git a/t/aclocal-path.sh b/t/aclocal-path.sh index d1279f021..72b393897 100755 --- a/t/aclocal-path.sh +++ b/t/aclocal-path.sh @@ -40,7 +40,7 @@ cat > mdir3/baz.m4 << 'END' AC_DEFUN([AM_BAZ_MACRO], [am--baz]) END -ACLOCAL_PATH=mdir1:./mdir2:`pwd`/mdir3 $ACLOCAL +ACLOCAL_PATH=mdir1:./mdir2:$(pwd)/mdir3 $ACLOCAL $AUTOCONF # there should be no m4_include in aclocal.m4, even though ACLOCAL_PATH diff --git a/t/aclocal-print-acdir.sh b/t/aclocal-print-acdir.sh index 3d8bf4e7d..ef61b2f62 100755 --- a/t/aclocal-print-acdir.sh +++ b/t/aclocal-print-acdir.sh @@ -20,15 +20,15 @@ am_create_testdir=empty . ./defs || Exit 1 $ACLOCAL --print-ac-dir -test "`$ACLOCAL --print-ac-dir`" = "$am_system_acdir" +test "$($ACLOCAL --print-ac-dir)" = "$am_system_acdir" $ACLOCAL -Wno-obsolete --acdir foo --print-ac-dir -test "`$ACLOCAL -Wno-obsolete --acdir foo --print-ac-dir`" = foo +test "$($ACLOCAL -Wno-obsolete --acdir foo --print-ac-dir)" = foo $ACLOCAL --system-acdir /bar --print-ac-dir -test "`$ACLOCAL --system-acdir /bar --print-ac-dir`" = /bar +test "$($ACLOCAL --system-acdir /bar --print-ac-dir)" = /bar $ACLOCAL --automake-acdir /bar --print-ac-dir -test "`$ACLOCAL --automake-acdir /bar --print-ac-dir`" = "$am_system_acdir" +test "$($ACLOCAL --automake-acdir /bar --print-ac-dir)" = "$am_system_acdir" : diff --git a/t/aclocal7.sh b/t/aclocal7.sh index 548d89017..ce84983a2 100755 --- a/t/aclocal7.sh +++ b/t/aclocal7.sh @@ -55,17 +55,17 @@ $AUTOMAKE --no-force # aclocal.m4 and Makefile.in should not have been updated, so 'foo' # should be younger -test `ls -1t aclocal.m4 Makefile.in sub/Makefile.in foo | sed 1q` = foo +test $(ls -1t aclocal.m4 Makefile.in sub/Makefile.in foo | sed 1q) = foo $sleep $ACLOCAL -I m4 --force -test `ls -1t aclocal.m4 foo | sed 1q` = aclocal.m4 +test $(ls -1t aclocal.m4 foo | sed 1q) = aclocal.m4 # We still use --no-force for automake, but since aclocal.m4 has # changed all Makefile.ins should be updated. $sleep $AUTOMAKE --no-force -test `ls -1t Makefile.in foo | sed 1q` = Makefile.in -test `ls -1t sub/Makefile.in foo | sed 1q` = sub/Makefile.in +test $(ls -1t Makefile.in foo | sed 1q) = Makefile.in +test $(ls -1t sub/Makefile.in foo | sed 1q) = sub/Makefile.in touch m4/somedefs.m4 $sleep @@ -76,9 +76,9 @@ $sleep $AUTOMAKE --no-force # aclocal.m4 should have been updated, although its contents haven't changed. -test `ls -1t aclocal.m4 foo | sed 1q` = aclocal.m4 -test `ls -1t Makefile.in foo | sed 1q` = Makefile.in -test `ls -1t sub/Makefile.in foo | sed 1q` = sub/Makefile.in +test $(ls -1t aclocal.m4 foo | sed 1q) = aclocal.m4 +test $(ls -1t Makefile.in foo | sed 1q) = Makefile.in +test $(ls -1t sub/Makefile.in foo | sed 1q) = sub/Makefile.in touch fragment.inc $sleep @@ -87,9 +87,9 @@ $sleep $ACLOCAL -I m4 $AUTOMAKE --no-force # Only ./Makefile.in should change. -test `ls -1t aclocal.m4 foo | sed 1q` = foo -test `ls -1t Makefile.in foo | sed 1q` = Makefile.in -test `ls -1t sub/Makefile.in foo | sed 1q` = foo +test $(ls -1t aclocal.m4 foo | sed 1q) = foo +test $(ls -1t Makefile.in foo | sed 1q) = Makefile.in +test $(ls -1t sub/Makefile.in foo | sed 1q) = foo grep README Makefile.in && Exit 1 @@ -99,8 +99,8 @@ touch foo $sleep $AUTOMAKE --no-force # Even if no dependency change, the content changed. -test `ls -1t Makefile.in foo | sed 1q` = Makefile.in -test `ls -1t sub/Makefile.in foo | sed 1q` = foo +test $(ls -1t Makefile.in foo | sed 1q) = Makefile.in +test $(ls -1t sub/Makefile.in foo | sed 1q) = foo grep README Makefile.in @@ -111,6 +111,6 @@ $sleep $ACLOCAL -I m4 $AUTOMAKE --no-force # Only sub/Makefile.in should change. -test `ls -1t aclocal.m4 foo | sed 1q` = foo -test `ls -1t Makefile.in foo | sed 1q` = foo -test `ls -1t sub/Makefile.in foo | sed 1q` = sub/Makefile.in +test $(ls -1t aclocal.m4 foo | sed 1q) = foo +test $(ls -1t Makefile.in foo | sed 1q) = foo +test $(ls -1t sub/Makefile.in foo | sed 1q) = sub/Makefile.in diff --git a/t/aclocal8.sh b/t/aclocal8.sh index 8df0835bc..869969eb6 100755 --- a/t/aclocal8.sh +++ b/t/aclocal8.sh @@ -35,7 +35,7 @@ echo 'AC_DEFUN([MACRO1],)' >m4/macro1.m4 echo 'AC_DEFUN([MACRO2], [AC_REQUIRE([AM_UNUSED_MACRO])])' >m4/macro2.m4 $ACLOCAL -I m4 >output 2>&1 || { cat output; Exit 1; } -test 0 = `wc -l <output` +test 0 -eq $(wc -l <output) grep macro1.m4 aclocal.m4 grep macro2.m4 aclocal.m4 && Exit 1 diff --git a/t/add-missing.tap b/t/add-missing.tap index 39b7ae7f6..6f16a0ae6 100755 --- a/t/add-missing.tap +++ b/t/add-missing.tap @@ -25,7 +25,7 @@ am_create_testdir=empty plan_ "later" build_aux=build-aux -ocwd=`pwd` || fatal_ "cannot get current working directory" +ocwd=$(pwd) || fatal_ "cannot get current working directory" # Try to improve readability of displayed diffs. if diff -u /dev/null /dev/null; then @@ -79,7 +79,7 @@ check_count=0 check_ () { set +x # Temporary disable shell traces to remove noise from log files. - incr_ check_count + check_count=$(($check_count + 1)) echo check count: $check_count override=no run_aclocal=no @@ -280,7 +280,7 @@ END # For config.guess and config.sub. for mach in build host target system; do - MACH=`echo "$mach" | LC_ALL=C tr '[a-z]' '[A-Z]'` + MACH=$(echo "$mach" | LC_ALL=C tr '[a-z]' '[A-Z]') check_ <<END == Name == cfg-$mach diff --git a/t/amhello-binpkg.sh b/t/amhello-binpkg.sh index 4b3e0e21b..16fdfc3b8 100755 --- a/t/amhello-binpkg.sh +++ b/t/amhello-binpkg.sh @@ -28,12 +28,12 @@ cd amhello-1.0 ./configure --prefix /usr $MAKE -$MAKE DESTDIR="`pwd`/inst" install +$MAKE DESTDIR="$(pwd)/inst" install cd inst find . -type f -print > ../files.lst -tar cvf amhello-1.0-i686.tar.gz `cat ../files.lst` > tar.got 2>&1 +tar cvf amhello-1.0-i686.tar.gz $(cat ../files.lst) > tar.got 2>&1 -EXEEXT=`sed -n -e 's/^EXEEXT *= *//p' < ../Makefile` +EXEEXT=$(sed -n -e 's/^EXEEXT *= *//p' < ../Makefile) if tar --version </dev/null | grep GNU; then LC_ALL=C sort tar.got > t diff --git a/t/amhello-cross-compile.sh b/t/amhello-cross-compile.sh index b138d87c8..26093cffa 100755 --- a/t/amhello-cross-compile.sh +++ b/t/amhello-cross-compile.sh @@ -25,7 +25,7 @@ cp "$am_docdir"/amhello-1.0.tar.gz . \ || fatal_ "cannot get amhello tarball" host=i586-mingw32msvc -build=`"$am_scriptdir"/config.guess` && test -n "$build" \ +build=$("$am_scriptdir"/config.guess) && test -n "$build" \ || fatal_ "cannot guess build platform" case $build in *mingw*) skip_ "build system is MinGW too";; esac diff --git a/t/ar-lib.sh b/t/ar-lib.sh index 1ddec64d8..1d6b588db 100755 --- a/t/ar-lib.sh +++ b/t/ar-lib.sh @@ -37,77 +37,77 @@ END chmod +x ./lib # Check if ar-lib can create an archive with "cr". -opts=`./ar-lib ./lib cr foo.lib foo.obj` +opts=$(./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=$(./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 can update an existing archive with "q". -opts=`./ar-lib ./lib q foo.lib foo.obj` +opts=$(./ar-lib ./lib q foo.lib foo.obj) test x"$opts" = x"lib -NOLOGO -OUT:foo.lib foo.lib foo.obj" # Check if ar-lib accepts "u" as a modifier. # NOTE: "u" should have an effect, but currently doesn't. -opts=`./ar-lib ./lib ru foo.lib foo.obj` +opts=$(./ar-lib ./lib ru foo.lib foo.obj) test x"$opts" = x"lib -NOLOGO -OUT:foo.lib foo.lib foo.obj" # Check if ar-lib accepts "s" as a modifier. -opts=`./ar-lib ./lib rs foo.lib foo.obj` +opts=$(./ar-lib ./lib rs foo.lib foo.obj) test x"$opts" = x"lib -NOLOGO -OUT:foo.lib foo.lib foo.obj" # Check if ar-lib accepts "S" as a modifier. -opts=`./ar-lib ./lib rS foo.lib foo.obj` +opts=$(./ar-lib ./lib rS 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=$(./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=$(./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=$(./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=$(./ar-lib ./lib t foo.lib) test x"$opts" = x"lib -NOLOGO -LIST foo.lib" # Check if ar-lib accepts "v" as a modifier. # NOTE: "v" should have an effect, but currently doesn't. -opts=`./ar-lib ./lib tv foo.lib` +opts=$(./ar-lib ./lib tv 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=$(./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=$(./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=$(./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=$(./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=$(./ar-lib ./lib x fake2.lib) test x"$opts" = x"lib -NOLOGO -EXTRACT:dir\\fake2.obj fake2.lib" # Check if ar-lib accepts "s" as an action. -opts=`./ar-lib ./lib s foo.lib` +opts=$(./ar-lib ./lib s foo.lib) test x"$opts" = x : diff --git a/t/ar-lib5b.sh b/t/ar-lib5b.sh index 2fb0cf43e..30a44a8ea 100755 --- a/t/ar-lib5b.sh +++ b/t/ar-lib5b.sh @@ -80,7 +80,7 @@ case " $* " in esac END chmod +x bin/lib -PATH=`pwd`/bin$PATH_SEPARATOR$PATH; export PATH +PATH=$(pwd)/bin$PATH_SEPARATOR$PATH; export PATH $ACLOCAL $AUTOCONF diff --git a/t/autodist-no-duplicate.sh b/t/autodist-no-duplicate.sh index 90a2c7dfc..2e610ae02 100755 --- a/t/autodist-no-duplicate.sh +++ b/t/autodist-no-duplicate.sh @@ -27,12 +27,12 @@ re='Files .*automatically distributed.*if found' list1=`$AUTOMAKE --help \ | sed -n "/^$re.*always/,/^ *$/p" \ | sed 1d` -list1=`echo $list1` +list1=$(echo $list1) list2=`$AUTOMAKE --help \ | sed -n "/^$re.*under certain conditions/,/^ *$/p" \ | sed 1d` -list2=`echo $list2` +list2=$(echo $list2) test -n "$list1" test -n "$list2" diff --git a/t/autodist-subdir.sh b/t/autodist-subdir.sh index 5e1f044e9..19d22dc4f 100755 --- a/t/autodist-subdir.sh +++ b/t/autodist-subdir.sh @@ -40,7 +40,7 @@ list=`$AUTOMAKE --help \ | sed -n '/^Files.*automatically distributed.*if found.*always/,/^ *$/p' \ | sed 1d` # Normalize whitespace, just in case. -list=`echo $list` +list=$(echo $list) test -n "$list" diff --git a/t/autodist.sh b/t/autodist.sh index e6435c54c..f8f68ad24 100755 --- a/t/autodist.sh +++ b/t/autodist.sh @@ -39,7 +39,7 @@ list=`$AUTOMAKE --help \ | sed -n '/^Files.*automatically distributed.*if found.*always/,/^ *$/p' \ | sed 1d` # Normalize whitespace, just in case. -list=`echo $list` +list=$(echo $list) test -n "$list" diff --git a/t/ax/depcomp.sh b/t/ax/depcomp.sh index a9180e937..7a602291a 100644 --- a/t/ax/depcomp.sh +++ b/t/ax/depcomp.sh @@ -69,7 +69,7 @@ # This expects ./defs has already been included has already been included.. -ocwd=`pwd` || fatal_ "cannot get current working directory" +ocwd=$(pwd) || fatal_ "getting current working directory" longpath=this-is/a-path/which-has/quite-a/definitely/truly/long_long_name cachevar=am_cv_CC_dependencies_compiler_type @@ -343,7 +343,7 @@ do_test () absolute) mkdir -p vpath-abs/build cd vpath-abs/build - absdir="`(cd .. && pwd)`" || fatal_ "getting absolute directory" + absdir=$(cd .. && pwd) || fatal_ "getting absolute directory" setup_srcdir "$absdir/vpath-abs" unset absdir ;; diff --git a/t/ax/tap-functions.sh b/t/ax/tap-functions.sh index 3a5db0309..eebcbe989 100644 --- a/t/ax/tap-functions.sh +++ b/t/ax/tap-functions.sh @@ -31,24 +31,10 @@ tap_fail_count_=0 tap_xfail_count_=0 tap_xpass_count_=0 -# The first "test -n" tries to avoid extra forks when possible. -if test -n "${ZSH_VERSION}${BASH_VERSION}" \ - || (eval 'test $((1 + 1)) = 2') >/dev/null 2>&1 -then - # Outer use of 'eval' needed to protect dumber shells from parsing - # errors. - eval 'incr_ () { eval "$1=\$((\${$1} + 1))"; }' -else - incr_ () { eval "$1=\`expr \${$1} + 1\`"; } -fi - # not COMMAND [ARGS...] # --------------------- # Run the given command and invert its exit status. -not () -{ - if "$@"; then return 1; else return 0; fi -} +not () { ! "$@"; } # plan_ [unknown|later|lazy|now|NUMBER-OF-PLANNED-TESTS] # ------------------------------------------------------ @@ -136,14 +122,20 @@ result_ () ""|TODO|SKIP) ;; *) bailout_ "result_: invalid directive '$directive_'" ;; esac - incr_ tap_count_ + tap_count_=$(($tap_count_ + 1)) case $tap_result_,$tap_directive_ in - ok,) incr_ tap_pass_count_;; # Passed. - not\ ok,TODO) incr_ tap_xfail_count_;; # Expected failure. - not\ ok,*) incr_ tap_fail_count_ ;; # Failed. - ok,TODO) incr_ tap_xpass_count_ ;; # Unexpected pass. - ok,SKIP) incr_ tap_skip_count_ ;; # Skipped. - *) bailout_ "internal error in 'result_'";; # Can't happen. + ok,) # Passed. + tap_pass_count_=$(($tap_pass_count_ + 1)) ;; + not\ ok,TODO) # Expected failure. + tap_xfail_count_=$(($tap_xfail_count_ + 1)) ;; + not\ ok,*) # Failed. + tap_fail_count_=$(($tap_fail_count_ + 1)) ;; + ok,TODO) # Unexpected pass. + tap_xpass_count_=$(($tap_xpass_count_ + 1)) ;; + ok,SKIP) # Skipped. + tap_skip_count_=$(($tap_skip_count_ + 1)) ;; + *) # Can't happen. + bailout_ "internal error in 'result_'" ;; esac tap_text_="$tap_result_ $tap_count_" if test x"$*" != x; then @@ -169,7 +161,7 @@ skip_ () { result_ 'ok' -D SKIP ${1+"$@"}; } skip_row_ () { skip_count_=$1; shift - for i_ in `seq_ $skip_count_`; do skip_ ${1+"$@"}; done + for i_ in $(seq_ $skip_count_); do skip_ ${1+"$@"}; done } # skip_all_ [REASON ...] diff --git a/t/ax/tap-summary-aux.sh b/t/ax/tap-summary-aux.sh index f5d1fbdfe..2fadb3d2b 100644 --- a/t/ax/tap-summary-aux.sh +++ b/t/ax/tap-summary-aux.sh @@ -311,7 +311,7 @@ done > tap # Lots of non-failures (300 per kind). (cat tap && cat tap && cat tap) > all.test -test `wc -l <all.test` -eq 900 || Exit 99 # Sanity check. +test $(wc -l <all.test) -eq 900 || Exit 99 # Sanity check. echo 1..900 >> all.test # Test plan. do_check --pass <<END $success_header @@ -327,7 +327,7 @@ END # 1 failure and lots of non-failures means failure. (cat tap && echo "not ok" && cat tap) > all.test -test `wc -l <all.test` -eq 601 || Exit 99 # Sanity check. +test $(wc -l <all.test) -eq 601 || Exit 99 # Sanity check. echo 1..601 >> all.test # Test plan. do_check --fail <<END $failure_header @@ -343,7 +343,7 @@ END # 1 error and lots of non-failures means failure. (cat tap && sed 30q tap && echo 'Bail out!') > all.test -test `wc -l <all.test` -eq 331 || Exit 99 # Sanity check. +test $(wc -l <all.test) -eq 331 || Exit 99 # Sanity check. echo 1..331 >> all.test # Test plan. do_check --fail <<END $failure_header diff --git a/t/c-demo.sh b/t/c-demo.sh index ed2a109cd..c461876e0 100755 --- a/t/c-demo.sh +++ b/t/c-demo.sh @@ -169,7 +169,7 @@ if ! cross_compiling && ! grep "[ $tab]depmode=none" Makefile; then mv -f t lib/bar.h $MAKE ./src/zardoz - test "`./src/zardoz`" = 'Foo, Zap!' + test "$(./src/zardoz)" = 'Foo, Zap!' fi $MAKE clean diff --git a/t/candist.sh b/t/candist.sh index 88d8854fd..aaa40d499 100755 --- a/t/candist.sh +++ b/t/candist.sh @@ -27,6 +27,6 @@ END $ACLOCAL AUTOMAKE_fails -test 2 -eq `grep -c 'dist.*forbidden' stderr` +test 2 -eq $(grep -c 'dist.*forbidden' stderr) Exit 0 diff --git a/t/ccnoco.sh b/t/ccnoco.sh index 1df950da8..60898c8d1 100755 --- a/t/ccnoco.sh +++ b/t/ccnoco.sh @@ -60,7 +60,7 @@ END chmod +x Mycomp # Make sure the compiler doesn't understand '-c -o' -CC=`pwd`/Mycomp +CC=$(pwd)/Mycomp export CC $ACLOCAL diff --git a/t/ccnoco3.sh b/t/ccnoco3.sh index eb291ecd5..b47ed48f3 100755 --- a/t/ccnoco3.sh +++ b/t/ccnoco3.sh @@ -58,6 +58,10 @@ END chmod +x Mycomp +# Make sure the compiler doesn't understand '-c -o' +CC=$(pwd)/Mycomp +export CC + $ACLOCAL $AUTOCONF $AUTOMAKE --copy --add-missing @@ -65,10 +69,6 @@ $AUTOMAKE --copy --add-missing mkdir build cd build -# Make sure the compiler doesn't understand '-c -o' -CC=`pwd`/../Mycomp -export CC - ../configure $MAKE 2>stderr || { cat stderr >&2; Exit 1; } cat stderr >&2 diff --git a/t/check12.sh b/t/check12.sh index dbb3101df..839f24fc3 100755 --- a/t/check12.sh +++ b/t/check12.sh @@ -136,12 +136,11 @@ for vpath in : false; do test -f hammer.sum test -f spanner.log test -f spanner.sum - # This checks will be run only by the autogenerated 'check12-p.test'. if test x"$am_serial_tests" != x"yes"; then test -f test-suite.log test -f a.log test -f b.log - else :; fi + fi grep 'check-local succeeded :-)' local.log cp -f config.status config-status.sav @@ -168,7 +167,6 @@ for vpath in : false; do grep 'FAIL:' spanner.sum && Exit 1 B_EXIT_STATUS=1 $MAKE check && Exit 1 - # This checks will be run only by the autogenerated 'check12-p.test'. if test x"$am_serial_tests" != x"yes"; then cat test-suite.log cat a.log @@ -179,7 +177,7 @@ for vpath in : false; do grep '^b\.test: exit status: 1$' test-suite.log grep '^a\.test' test-suite.log && Exit 1 : For shells with busted 'set -e'. - else :; fi + fi CHECKLOCAL_EXIT_STATUS=1 $MAKE check && Exit 1 grep 'check-local failed :-(' local.log @@ -192,7 +190,6 @@ for vpath in : false; do test -f spanner.sum grep 'FAIL: test_hammer' hammer.sum grep 'FAIL:' spanner.sum && Exit 1 - # This checks will be run only by the autogenerated 'check12-p.test'. if test x"$am_serial_tests" != x"yes"; then cat test-suite.log cat a.log @@ -203,7 +200,7 @@ for vpath in : false; do grep '^b\.test: exit status: 23$' test-suite.log grep '^a\.test' test-suite.log && Exit 1 : For shells with busted 'set -e'. - else :; fi + fi grep 'check-local failed :-(' local.log cd $srcdir diff --git a/t/check3.sh b/t/check3.sh index 69b6a674c..b4858e0eb 100755 --- a/t/check3.sh +++ b/t/check3.sh @@ -56,7 +56,7 @@ END $ACLOCAL $AUTOCONF $AUTOMAKE -a -./configure --prefix "`pwd`/inst" +./configure --prefix "$(pwd)/inst" $MAKE check >stdout || { cat stdout; Exit 1; } cat stdout diff --git a/t/check4.sh b/t/check4.sh index 78415e08d..49043c786 100755 --- a/t/check4.sh +++ b/t/check4.sh @@ -49,7 +49,7 @@ $ACLOCAL $AUTOCONF $AUTOMAKE --add-missing -./configure --prefix "`pwd`/inst" +./configure --prefix "$(pwd)/inst" $MAKE check >stdout && { cat stdout; Exit 1; } cat stdout diff --git a/t/color.sh b/t/color.sh index 6f5c902b9..18c6e232a 100755 --- a/t/color.sh +++ b/t/color.sh @@ -32,7 +32,7 @@ std="$esc\[m" # Check that grep can parse nonprinting characters. # BSD 'grep' works from a pipe, but not a seekable file. # GNU or BSD 'grep -a' works on files, but is not portable. -case `echo "$std" | grep .` in +case $(echo "$std" | grep .) in "$std") ;; *) skip_ "grep can't parse nonprinting characters";; esac diff --git a/t/color2.sh b/t/color2.sh index b073d5cb3..041ffe6e8 100755 --- a/t/color2.sh +++ b/t/color2.sh @@ -32,7 +32,7 @@ std="$esc\[m" # Check that grep can parse nonprinting characters. # BSD 'grep' works from a pipe, but not a seekable file. # GNU or BSD 'grep -a' works on files, but is not portable. -case `echo "$std" | grep .` in +case $(echo "$std" | grep .) in "$std") ;; *) skip_ "grep can't parse nonprinting characters";; esac diff --git a/t/comment4.sh b/t/comment4.sh index 42e7bf9ad..efd703631 100755 --- a/t/comment4.sh +++ b/t/comment4.sh @@ -31,9 +31,11 @@ EOF $ACLOCAL $AUTOMAKE -# UnIqUe_COPYRIGHT_BOILERPLATE should appear near the top of the file -test `sed -n -e '1,/UnIqUe_COPYRIGHT_BOILERPLATE/p' Makefile.in \ - | wc -l` -le 30 +# UnIqUe_COPYRIGHT_BOILERPLATE should appear near the top of the file. +test $(sed -n -e '1,/UnIqUe_COPYRIGHT_BOILERPLATE/p' \ + Makefile.in | wc -l) -le 30 # UnIqUe_MUMBLE_COMMENT should appear right before the mumble declaration. -test `sed -n -e '/UnIqUe_MUMBLE_COMMENT/,/UnIqUe_MUMBLE_VALUE/p' Makefile.in \ - | wc -l` -eq 2 +test $(sed -n -e '/UnIqUe_MUMBLE_COMMENT/,/UnIqUe_MUMBLE_VALUE/p' \ + Makefile.in | wc -l) -eq 2 + +: diff --git a/t/comment7.sh b/t/comment7.sh index 5637fb7b6..634cc2037 100755 --- a/t/comment7.sh +++ b/t/comment7.sh @@ -36,9 +36,11 @@ EOF $ACLOCAL $AUTOMAKE +$FGREP '@COND' Makefile.in # For debugging, mostly. + # The VAR definition appears once for each condition. -test `grep '@COND_TRUE@VAR' Makefile.in | wc -l` = 1 -test `grep '@COND_FALSE@VAR' Makefile.in | wc -l` = 1 +test $(grep -c '@COND_TRUE@VAR' Makefile.in) = 1 +test $(grep -c '@COND_FALSE@VAR' Makefile.in) = 1 # Make sure the right definition follows each comment. sed -n '/^#.*VAR.*COND_TRUE/ { @@ -51,3 +53,5 @@ sed -n '/^#.*VAR.*COND_FALSE/ { p }' Makefile.in | grep '@COND_FALSE@VAR = bar' + +: diff --git a/t/compile3.sh b/t/compile3.sh index 009de7023..a1cc479a8 100755 --- a/t/compile3.sh +++ b/t/compile3.sh @@ -34,25 +34,29 @@ chmod +x ./cl # -l and -L options and their respective arguments. Traditionally, # this should work also without a space. Try both usages. for sp in '' ' '; do + # Check if compile handles "-o foo", -I, -l, -L, -Xlinker -Wl, - opts=`LIB= ./compile ./cl foo.c -o foo -l${sp}bar -L${sp}gazonk -I${sp}baz -Xlinker foobar -Wl,-foo,bar` - test x"$opts" = x"foo.c -Fefoo bar.lib -Ibaz -link -LIBPATH:gazonk foobar -foo bar" + opts=$(LIB= ./compile ./cl foo.c -o foo -l${sp}bar -L${sp}gazonk \ + -I${sp}baz -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 -I${sp}baz` + opts=$(./compile ./cl -c foo.c -o foo.obj -I${sp}baz) 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 -I${sp}baz` + opts=$(./compile ./cl -c foo.c -o foo.o -I${sp}baz) 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 -I${sp}baz` + opts=$(./compile ./cl -c foo.cc -o foo.o -I${sp}baz) 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 -I${sp}baz` + opts=$(eat=1 ./compile ./cl -c foo.c -o foo.obj -I${sp}baz) test x"$opts" = x"-c foo.c -Fofoo.obj -Ibaz" + done : diff --git a/t/compile4.sh b/t/compile4.sh index bb9f6719c..8e516e3e5 100755 --- a/t/compile4.sh +++ b/t/compile4.sh @@ -25,25 +25,24 @@ get_shell_script compile mkdir sub cat >sub/foo.c <<'EOF' -int -foo () +int foo (void) { return 0; } EOF cat >main.c <<'EOF' -extern int foo (); -int -main () +extern int foo (void); +int main (void) { return foo (); } EOF -absfoodir=`pwd`/sub -absmainc=`pwd`/main.c -absmainobj=`pwd`/main.obj +cwd=$(pwd) || fatal_ "cannot get current directory" +absfoodir=$cwd/sub +absmainc=$cwd/main.c +absmainobj=$cwd/main.obj cat >> configure.ac << 'END' AC_PROG_CC @@ -84,9 +83,8 @@ fi # this should work also without a space. Try both usages. for sp in '' ' '; do rm -f main - - ./compile cl $CFLAGS $LDFLAGS -L${sp}"$absfoodir" "$absmainobj" -o main -l${sp}foo - + ./compile cl $CFLAGS $LDFLAGS -L${sp}"$absfoodir" "$absmainobj" \ + -o main -l${sp}foo ./main done diff --git a/t/compile5.sh b/t/compile5.sh index 02afca3fd..0f787cce8 100755 --- a/t/compile5.sh +++ b/t/compile5.sh @@ -62,7 +62,7 @@ $AUTOMAKE -a ./configure . ./check_host -pwd=`pwd` +cwd=$(pwd) || fatal_ "cannot get current directory" # POSIX mandates that the compiler accepts a space between the -I, # -l and -L options and their respective arguments. Traditionally, @@ -70,15 +70,10 @@ pwd=`pwd` for sp in '' ' '; do # Check if "compile cl" transforms absolute file names to # host format (e.g /somewhere -> c:/msys/1.0/somewhere). - - res=`./compile ./cl -L${sp}"$pwd" | sed -e 's/-link -LIBPATH://'` - + res=$(./compile ./cl -L${sp}"$cwd" | sed -e 's/-link -LIBPATH://') case $res in - ?:[\\/]*) - ;; - *) - Exit 1 - ;; + ?:[\\/]*) ;; + *) Exit 1 ;; esac done diff --git a/t/compile6.sh b/t/compile6.sh index 9db337328..3979802ee 100755 --- a/t/compile6.sh +++ b/t/compile6.sh @@ -34,72 +34,74 @@ chmod +x ./cl # -l and -L options and their respective arguments. Traditionally, # this should work also without a space. Try both usages. for sp in '' ' '; do + rm -rf lib lib2 syslib "sys lib2" mkdir syslib - :> syslib/foo.lib + : > syslib/foo.lib - syslib=`pwd`/syslib + syslib=$(pwd)/syslib LIB=$syslib export LIB mkdir lib - :> lib/bar.lib - :> lib/bar.dll.lib + : > lib/bar.lib + : > lib/bar.dll.lib # Check if compile library search correctly - opts=`./compile ./cl foo.c -o foo -L${sp}lib -l${sp}bar -l${sp}foo` + opts=$(./compile ./cl foo.c -o foo -L${sp}lib -l${sp}bar -l${sp}foo) 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 -L${sp}lib -static -l${sp}bar -l${sp}foo` + opts=$(./compile ./cl foo.c -o foo -L${sp}lib -static -l${sp}bar -l${sp}foo) test x"$opts" = x"foo.c -Fefoo lib/bar.lib $syslib/foo.lib -link -LIBPATH:lib" - :> syslib/bar.lib - :> syslib/bar.dll.lib + : > syslib/bar.lib + : > syslib/bar.dll.lib # Check if compile finds bar.dll.lib in syslib - opts=`./compile ./cl foo.c -o foo -l${sp}bar -l${sp}foo` + opts=$(./compile ./cl foo.c -o foo -l${sp}bar -l${sp}foo) 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 -L${sp}lib -l${sp}bar -l${sp}foo` + opts=$(./compile ./cl foo.c -o foo -L${sp}lib -l${sp}bar -l${sp}foo) test x"$opts" = x"foo.c -Fefoo lib/bar.dll.lib $syslib/foo.lib -link -LIBPATH:lib" mkdir lib2 - :> lib2/bar.dll.lib + : > lib2/bar.dll.lib # Check if compile avoids bar.dll.lib in lib2 when -static - opts=`./compile ./cl foo.c -o foo -L${sp}lib2 -static -l${sp}bar -l${sp}foo` + opts=$(./compile ./cl foo.c -o foo -L${sp}lib2 -static -l${sp}bar -l${sp}foo) 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 -L${sp}lib2 -L${sp}lib -l${sp}bar -static -l${sp}bar` + opts=$(./compile ./cl foo.c -o foo -L${sp}lib2 -L${sp}lib -l${sp}bar -static -l${sp}bar) 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 -L${sp}lib -L${sp}lib2 -l${sp}bar -l${sp}foo` + opts=$(./compile ./cl foo.c -o foo -L${sp}lib -L${sp}lib2 -l${sp}bar -l${sp}foo) 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 -L${sp}lib2 -L${sp}lib -l${sp}bar -l${sp}foo` + opts=$(./compile ./cl foo.c -o foo -L${sp}lib2 -L${sp}lib -l${sp}bar -l${sp}foo) test x"$opts" = x"foo.c -Fefoo lib2/bar.dll.lib $syslib/foo.lib -link -LIBPATH:lib2 -LIBPATH:lib" mkdir "sys lib2" - :> "sys lib2/foo.dll.lib" + : > "sys lib2/foo.dll.lib" - syslib2="`pwd`/sys lib2" + syslib2="$(pwd)/sys lib2" 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 -l${sp}foo` + opts=$(./compile ./cl foo.c -o foo -l${sp}foo) 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 -l${sp}foo` + opts=$(./compile ./cl foo.c -o foo -static -l${sp}foo) test x"$opts" = x"foo.c -Fefoo $syslib/foo.lib" + done : diff --git a/t/cond14.sh b/t/cond14.sh index f3725c3af..7f300e88e 100755 --- a/t/cond14.sh +++ b/t/cond14.sh @@ -46,6 +46,6 @@ $ACLOCAL $AUTOMAKE $FGREP helldl Makefile.in # For debugging. -test `$FGREP -c 'helldl$(EXEEXT):' Makefile.in` -eq 2 +test $($FGREP -c 'helldl$(EXEEXT):' Makefile.in) -eq 2 : diff --git a/t/cond15.sh b/t/cond15.sh index 68f70fd47..8ee799b2f 100755 --- a/t/cond15.sh +++ b/t/cond15.sh @@ -53,8 +53,8 @@ $ACLOCAL $AUTOMAKE $FGREP helldl Makefile.in # For debugging. -num1=`$FGREP 'helldl$(EXEEXT):' Makefile.in | wc -l` -num2=`$FGREP '@COND1_FALSE@@COND2_TRUE@helldl$(EXEEXT):' Makefile.in | wc -l` +num1=$($FGREP -c 'helldl$(EXEEXT):' Makefile.in) +num2=$($FGREP -c '@COND1_FALSE@@COND2_TRUE@helldl$(EXEEXT):' Makefile.in) test $num1 -eq 4 test $num2 -eq 1 diff --git a/t/cond33.sh b/t/cond33.sh index 9655d3b1e..d8b608749 100755 --- a/t/cond33.sh +++ b/t/cond33.sh @@ -47,7 +47,7 @@ $ACLOCAL $AUTOCONF $AUTOMAKE -cwd=`pwd` || fatal_ "cannot get current directory" +cwd=$(pwd) || fatal_ "cannot get current directory" mkdir nowhere chmod a-w nowhere diff --git a/t/cond35.sh b/t/cond35.sh index 043b3b059..a87090209 100755 --- a/t/cond35.sh +++ b/t/cond35.sh @@ -55,7 +55,7 @@ $AUTOCONF $AUTOMAKE --add-missing $FGREP 'tparse.h' Makefile.in # For debugging. -test `$FGREP -c 'tparse.h:' Makefile.in` = 1 +test $($FGREP -c 'tparse.h:' Makefile.in) -eq 1 cat > tscan.l << 'END' %{ diff --git a/t/cond36.sh b/t/cond36.sh index 82200cca9..d9b069908 100755 --- a/t/cond36.sh +++ b/t/cond36.sh @@ -54,7 +54,7 @@ $AUTOMAKE -Wno-error # Still and all, it should generate two rules. $FGREP 'tparse.h' Makefile.in # For debugging. -test `$FGREP -c 'tparse.h:' Makefile.in` = 2 +test $($FGREP -c 'tparse.h:' Makefile.in) -eq 2 $FGREP '@CASE_A_TRUE@tparse.h:' Makefile.in $FGREP '@CASE_A_FALSE@tparse.h:' Makefile.in diff --git a/t/cond42.sh b/t/cond42.sh index d4eee0104..c21772612 100755 --- a/t/cond42.sh +++ b/t/cond42.sh @@ -54,6 +54,6 @@ _AM_COND_ENDIF/' AUTOMAKE_fails grep '^configure\.ac:7:.* not enough arguments.* _AM_COND_IF' stderr grep '^configure\.ac:8:.* not enough arguments.* _AM_COND_ENDIF' stderr -test 2 = `grep -c 'not enough arguments' stderr` +test 2 -eq $($FGREP -c 'not enough arguments' stderr) : diff --git a/t/cond5.sh b/t/cond5.sh index 396130350..8accd6769 100755 --- a/t/cond5.sh +++ b/t/cond5.sh @@ -45,8 +45,8 @@ $ACLOCAL $AUTOMAKE 2>stderr & pid=$! -# MSYS bash seems to have a bug in kill, so don't try to kill too soon; -# and avoid maintainer-check test. +# MSYS bash seems to have a bug in kill, so don't try to kill too soon. +# The extra quoting avoids a maintainer-check failure. sleep '2' # Make at most 30 tries, one every 10 seconds (= 300 seconds = 5 min). @@ -55,7 +55,7 @@ while test $try -le 30; do if kill -0 $pid; then : process $pid is still alive, wait and retry sleep '10' - try=`expr $try + 1` + try=$(($try + 1)) else cat stderr >&2 # Automake must fail with a proper error message. diff --git a/t/cond6.sh b/t/cond6.sh index f6a499d1c..42fa40779 100755 --- a/t/cond6.sh +++ b/t/cond6.sh @@ -57,7 +57,7 @@ touch aclocal.m4 # Avoid unnecessary firing the remake rules. $AUTOCONF $AUTOMAKE Makefile -./configure --prefix="`pwd`/_inst" +./configure --prefix="$(pwd)/_inst" $MAKE test diff --git a/t/cond8.sh b/t/cond8.sh index f21aacba9..c498b7582 100755 --- a/t/cond8.sh +++ b/t/cond8.sh @@ -58,7 +58,7 @@ END cp x.c y.c -instdir=`pwd`/_inst || fatal_ "cannot get current directory" +instdir=$(pwd)/_inst || fatal_ "cannot get current directory" # Skip the rest of the test in case of e.g. missing C compiler. ./configure --prefix="$instdir" x=yes || Exit $? diff --git a/t/condhook.sh b/t/condhook.sh index 3b0f89c2a..bcd05510e 100755 --- a/t/condhook.sh +++ b/t/condhook.sh @@ -39,7 +39,7 @@ $ACLOCAL $AUTOCONF $AUTOMAKE -./configure --prefix "`pwd`/inst" +./configure --prefix "$(pwd)/inst" $MAKE install test -f inst/etc/mumble diff --git a/t/condhook2.sh b/t/condhook2.sh index a853e37a2..f68332c6f 100755 --- a/t/condhook2.sh +++ b/t/condhook2.sh @@ -38,7 +38,7 @@ $ACLOCAL $AUTOCONF $AUTOMAKE -./configure --prefix "`pwd`/inst" +./configure --prefix "$(pwd)/inst" $MAKE install test -f inst/etc/mumble diff --git a/t/condman3.sh b/t/condman3.sh index 9f2714ffe..89196dfb7 100755 --- a/t/condman3.sh +++ b/t/condman3.sh @@ -58,14 +58,14 @@ $EGREP 'MANS|\.([123456789]|man)' Makefile.in # For debugging. mkdir build cd build -../configure FOO=true --prefix="`pwd`/_inst" +../configure FOO=true --prefix="$(pwd)/_inst" $EGREP 'MANS|\.([123456789]|man)' Makefile # For debugging. touch foo.1 6.man $MAKE install $MAKE test1 cd .. -./configure FOO=false --prefix="`pwd`/_inst" +./configure FOO=false --prefix="$(pwd)/_inst" $EGREP 'MANS|\.([123456789]|man)' Makefile # For debugging. touch bar.2 baz.1 zap.5 $MAKE install @@ -77,7 +77,7 @@ test -f auxdir/install-sh is_symlink auxdir/install-sh test -f auxdir/depcomp is_not_symlink auxdir/depcomp -test FAKE-DEPCOMP = `cat auxdir/depcomp` +test FAKE-DEPCOMP = "$(cat auxdir/depcomp)" # 'automake -a -c' should not create symlinks, even when there are # already symlinked required auxiliary files. diff --git a/t/cscope.tap b/t/cscope.tap index dbc499375..f1f0c4e7c 100755 --- a/t/cscope.tap +++ b/t/cscope.tap @@ -20,7 +20,7 @@ plan_ 18 -ocwd=`pwd` || fatal_ "getting top-level directory" +ocwd=$(pwd) || fatal_ "getting top-level directory" cat >> configure.ac << 'END' AC_CONFIG_FILES([sub/Makefile]) diff --git a/t/cygnus-no-installinfo.sh b/t/cygnus-no-installinfo.sh index d46b6b36f..2de752d03 100755 --- a/t/cygnus-no-installinfo.sh +++ b/t/cygnus-no-installinfo.sh @@ -40,7 +40,7 @@ $ACLOCAL $AUTOMAKE --cygnus -Wno-override -Wno-obsolete $AUTOCONF -cwd=`pwd` || Exit 1 +cwd=$(pwd) || Exit 1 ./configure --prefix="$cwd"/_inst $MAKE $MAKE install diff --git a/t/dejagnu-siteexp-useredit.sh b/t/dejagnu-siteexp-useredit.sh index 9be5eba90..63fc18b54 100755 --- a/t/dejagnu-siteexp-useredit.sh +++ b/t/dejagnu-siteexp-useredit.sh @@ -56,7 +56,7 @@ $MAKE site.exp cat site.exp is_newest site.exp Makefile # Sanity check. grep '|objdir|' site.exp -test `grep -c '|objdir|' site.exp` -eq 1 +test $($FGREP -c '|objdir|' site.exp) -eq 1 # We can do a "more semantic" check if DejaGnu is available. if runtest SOMEPROGRAM=someprogram --version; then diff --git a/t/dejagnu2.sh b/t/dejagnu2.sh index 0a0d0910f..8feb5de9a 100755 --- a/t/dejagnu2.sh +++ b/t/dejagnu2.sh @@ -34,7 +34,7 @@ $AUTOCONF $AUTOMAKE -Wno-override grep 'site\.exp' Makefile.in -test `grep -c '^site\.exp:' Makefile.in` -eq 1 +test $(grep -c '^site\.exp:' Makefile.in) -eq 1 ./configure $MAKE site.exp diff --git a/t/dejagnu4.sh b/t/dejagnu4.sh index 44904dfbf..1c9479893 100755 --- a/t/dejagnu4.sh +++ b/t/dejagnu4.sh @@ -17,11 +17,11 @@ # Check that the DejaGnu rules work for a simple program and test case. # Also check PR 488: Failure of the first of several tools tested. # From the original bug report: -# ``If you use dejagnu for testing and have multiple tools (i.e., +# If you use dejagnu for testing and have multiple tools (i.e., # multiple entries in the DEJATOOL variable) then the success/failure # of "make check" is only dependent on the success/failure of the # tests on the final tool. Thus there may be failures in the tests on -# previous tools, but at first glance "make check" has passed.'' +# previous tools, but at first glance "make check" has passed. required=runtest . ./defs || Exit 1 diff --git a/t/depend.sh b/t/depend.sh index a2e3bd866..b69427dd6 100755 --- a/t/depend.sh +++ b/t/depend.sh @@ -31,4 +31,6 @@ END $ACLOCAL $AUTOMAKE -test 1 = `grep '^@AMDEP_TRUE@@am__include@' Makefile.in | wc -l` +test 1 -eq $(grep -c '^@AMDEP_TRUE@@am__include@' Makefile.in) + +: diff --git a/t/depend4.sh b/t/depend4.sh index d9896f860..e3ace0bbc 100755 --- a/t/depend4.sh +++ b/t/depend4.sh @@ -30,7 +30,7 @@ for header in one.h two.h three.h four.h five.h six.h; do fred_SOURCES = fred1.c $headers END $AUTOMAKE - test 1 = `grep '^@AMDEP_TRUE@@am__include@' Makefile.in | wc -l` + test 1 -eq $(grep -c '^@AMDEP_TRUE@@am__include@' Makefile.in) done : diff --git a/t/dirlist-abspath.sh b/t/dirlist-abspath.sh index 78af8b1f2..f33f44516 100755 --- a/t/dirlist-abspath.sh +++ b/t/dirlist-abspath.sh @@ -20,7 +20,7 @@ am_create_testdir=empty . ./defs || Exit 1 mkdir acdir-more sub sub/acdir -echo "`pwd`/acdir-more" > sub/acdir/dirlist +echo "$(pwd)/acdir-more" > sub/acdir/dirlist echo 'AC_DEFUN([AM_FOO], [foo-foo--foo])' > acdir-more/foo.m4 diff --git a/t/dist-auxdir-many-subdirs.sh b/t/dist-auxdir-many-subdirs.sh index f84514a79..50d04f332 100755 --- a/t/dist-auxdir-many-subdirs.sh +++ b/t/dist-auxdir-many-subdirs.sh @@ -22,7 +22,7 @@ required=cc . ./defs || Exit 1 count=0 -ocwd=`pwd` || fatal_ "cannot get current working directory" +ocwd=$(pwd) || fatal_ "cannot get current working directory" # Usage: do_check [--add-missing] [CONFIG-AUXDIR-PATH=.] do_check () @@ -33,7 +33,7 @@ do_check () esac auxdir=${1-.} - count=`expr $count + 1` + count=$(($count + 1)) mkdir T$count.d cd T$count.d diff --git a/t/dist-auxfile.sh b/t/dist-auxfile.sh index 9f7e8eee7..500f6b807 100755 --- a/t/dist-auxfile.sh +++ b/t/dist-auxfile.sh @@ -27,7 +27,7 @@ for auxdir in build-aux ''; do echo "*** Testing with auxdir '$auxdir' ***" - i=`expr $i + 1` + i=$(($i + 1)) mkdir T$i.d cd T$i.d diff --git a/t/dist-formats.tap b/t/dist-formats.tap index 26c6c97d7..ac6853b8e 100755 --- a/t/dist-formats.tap +++ b/t/dist-formats.tap @@ -26,7 +26,7 @@ plan_ 70 # Common and/or auxiliary subroutines and variables. # # ---------------------------------------------------- # -ocwd=`pwd` || fatal_ "obtaining current working directory" +ocwd=$(pwd) || fatal_ "getting current working directory" TAR='' && unset TAR @@ -66,45 +66,56 @@ setup_vars_for_compression_format () esac } +have_compressor () +{ + test $# -eq 1 || fatal_ "have_compressor(): bad usage" + case $1 in + # Assume gzip(1) is available on every reasonable portability target. + gzip) + return 0;; + # On Cygwin, as of 9/2/2012, 'compress' is provided by sharutils + # and is just a dummy script that is not able to actually compress + # (it can only decompress). So, check that the 'compress' program + # is actually able to compress input. + # Note that, at least on GNU/Linux, 'compress' does (and is + # documented to) exit with status 2 if the output is larger than + # the input after (attempted) compression; so we need to pass it + # an input that it can actually reduce in size when compressing. + compress) + for x in 1 2 3 4 5 6 7 8; do + echo aaaaaaaaaaaaaaaaaaaaa + done | compress -c >/dev/null && return 0 + return 1 + ;; + *) + # Redirect to stderr to avoid polluting the output, in case this + # function is used in a command substitution (as it is, below). + if $1 --version </dev/null >&2; then + return 0 + else + return 1 + fi + ;; + esac + fatal_ "have_compressor(): dead code reached" +} + all_compression_formats='gzip tarZ lzip xz bzip2 zip shar' -all_compressors=` +all_compressors=$( for x in $all_compression_formats; do setup_vars_for_compression_format $x echo $compressor - done | tr "$nl" ' '` + done | tr "$nl" ' ') echo All compressors: $all_compressors -missing_compressors=` +missing_compressors=$( for c in $all_compressors; do - case $c in - # Assume gzip(1) is available on every reasonable portability target. - gzip) - continue - ;; - # On Cygwin, as of 9/2/2012, 'compress' is provided by sharutils - # and is just a dummy script that is not able to actually compress - # (it can only decompress). So, check that the 'compress' program - # is actually able to compress input. - # Note that, at least on GNU/Linux, 'compress' does (and is - # documented to) exit with status 2 if the output is larger than - # the input after (attempted) compression; so we need to pass it - # an input that it can actually reduce in size when compressing. - compress) - for x in 1 2 3 4 5 6 7 8; do - echo aaaaaaaaaaaaaaa - done | $c -c >/dev/null && continue - : For shells with busted 'set -e'. - ;; - *) - $c --version </dev/null >&2 && continue - : For shells with busted 'set -e'. - ;; - esac - echo $c - done | tr "$nl" ' '` + have_compressor $c || echo $c + done | tr "$nl" ' ') echo Missing compressors: $missing_compressors +# Redefine to avoid re-running the already executed checks. have_compressor () { case " $missing_compressors " in *\ $1\ *) false;; *) : ;; esac @@ -122,8 +133,8 @@ start_subtest () if test $# -gt 0; then eval "$@" || fatal_ "start_subtest: evaluating assignments" fi - ac_opts=`echo $ac_opts | tr ',' ' '` - am_opts=`echo $am_opts | tr ',' ' '` + ac_opts=$(echo $ac_opts | tr ',' ' ') + am_opts=$(echo $am_opts | tr ',' ' ') mkdir "$name" cd "$name" unindent > configure.ac <<END @@ -171,7 +182,7 @@ can_compress () && $MAKE dist-$format \ && test -f $tarname-1.0.$suffix \ && ls -l *$tarname* \ - && test "`ls *$tarname*`" = $tarname-1.0.$suffix' + && test "$(echo *$tarname*)" = $tarname-1.0.$suffix' unset suffix compressor format tarname } @@ -188,7 +199,7 @@ command_ok_ "default [configure]" ./configure command_ok_ "default [make distcheck]" $MAKE distcheck command_ok_ "'make dist' only builds *.tar.gz by default" \ - test "`ls *defaults*`" = defaults-1.0.tar.gz + test "$(ls *defaults*)" = defaults-1.0.tar.gz rm -rf *defaults* @@ -430,7 +441,7 @@ ls -l # For debugging. cd .. oPATH=$PATH -PATH=`pwd`/bin$PATH_SEPARATOR$PATH; export PATH +PATH=$(pwd)/bin$PATH_SEPARATOR$PATH; export PATH command_ok_ \ "$desc ['make dist-all', stubbed]" \ diff --git a/t/dist-included-parent-dir.sh b/t/dist-included-parent-dir.sh index ae135aee4..a74c6dbeb 100755 --- a/t/dist-included-parent-dir.sh +++ b/t/dist-included-parent-dir.sh @@ -45,5 +45,7 @@ $AUTOCONF $AUTOMAKE # Use --srcdir with an absolute path because it's harder # to support in 'distdir'. -./configure --srcdir "`pwd`" +./configure --srcdir "$(pwd)" $MAKE test + +: diff --git a/t/dist-missing-am.sh b/t/dist-missing-am.sh index 0765b0c59..3390884e2 100755 --- a/t/dist-missing-am.sh +++ b/t/dist-missing-am.sh @@ -39,7 +39,7 @@ $AUTOMAKE # A faulty distribution tarball, with a required '.am' file missing. # Building from it should fail, both for in-tree and VPATH builds. -ocwd=`pwd` || fatal_ "cannot get current working directory" +ocwd=$(pwd) || fatal_ "cannot get current working directory" for vpath in false :; do $MAKE distdir test -f $distdir/zardoz.am # Sanity check. diff --git a/t/dist-missing-included-m4.sh b/t/dist-missing-included-m4.sh index 59600036c..b2835ee83 100755 --- a/t/dist-missing-included-m4.sh +++ b/t/dist-missing-included-m4.sh @@ -41,7 +41,7 @@ $AUTOMAKE # A faulty distribution tarball, with a required '.m4' file missing. # Building from it should fail, both for in-tree and VPATH builds. -ocwd=`pwd` || fatal_ "cannot get current working directory" +ocwd=$(pwd) || fatal_ "cannot get current working directory" for vpath in false :; do $MAKE distdir test -f $distdir/zardoz.m4 # Sanity check. diff --git a/t/dist-missing-m4.sh b/t/dist-missing-m4.sh index 9a418d316..b8284cbf1 100755 --- a/t/dist-missing-m4.sh +++ b/t/dist-missing-m4.sh @@ -43,7 +43,7 @@ $AUTOMAKE # A faulty distribution tarball, with a required '.m4' file missing. # Building from it should fail, both for in-tree and VPATH builds. -ocwd=`pwd` || fatal_ "cannot get current working directory" +ocwd=$(pwd) || fatal_ "cannot get current working directory" for vpath in false :; do $MAKE distdir test -f $distdir/m4/zardoz.m4 # Sanity check. diff --git a/t/dist-repeated.sh b/t/dist-repeated.sh index 6651e72c9..f67d17e6b 100755 --- a/t/dist-repeated.sh +++ b/t/dist-repeated.sh @@ -45,7 +45,7 @@ pythondir = ${prefix}/py PYTHON = false END -ocwd=`pwd` || fatal_ "cannot get current working directory" +ocwd=$(pwd) || fatal_ "cannot get current working directory" # Help to ensure cp won't see the same file twice. mkdir bin @@ -80,7 +80,7 @@ esac exec cp "\$@" END chmod a+x bin/cp -PATH=`pwd`/bin$PATH_SEPARATOR$PATH; export PATH; +PATH=$(pwd)/bin$PATH_SEPARATOR$PATH; export PATH; : > foo.c : > bar.py diff --git a/t/distcheck-missing-m4.sh b/t/distcheck-missing-m4.sh index e583be12f..051e52d14 100755 --- a/t/distcheck-missing-m4.sh +++ b/t/distcheck-missing-m4.sh @@ -20,7 +20,7 @@ . ./defs || Exit 1 -cwd=`pwd` || fatal_ "cannot get current working directory" +cwd=$(pwd) || fatal_ "cannot get current working directory" cp "$am_testauxdir"/distcheck-hook-m4.am . \ || fatal_ "cannot fetch makefile fragment 'distcheck-hook-m4.am'" diff --git a/t/distcheck-outdated-m4.sh b/t/distcheck-outdated-m4.sh index 71ae3dd21..ac8ce5419 100755 --- a/t/distcheck-outdated-m4.sh +++ b/t/distcheck-outdated-m4.sh @@ -20,7 +20,7 @@ . ./defs || Exit 1 -cwd=`pwd` || fatal_ "cannot get current working directory" +cwd=$(pwd) || fatal_ "cannot get current working directory" cp "$am_testauxdir"/distcheck-hook-m4.am . \ || fatal_ "cannot fetch makefile fragment 'distcheck-hook-m4.am'" diff --git a/t/distcheck-override-infodir.sh b/t/distcheck-override-infodir.sh index 746b5f859..4aaf268c8 100755 --- a/t/distcheck-override-infodir.sh +++ b/t/distcheck-override-infodir.sh @@ -55,7 +55,7 @@ $AUTOCONF $MAKE $MAKE distcheck -infodir="`pwd`"/_info $MAKE -e distcheck +infodir="$(pwd)/_info" $MAKE -e distcheck test -f _info/dir || Exit 99 # Sanity check. : diff --git a/t/distcheck-pr9579.sh b/t/distcheck-pr9579.sh index 8c789001e..0b205e8bb 100755 --- a/t/distcheck-pr9579.sh +++ b/t/distcheck-pr9579.sh @@ -42,7 +42,7 @@ $ACLOCAL $AUTOMAKE $AUTOCONF -./configure --prefix="`pwd`/inst" +./configure --prefix="$(pwd)/inst" # Sanity checks. $MAKE install diff --git a/t/distcom4.sh b/t/distcom4.sh index dc37fcf4f..32d3db2ac 100755 --- a/t/distcom4.sh +++ b/t/distcom4.sh @@ -69,7 +69,7 @@ sed -n -e '/^DIST_COMMON =.*\\$/ { cat dc.txt # For debugging. -test 1 = `grep tests dc.txt | wc -l` +test 1 -eq $(grep -c tests dc.txt) grep configure dc.txt # README must come first. grep 'DIST_COMMON = README' Makefile.in diff --git a/t/distcom5.sh b/t/distcom5.sh index adfbe52d1..de6ea11b4 100755 --- a/t/distcom5.sh +++ b/t/distcom5.sh @@ -78,7 +78,7 @@ extract_distcommon tests/Makefile.in > inner.txt cat top.txt cat inner.txt -test 0 = `grep tests top.txt | wc -l` -test 1 = `grep wrapper inner.txt | wc -l` +test 0 -eq $(grep -c tests top.txt) +test 1 -eq $(grep -c wrapper inner.txt) : diff --git a/t/distdir.sh b/t/distdir.sh index 0657928dc..41a9a8c7b 100755 --- a/t/distdir.sh +++ b/t/distdir.sh @@ -76,7 +76,7 @@ cat stdout grep 'MKDIR_P.*\.' stdout && Exit 1 cd .. -./configure --prefix "`pwd`" +./configure --prefix "$(pwd)" $MAKE distcheck : diff --git a/t/disthook.sh b/t/disthook.sh index 9804e9942..98f086d35 100755 --- a/t/disthook.sh +++ b/t/disthook.sh @@ -71,7 +71,7 @@ chmod a-x execute $MAKE distdir ls -l $distdir $distdir/doc cd $distdir -test "`cat write`" = "all is ok" +test "$(cat write)" = "all is ok" test ! -f removed test ! -r removed test -f doc/README @@ -82,7 +82,6 @@ test ! -r doc/HACING ./execute | grep 'I run successfully' cd .. - $MAKE distcheck test -f distcheck-run diff --git a/t/distlinks.sh b/t/distlinks.sh index 08244c06e..97b5b49e6 100755 --- a/t/distlinks.sh +++ b/t/distlinks.sh @@ -36,7 +36,7 @@ ln -s foo bar1 ln -s bar1 bar2 ln -s bar2 bar3 -ln -s "`pwd`/foo" quux +ln -s "$(pwd)/foo" quux cat >> configure.ac << 'END' AC_OUTPUT diff --git a/t/distlinksbrk.sh b/t/distlinksbrk.sh index b7732ca63..cf0556e93 100755 --- a/t/distlinksbrk.sh +++ b/t/distlinksbrk.sh @@ -29,7 +29,7 @@ lnkb=${lnk_base}__bbb ln -s nonesuch $lnk1 || skip_ "cannot create broken symlinks" -ln -s "`pwd`/nonesuch" $lnk2 +ln -s "$(pwd)/nonesuch" $lnk2 ln -s $lnk1 $lnka ln -s $lnka $lnkb diff --git a/t/dollar.sh b/t/dollar.sh index 92ed26a94..2fc9c93d1 100755 --- a/t/dollar.sh +++ b/t/dollar.sh @@ -38,7 +38,9 @@ EOF $ACLOCAL $AUTOCONF $AUTOMAKE -./configure --prefix "`pwd`/inst" +./configure --prefix "$(pwd)/inst" $MAKE install test -f 'inst/my/hello$world' $MAKE check-dist + +: diff --git a/t/empty.sh b/t/empty.sh index 795f92226..23f8a7d59 100755 --- a/t/empty.sh +++ b/t/empty.sh @@ -25,5 +25,7 @@ echo 'data_DATA =' >Makefile.am $ACLOCAL $AUTOCONF $AUTOMAKE -./configure --prefix "`pwd`/inst" +./configure --prefix "$(pwd)/inst" $MAKE install + +: diff --git a/t/exeext.sh b/t/exeext.sh index 42fa57497..a07bdcb74 100755 --- a/t/exeext.sh +++ b/t/exeext.sh @@ -62,7 +62,7 @@ grep '^maude\.static$(EXEEXT):' Makefile.in grep '^maude3$(EXEEXT):' Makefile.in grep '^mt$(EXEEXT):' Makefile.in grep '^rmt$(EXEEXT):' Makefile.in -test `grep '^bin_PROGRAMS =' Makefile.in | wc -l` = 1 +test $(grep -c '^bin_PROGRAMS =' Makefile.in) -eq 1 # Make sure $(EXEEXT) gets stripped before canonicalization. grep 'maude3__EXEEXT__OBJECTS' Makefile.in && Exit 1 @@ -86,3 +86,5 @@ grep '1BEG: maude.foo :END1' stdout grep '2BEG: maude.static.foo :END2' stdout grep '3BEG: maude3.foo :END3' stdout grep '4BEG: :END4' stdout + +: diff --git a/t/exeext3.sh b/t/exeext3.sh index 1bc1a1022..9561c7a2e 100755 --- a/t/exeext3.sh +++ b/t/exeext3.sh @@ -36,6 +36,8 @@ $ACLOCAL $AUTOMAKE -Wno-override $FGREP 'maude$(EXEEXT):' Makefile.in -test 1 = `grep 'maude.*:' Makefile.in | wc -l` +test 1 -eq $(grep -c 'maude.*:' Makefile.in) $FGREP '3dldf$(EXEEXT):' Makefile.in -test 1 = `grep '3dldf.*:' Makefile.in | wc -l` +test 1 -eq $(grep -c '3dldf.*:' Makefile.in) + +: diff --git a/t/exeext4.sh b/t/exeext4.sh index d9099b609..693fc566e 100755 --- a/t/exeext4.sh +++ b/t/exeext4.sh @@ -64,7 +64,7 @@ $MAKE test-cond # Only two am__EXEEXT_* variables are needed here: one for BAR, and one # BAZ. The latter must use the former. -test 2 = `grep '__EXEEXT_. =' Makefile.in | wc -l` +test 2 -eq $(grep -c '__EXEEXT_. =' Makefile.in) grep 'am__EXEEXT_2 = .*am__EXEEXT_1' Makefile.in : @@ -39,13 +39,10 @@ END $ACLOCAL $AUTOMAKE -for ext in f for f90 f95 F F90 F95 r m mm upc -do - # Some versions of the BSD shell wrongly exit when 'set -e' is active - # if the last command within a compound statement fails and is guarded - # by an && only. So we play safe and use the following idiom, instead - # of the apparently simpler 'grep ... && Exit 1'. - if grep "^$ext\.o:" Makefile.in; then Exit 1; else :; fi +for ext in f for f90 f95 F F90 F95 r m mm upc; do grep "^\.$ext\.o:" Makefile.in + grep "^$ext\.o:" Makefile.in && Exit 1 + : For shells with busted 'set -e'. done -Exit 0 + +: @@ -46,6 +46,6 @@ done) || skip_ "failed to create deeper directory hierarchy" $MAKE dist 2>stderr && { cat stderr >&2; Exit 1; } cat stderr >&2 grep 'filenames are too long' stderr -test 2 = `grep 12345678 stderr | wc -l` +test 2 -eq $(grep -c 12345678 stderr) : diff --git a/t/fn99subdir.sh b/t/fn99subdir.sh index beb02618f..0df282c0a 100755 --- a/t/fn99subdir.sh +++ b/t/fn99subdir.sh @@ -76,6 +76,6 @@ done) || skip_ "failed to create deeper directory hierarchy" $MAKE dist 2>stderr && { cat stderr >&2; Exit 1; } cat stderr >&2 grep 'filenames are too long' stderr -test 1 = `grep 12345678 stderr | wc -l` +test 1 -eq $(grep -c 12345678 stderr) : diff --git a/t/fort4.sh b/t/fort4.sh index a23c9bda5..7315ec1b4 100755 --- a/t/fort4.sh +++ b/t/fort4.sh @@ -74,7 +74,7 @@ $AUTOCONF # or if the compiler cannot compile Fortran 90 files). ./configure $MAKE -subobjs=`echo sub/*.o sub/*.obj` +subobjs=$(echo sub/*.o sub/*.obj) test "$subobjs" = 'sub/*.o sub/*.obj' $MAKE distcheck @@ -90,3 +90,5 @@ test ! -f baz.obj test ! -f goodbye-baz.o test ! -f goodbye-baz.obj $MAKE distcheck + +: diff --git a/t/fort5.sh b/t/fort5.sh index 4614b661d..6fa1f22f6 100755 --- a/t/fort5.sh +++ b/t/fort5.sh @@ -89,7 +89,7 @@ grep " --tag=FC" Makefile.in # or if the compiler cannot compile Fortran 90 files). ./configure $MAKE -subobjs=`echo sub/*.lo` +subobjs=$(echo sub/*.lo) test "$subobjs" = 'sub/*.lo' $MAKE distcheck @@ -103,3 +103,5 @@ test ! -f bar.lo test ! -f baz.lo test ! -f libgoodbye_la-baz.lo $MAKE distcheck + +: @@ -31,7 +31,6 @@ END $ACLOCAL $AUTOMAKE -num=`grep depcomp Makefile.in | wc -l` -test $num -gt 1 +test $($FGREP -c depcomp Makefile.in) -gt 1 : @@ -32,7 +32,7 @@ END $ACLOCAL $AUTOCONF $AUTOMAKE -./configure >stdout +./configure >stdout || { cat stdout; Exit 1; } cat stdout # Configure must be checking the dependency style of gcj ... @@ -40,7 +40,7 @@ grep 'dependency style of gcj' stdout >filt cat filt # ... only once. -test `wc -l < filt` = 1 +test $(wc -l < filt) = 1 # Accept any outcome but 'none' # (at the time of writing it should be gcc or gcc3). diff --git a/t/gettext-macros.sh b/t/gettext-macros.sh index 416a8e50f..e424a8ec0 100755 --- a/t/gettext-macros.sh +++ b/t/gettext-macros.sh @@ -49,7 +49,7 @@ fi # in the AM_GNU_GETTEXT_VERSION call in configure.ac if we want autopoint # (or gettextize) to setup the correct infrastructure -- in particular, # for what concerns us, to bring in all the required .m4 files. -autopoint_version=`extract_program_version $am_gettextize_command` \ +autopoint_version=$(extract_program_version $am_gettextize_command) \ && test -n "$autopoint_version" \ || autopoint_version=0.10.35 @@ -62,7 +62,7 @@ AM_GNU_GETTEXT_VERSION([$autopoint_version]) END if $am_gettextize_command --force && test -f m4/gettext.m4; then - echo "ACLOCAL_PATH='`pwd`/m4':\$ACLOCAL_PATH" >> get.sh + echo "ACLOCAL_PATH='$(pwd)/m4':\$ACLOCAL_PATH" >> get.sh echo "export ACLOCAL_PATH" >> get.sh else # Older versions of gettext might not have a gettextize program @@ -95,7 +95,7 @@ END # Remove any Makefile.in possibly created by gettextize/autopoint, to # avoid spurious maintainer-check failures. -rm -f `find . -name Makefile.in` +rm -f $(find . -name Makefile.in) # The file gettextize or autopoint might have copied in the 'm4' # subdirectory of the test directory are going to be needed by diff --git a/t/gnits2.sh b/t/gnits2.sh index ef7078cc2..6bc914609 100755 --- a/t/gnits2.sh +++ b/t/gnits2.sh @@ -104,7 +104,7 @@ mkdir build cd build # Use --program-prefix to make sure the std-options check honors it. -../configure "--prefix=`pwd`/../inst-dir" --program-prefix=p +../configure "--prefix=$(pwd)/../inst-dir" --program-prefix=p $MAKE all $MAKE test-install $MAKE -k installcheck 2>stderr || : # Never trust the exit status of make -k. diff --git a/t/gnits3.sh b/t/gnits3.sh index f4797629d..d8baf7c97 100755 --- a/t/gnits3.sh +++ b/t/gnits3.sh @@ -83,7 +83,7 @@ mkdir build cd build # Use --program-prefix to make sure the std-options check honors it. -../configure "--prefix=`pwd`/../inst-dir" --program-prefix=p +../configure "--prefix=$(pwd)/../inst-dir" --program-prefix=p $MAKE $MAKE install $MAKE installcheck && Exit 1 diff --git a/t/hdr-vars-defined-once.sh b/t/hdr-vars-defined-once.sh index 1e31cd201..de868a841 100755 --- a/t/hdr-vars-defined-once.sh +++ b/t/hdr-vars-defined-once.sh @@ -31,8 +31,7 @@ END $ACLOCAL $AUTOMAKE -len=`grep '^srcdir' Makefile.in | wc -l` -test $len -eq 1 +test $(grep -c '^srcdir' Makefile.in) -eq 1 # Also make sure include file is distributed. sed -n -e '/^DIST_COMMON =.*\\$/ { diff --git a/t/help-silent.sh b/t/help-silent.sh index d5fc34225..2be4fefc0 100755 --- a/t/help-silent.sh +++ b/t/help-silent.sh @@ -28,16 +28,14 @@ $ACLOCAL mv -f configure.ac configure.tmpl -q="[\`'\"]" - for args in '' '([])' '([yes])' '([no])'; do sed "s/AM_SILENT_RULES.*/&$args/" configure.tmpl >configure.ac cat configure.ac $AUTOCONF --force grep_configure_help --enable-silent-rules \ - " less verbose build.*\\(undo.*${q}make V=1${q}" + ' less verbose build.*\(undo.*"make V=1".*\)' grep_configure_help --disable-silent-rules \ - " verbose build.*\\(undo.*${q}make V=0${q}" + ' verbose build.*\(undo.*"make V=0".*\)' done : diff --git a/t/help4.sh b/t/help4.sh index 9747968b1..d51e0c41a 100755 --- a/t/help4.sh +++ b/t/help4.sh @@ -29,7 +29,7 @@ ACLOCAL=$am_original_ACLOCAL AUTOMAKE=$am_original_AUTOMAKE escape_dots () { sed 's/\./\\./g'; } # Avoid issues with "\" in backquotes. -apiversion_rx=`echo "$APIVERSION" | escape_dots` +apiversion_rx=$(echo "$APIVERSION" | escape_dots) $ACLOCAL --version --help >stdout || { cat stdout; Exit 1; } cat stdout @@ -30,7 +30,7 @@ echo '@setfilename foo.info' > foo.texi $ACLOCAL $AUTOMAKE -for i in `grep '^INFOS =' Makefile.in | sed -e 's/^INFOS = //'`; do +for i in $(grep '^INFOS =' Makefile.in | sed -e 's/^INFOS = //'); do echo $i case "$i" in foo*) diff --git a/t/install-info-dir.sh b/t/install-info-dir.sh index 12b22930e..0b0521ba3 100755 --- a/t/install-info-dir.sh +++ b/t/install-info-dir.sh @@ -24,7 +24,7 @@ required=makeinfo . ./defs || Exit 1 -cwd=`pwd` || fatal_ "cannot get current working directory" +cwd=$(pwd) || fatal_ "cannot get current working directory" mkdir bin saved_PATH=$PATH; export saved_PATH diff --git a/t/installdir.sh b/t/installdir.sh index dc83ee36d..9b2bc5747 100755 --- a/t/installdir.sh +++ b/t/installdir.sh @@ -36,9 +36,9 @@ END $ACLOCAL $AUTOMAKE -test `grep installdirs-local Makefile.in | wc -l` -eq 4 +test $(grep -c installdirs-local Makefile.in) -eq 4 -cwd=`pwd` || fatal_ "getting current working directory" +cwd=$(pwd) || fatal_ "getting current working directory" $AUTOCONF ./configure --prefix="$cwd/inst" diff --git a/t/instdir-cond.sh b/t/instdir-cond.sh index 2965ff19d..abab752bf 100755 --- a/t/instdir-cond.sh +++ b/t/instdir-cond.sh @@ -39,7 +39,7 @@ $ACLOCAL $AUTOMAKE $AUTOCONF -./configure --prefix="`pwd`/inst" +./configure --prefix="$(pwd)/inst" $MAKE install test ! -d inst/share/instdir-cond diff --git a/t/instdir-cond2.sh b/t/instdir-cond2.sh index 1fc24b70d..6be0883c9 100755 --- a/t/instdir-cond2.sh +++ b/t/instdir-cond2.sh @@ -43,7 +43,7 @@ $ACLOCAL $AUTOMAKE $AUTOCONF -./configure --prefix="`pwd`/inst" +./configure --prefix="$(pwd)/inst" $MAKE installdirs test ! -d inst || { find inst; Exit 1; } diff --git a/t/instdir-java.sh b/t/instdir-java.sh index 4d47d19a8..83361d470 100755 --- a/t/instdir-java.sh +++ b/t/instdir-java.sh @@ -37,8 +37,9 @@ $ACLOCAL $AUTOCONF $AUTOMAKE --add-missing -instdir=`pwd`/inst -destdir=`pwd`/dest +cwd=$(pwd) || fatal_ "getting current working directory" +instdir=$cwd/inst +destdir=$cwd/dest mkdir build cd build ../configure --prefix="$instdir" diff --git a/t/instdir-lisp.sh b/t/instdir-lisp.sh index f019504d2..eebf5da18 100755 --- a/t/instdir-lisp.sh +++ b/t/instdir-lisp.sh @@ -34,8 +34,9 @@ $ACLOCAL $AUTOCONF $AUTOMAKE --add-missing -instdir=`pwd`/inst -destdir=`pwd`/dest +cwd=$(pwd) || fatal_ "getting current working directory" +instdir=$cwd/inst +destdir=$cwd/dest mkdir build cd build ../configure --prefix="$instdir" diff --git a/t/instdir-ltlib.sh b/t/instdir-ltlib.sh index ded16cd5b..3d04d2c28 100755 --- a/t/instdir-ltlib.sh +++ b/t/instdir-ltlib.sh @@ -59,8 +59,9 @@ $ACLOCAL $AUTOCONF $AUTOMAKE --add-missing -instdir=`pwd`/inst -destdir=`pwd`/dest +cwd=$(pwd) || fatal_ "getting current working directory" +instdir=$cwd/inst +destdir=$cwd/dest mkdir build cd build ../configure --prefix="$instdir" PYTHON="echo" \ diff --git a/t/instdir-no-empty.sh b/t/instdir-no-empty.sh index d93add861..f86365fe1 100755 --- a/t/instdir-no-empty.sh +++ b/t/instdir-no-empty.sh @@ -95,7 +95,7 @@ $ACLOCAL $AUTOCONF $AUTOMAKE -a -cwd=`pwd` || fatal_ "getting current working directory" +cwd=$(pwd) || fatal_ "getting current working directory" doinst () { diff --git a/t/instdir-prog.sh b/t/instdir-prog.sh index e0948c088..d459f0ef5 100755 --- a/t/instdir-prog.sh +++ b/t/instdir-prog.sh @@ -58,8 +58,9 @@ $ACLOCAL $AUTOCONF $AUTOMAKE --add-missing -instdir=`pwd`/inst -destdir=`pwd`/dest +cwd=$(pwd) || fatal_ "getting current working directory" +instdir=$cwd/inst +destdir=$cwd/dest mkdir build cd build ../configure --prefix="$instdir" PYTHON="echo" \ diff --git a/t/instdir-python.sh b/t/instdir-python.sh index f48353deb..c15370e42 100755 --- a/t/instdir-python.sh +++ b/t/instdir-python.sh @@ -38,8 +38,9 @@ $ACLOCAL $AUTOCONF $AUTOMAKE --add-missing -instdir=`pwd`/inst -destdir=`pwd`/dest +cwd=$(pwd) || fatal_ "getting current working directory" +instdir=$cwd/inst +destdir=$cwd/dest mkdir build cd build ../configure --prefix="$instdir" diff --git a/t/instdir-texi.sh b/t/instdir-texi.sh index 4e4887a7a..c0b660741 100755 --- a/t/instdir-texi.sh +++ b/t/instdir-texi.sh @@ -47,8 +47,9 @@ $ACLOCAL $AUTOCONF $AUTOMAKE --add-missing -instdir=`pwd`/inst -destdir=`pwd`/dest +cwd=$(pwd) || fatal_ "getting current working directory" +instdir=$cwd/inst +destdir=$cwd/dest mkdir build cd build ../configure --prefix="$instdir" diff --git a/t/instdir.sh b/t/instdir.sh index f09fdfa7c..06821ed23 100755 --- a/t/instdir.sh +++ b/t/instdir.sh @@ -47,8 +47,9 @@ $ACLOCAL $AUTOCONF $AUTOMAKE --add-missing -instdir=`pwd`/inst -destdir=`pwd`/dest +cwd=$(pwd) || fatal_ "getting current working directory" +instdir=$cwd/inst +destdir=$cwd/dest mkdir build cd build ../configure --prefix="$instdir" diff --git a/t/instdir2.sh b/t/instdir2.sh index bdfa80999..d12d39061 100755 --- a/t/instdir2.sh +++ b/t/instdir2.sh @@ -69,8 +69,9 @@ $ACLOCAL $AUTOCONF $AUTOMAKE --add-missing -instdir=`pwd`/inst -destdir=`pwd`/dest +cwd=$(pwd) || fatal_ "getting current working directory" +instdir=$cwd/inst +destdir=$cwd/dest mkdir build cd build ../configure --prefix="$instdir" diff --git a/t/instfail-info.sh b/t/instfail-info.sh index 58aef975c..257f9a013 100755 --- a/t/instfail-info.sh +++ b/t/instfail-info.sh @@ -45,7 +45,7 @@ $ACLOCAL $AUTOCONF $AUTOMAKE --add-missing -instdir=`pwd`/inst +instdir=$(pwd)/inst || fatal_ "getting current working directory" ./configure --prefix="$instdir" $MAKE diff --git a/t/instfail-java.sh b/t/instfail-java.sh index 0ae80f58e..b602517ea 100755 --- a/t/instfail-java.sh +++ b/t/instfail-java.sh @@ -39,7 +39,7 @@ $ACLOCAL $AUTOCONF $AUTOMAKE --add-missing -instdir=`pwd`/inst +instdir=$(pwd)/inst || fatal_ "getting current working directory" ./configure --prefix="$instdir" $MAKE diff --git a/t/instfail-libtool.sh b/t/instfail-libtool.sh index 0acfd2c5a..b5a0d160e 100755 --- a/t/instfail-libtool.sh +++ b/t/instfail-libtool.sh @@ -55,7 +55,7 @@ $ACLOCAL $AUTOCONF $AUTOMAKE --add-missing -instdir=`pwd`/inst +instdir=$(pwd)/inst || fatal_ "getting current working directory" ./configure --prefix="$instdir" $MAKE diff --git a/t/instfail.sh b/t/instfail.sh index 1e5a340f7..eb4c269ec 100755 --- a/t/instfail.sh +++ b/t/instfail.sh @@ -60,7 +60,7 @@ $ACLOCAL $AUTOCONF $AUTOMAKE --add-missing -instdir=`pwd`/inst +instdir=$(pwd)/inst || fatal_ "getting current working directory" ./configure --prefix="$instdir" $MAKE @@ -83,9 +83,8 @@ $MAKE unreadable-progn $MAKE install-exec && Exit 1 $MAKE readable-progn -if grep "^EMACS = no" Makefile; then :; else - for file in lisp1.el lisp1.elc - do +if ! grep "^EMACS = no" Makefile; then + for file in lisp1.el lisp1.elc; do chmod a-r $file $MAKE install-data && Exit 1 chmod u+r $file diff --git a/t/insthook.sh b/t/insthook.sh index 23bc4e03e..7fe0278c3 100755 --- a/t/insthook.sh +++ b/t/insthook.sh @@ -56,7 +56,7 @@ test -f ok # second version will overwrite 'foo'. Hopefully 'install' and 'install-sh' # are smart enough to erase the 'foo' symlink before installing the new # version.) -./configure "--bindir=`pwd`/bin" +./configure "--bindir=$(pwd)/bin" $MAKE install echo 2 > foo VERSION=2.0 $MAKE -e install diff --git a/t/instman.sh b/t/instman.sh index 787104592..114dc71e9 100755 --- a/t/instman.sh +++ b/t/instman.sh @@ -30,5 +30,7 @@ EOF $ACLOCAL $AUTOMAKE -grep '[^(/]MKDIR_P' Makefile.in > out -test `wc -l < out` -eq 1 +grep 'MKDIR_P' Makefile.in # For debugging. +test $(grep -c '[^(/]MKDIR_P' Makefile.in) -eq 1 + +: diff --git a/t/instmany-mans.sh b/t/instmany-mans.sh index ceb3a9e0f..682fc1da7 100755 --- a/t/instmany-mans.sh +++ b/t/instmany-mans.sh @@ -28,7 +28,7 @@ limit=2500 subdir=long_subdir_name_with_many_characters nfiles=81 -list=`seq_ 1 $nfiles` +list=$(seq_ 1 $nfiles) sed "s|@limit@|$limit|g" >myinstall.in <<'END' #! /bin/sh @@ -100,7 +100,7 @@ $ACLOCAL $AUTOCONF $AUTOMAKE --add-missing -instdir=`pwd`/inst +instdir=$(pwd)/inst mkdir build cd build ../configure --prefix="$instdir" @@ -110,11 +110,11 @@ $MAKE install # Multiple uninstall should work, too. $MAKE uninstall $MAKE uninstall -test `find "$instdir" -type f -print | wc -l` = 0 +test $(find "$instdir" -type f -print | wc -l) -eq 0 # Try whether we don't exceed the low limit. INSTALL='$(SHELL) $(top_builddir)/myinstall' $MAKE -e install -env save_PATH="$PATH" PATH="`pwd`/..$PATH_SEPARATOR$PATH" $MAKE uninstall +env save_PATH="$PATH" PATH="$(pwd)/..$PATH_SEPARATOR$PATH" $MAKE uninstall cd $subdir srcdir=../../$subdir diff --git a/t/instmany-python.sh b/t/instmany-python.sh index d0c5b1a95..d6dd11895 100755 --- a/t/instmany-python.sh +++ b/t/instmany-python.sh @@ -24,7 +24,7 @@ required='python' limit=2500 subdir=long_subdir_name_with_many_characters nfiles=81 -list=`seq_ 1 $nfiles` +list=$(seq_ 1 $nfiles) sed "s|@limit@|$limit|g" >myinstall.in <<'END' #! /bin/sh @@ -91,7 +91,7 @@ $ACLOCAL $AUTOCONF $AUTOMAKE --add-missing -instdir=`pwd`/inst +instdir=$(pwd)/inst mkdir build cd build ../configure --prefix="$instdir" @@ -101,11 +101,11 @@ $MAKE install # Multiple uninstall should work, too. $MAKE uninstall $MAKE uninstall -test `find "$instdir" -type f -print | wc -l` = 0 +test $(find "$instdir" -type f -print | wc -l) -eq 0 # Try whether we don't exceed the low limit. INSTALL='$(SHELL) $(top_builddir)/myinstall' $MAKE -e install -env save_PATH="$PATH" PATH="`pwd`/..$PATH_SEPARATOR$PATH" $MAKE uninstall +env save_PATH="$PATH" PATH="$(pwd)/..$PATH_SEPARATOR$PATH" $MAKE uninstall cd $subdir srcdir=../../$subdir diff --git a/t/instmany.sh b/t/instmany.sh index d334ebef1..7721f7df7 100755 --- a/t/instmany.sh +++ b/t/instmany.sh @@ -36,7 +36,7 @@ limit=2500 subdir=long_subdir_name_with_many_characters nfiles=81 -list=`seq_ 1 $nfiles` +list=$(seq_ 1 $nfiles) sed "s|@limit@|$limit|g" >myinstall.in <<'END' #! /bin/sh @@ -114,7 +114,7 @@ $ACLOCAL $AUTOCONF $AUTOMAKE --add-missing -instdir=`pwd`/inst +instdir=$(pwd)/inst mkdir build cd build ../configure --prefix="$instdir" @@ -124,11 +124,11 @@ $MAKE install # Multiple uninstall should work, too. $MAKE uninstall $MAKE uninstall -test `find "$instdir" -type f -print | wc -l` = 0 +test $(find "$instdir" -type f -print | wc -l) -eq 0 # Try whether we don't exceed the low limit. INSTALL='$(SHELL) $(top_builddir)/myinstall' $MAKE -e install -env save_PATH="$PATH" PATH="`pwd`/..$PATH_SEPARATOR$PATH" $MAKE uninstall +env save_PATH="$PATH" PATH="$(pwd)/..$PATH_SEPARATOR$PATH" $MAKE uninstall cd $subdir srcdir=../../$subdir diff --git a/t/instspc.tap b/t/instspc.tap index cbe0fdfdd..a6f776376 100755 --- a/t/instspc.tap +++ b/t/instspc.tap @@ -219,8 +219,8 @@ if test $# -gt 0; then esac done # We need to determine the TAP plan adaptively. - n=`for t in $test_names_list; do echo $t; done | wc -l` - plan_ `expr $n '*' 2` # Two tests per "problematic string". + n=$(for t in $test_names_list; do echo $t; done | wc -l) + plan_ $(($n * 2)) # Two tests per "problematic string". unset n else test_names_list=$all_test_names_list @@ -228,7 +228,7 @@ else plan_ 94 fi -ocwd=`pwd` || fatal_ "cannot get current working directory" +ocwd=$(pwd) || fatal_ "getting current working directory" create_input_data @@ -324,10 +324,10 @@ for test_name in $test_names_list; do # the test directory not to be removed when the script terminates. if not am_keeping_testdirs && test "$r" = ok; then rm_rf_ "$build" "$dest" || fatal_ "removing temporary subdirectory" - else - : For lesser shells with broken 'set -e'. fi + : For shells with busted 'set -e'. + done # $instspc_action done # $test_name diff --git a/t/java-check.sh b/t/java-check.sh index 230fb96f1..15c0e457b 100755 --- a/t/java-check.sh +++ b/t/java-check.sh @@ -41,7 +41,7 @@ $ACLOCAL $AUTOCONF $AUTOMAKE -inst=`pwd`/_inst +inst=$(pwd)/_inst ./configure --prefix="$inst" diff --git a/t/java-compile-install.sh b/t/java-compile-install.sh index f3340ffa3..448a83907 100755 --- a/t/java-compile-install.sh +++ b/t/java-compile-install.sh @@ -87,7 +87,7 @@ $ACLOCAL $AUTOCONF $AUTOMAKE -./configure --prefix="`pwd`"/_inst +./configure --prefix="$(pwd)"/_inst $MAKE $MAKE test $MAKE install diff --git a/t/java-compile-run-flat.sh b/t/java-compile-run-flat.sh index 9f3c18441..94a6fa90b 100755 --- a/t/java-compile-run-flat.sh +++ b/t/java-compile-run-flat.sh @@ -230,7 +230,7 @@ $AUTOMAKE # To have the parallel testsuite more verbose. VERBOSE=yes; export VERBOSE -./configure --prefix="`pwd`/_inst" +./configure --prefix="$(pwd)/_inst" cat PkgLocation.java # For debugging. $MAKE check $MAKE install diff --git a/t/java-compile-run-nested.sh b/t/java-compile-run-nested.sh index 61727f7c9..c1c79422c 100755 --- a/t/java-compile-run-nested.sh +++ b/t/java-compile-run-nested.sh @@ -239,7 +239,7 @@ $AUTOMAKE -a # To have the parallel testsuite more verbose. VERBOSE=yes; export VERBOSE -./configure --prefix="`pwd`/_inst" +./configure --prefix="$(pwd)/_inst" cat jprog/PkgLocation.java # For debugging. $MAKE check $MAKE install diff --git a/t/java-no-duplicate.sh b/t/java-no-duplicate.sh index 416fdb9c7..d7ea5f29f 100755 --- a/t/java-no-duplicate.sh +++ b/t/java-no-duplicate.sh @@ -36,10 +36,10 @@ $EGREP -i '\.stamp|\.class|java|classpath' Makefile.in # For debugging. for var in JAVAC JAVAROOT CLASSPATH_ENV am__java_sources; do grep "^$var =" Makefile.in - test `grep -c "^[$sp$tab]*$var[$sp$tab]*=" Makefile.in` = 1 + test $(grep -c "^[$sp$tab]*$var[$sp$tab]*=" Makefile.in) -eq 1 done grep '^classjava\.stamp:' Makefile.in -test `grep -c "class.*java.*\.stamp.*:" Makefile.in` = 1 +test $(grep -c "class.*java.*\.stamp.*:" Makefile.in) -eq 1 : diff --git a/t/java-nobase.sh b/t/java-nobase.sh index ff72a1338..7a1ca440d 100755 --- a/t/java-nobase.sh +++ b/t/java-nobase.sh @@ -56,7 +56,7 @@ $ACLOCAL $AUTOCONF $AUTOMAKE -./configure --prefix="`pwd`"/_inst +./configure --prefix="$(pwd)"/_inst $MAKE check $MAKE install $MAKE test-install diff --git a/t/java-noinst.sh b/t/java-noinst.sh index b11e6a000..cf0c60058 100755 --- a/t/java-noinst.sh +++ b/t/java-noinst.sh @@ -41,7 +41,7 @@ $ACLOCAL $AUTOMAKE $AUTOCONF -./configure --prefix="`pwd`/_inst" +./configure --prefix="$(pwd)/_inst" $MAKE ls -l diff --git a/t/java-uninstall.sh b/t/java-uninstall.sh index fb6bfa1be..e637f6a6a 100755 --- a/t/java-uninstall.sh +++ b/t/java-uninstall.sh @@ -56,7 +56,7 @@ $ACLOCAL $AUTOCONF $AUTOMAKE -./configure --prefix="`pwd`"/_inst +./configure --prefix="$(pwd)"/_inst javadir=_inst/java check_uninstallation() @@ -34,19 +34,12 @@ $AUTOMAKE $EGREP '\.stamp|class' Makefile.in # For debugging. grep '^all[-a-z]*:.*classjava\.stamp' Makefile.in -test `grep -c '^all[-a-z]*:.*classjava\.stamp' Makefile.in` -eq 1 +test $(grep -c '^all[-a-z]*:.*classjava\.stamp' Makefile.in) -eq 1 -cat >a.java <<EOF -class a -{ -} -EOF - -cat >b.java <<EOF -class b -{ -} -EOF +echo 'class a { }' > a.java +echo 'class b { }' > b.java -./configure --prefix "`pwd`" +./configure $MAKE distcheck + +: diff --git a/t/java3.sh b/t/java3.sh index 7d9463599..356d0c200 100755 --- a/t/java3.sh +++ b/t/java3.sh @@ -42,8 +42,7 @@ $ACLOCAL $AUTOCONF $AUTOMAKE -cwd=`pwd` || Exit 1 -./configure --prefix="$cwd/_inst" +./configure --prefix="$(pwd)/_inst" $MAKE $MAKE install ls -l . diff --git a/t/lex-lib-external.sh b/t/lex-lib-external.sh index 21802c5d2..df8aa00b2 100755 --- a/t/lex-lib-external.sh +++ b/t/lex-lib-external.sh @@ -69,7 +69,7 @@ $MAKE have-lexlib || skip_ "no system-wide lex library found" # Program should build and run and distribute. $MAKE all -if cross_compiling; then :; else +if ! cross_compiling; then echo GOOD | ./lexer echo BAD | ./lexer && Exit 1 : For shells with busted 'set -e'. diff --git a/t/lex-noyywrap.sh b/t/lex-noyywrap.sh index 1c4a13b19..733527915 100755 --- a/t/lex-noyywrap.sh +++ b/t/lex-noyywrap.sh @@ -63,7 +63,7 @@ $AUTOMAKE -a # Program should build and run. $MAKE -if cross_compiling; then :; else +if ! cross_compiling; then echo GOOD | ./foo echo BAD | ./foo && Exit 1 : For shells with busted 'set -e'. diff --git a/t/lex-pr204.sh b/t/lex-pr204.sh index 3ebb57260..c12113fea 100755 --- a/t/lex-pr204.sh +++ b/t/lex-pr204.sh @@ -83,7 +83,7 @@ touch lexer.l lexer2.l $sleep $MAKE lexer.c lexer2.c stat lexer.c lexer.l lexer2.c lexer2.l || : # For debugging. -test `ls -t lexer.c lexer.l | sed 1q` = lexer.c -test `ls -t lexer2.c lexer2.l | sed 1q` = lexer2.c +test $(ls -t lexer.c lexer.l | sed 1q) = lexer.c +test $(ls -t lexer2.c lexer2.l | sed 1q) = lexer2.c : @@ -66,7 +66,7 @@ $AUTOMAKE -a # Program should build and run. $MAKE -if cross_compiling; then :; else +if ! cross_compiling; then echo GOOD | ./foo echo BAD | ./foo && Exit 1 : For shells with busted 'set -e'. diff --git a/t/library3.sh b/t/library3.sh index 27a2b156f..daf96b922 100755 --- a/t/library3.sh +++ b/t/library3.sh @@ -49,4 +49,6 @@ $ACLOCAL AUTOMAKE_fails grep '^Makefile.am:.*: !A and !C and !D$' stderr # Is there only one missing condition? -test `grep ': !' stderr | wc -l` = 1 || Exit 1 +test $(grep -c ': !' stderr) -eq 1 + +: diff --git a/t/libtool-macros.sh b/t/libtool-macros.sh index e5c77ac1d..f2f881128 100755 --- a/t/libtool-macros.sh +++ b/t/libtool-macros.sh @@ -27,7 +27,7 @@ echo : >> get.sh echo ACLOCAL_AMFLAGS = -I m4 > Makefile.am if libtoolize --copy --install && test -f m4/libtool.m4; then - echo "ACLOCAL_PATH='`pwd`/m4':\$ACLOCAL_PATH" >> get.sh + echo "ACLOCAL_PATH='$(pwd)/m4':\$ACLOCAL_PATH" >> get.sh echo "export ACLOCAL_PATH" >> get.sh else # Libtoolize from libtool < 2.0 didn't support the '--install' option, diff --git a/t/libtool6.sh b/t/libtool6.sh index 13dbc738e..7655569d9 100755 --- a/t/libtool6.sh +++ b/t/libtool6.sh @@ -42,4 +42,6 @@ libtoolize $ACLOCAL $AUTOMAKE --add-missing # am_liba_la_rpath is defined twice, and used once -test 3 = `grep 'am_liba_la_rpath' Makefile.in | wc -l` +test 3 -eq $(grep -c 'am_liba_la_rpath' Makefile.in) + +: diff --git a/t/libtool7.sh b/t/libtool7.sh index bc8eacae3..6dc6aeb9f 100755 --- a/t/libtool7.sh +++ b/t/libtool7.sh @@ -78,7 +78,7 @@ $ACLOCAL $AUTOCONF $AUTOMAKE --add-missing --copy -./configure "--prefix=`pwd`/_inst" +./configure "--prefix=$(pwd)/_inst" env LIBTOOLFLAGS=--silent $MAKE print >output 2>&1 || { cat output Exit 1 @@ -87,7 +87,7 @@ cat output grep '1BEG: libmod1.la mod2.la :END1' output grep '2BEG: mod2.la :END2' output grep '3BEG: .*silent.*silent.* :END3' output -test 2 -le `grep mod2_la_LIBTOOLFLAGS Makefile | wc -l` +test 2 -le $(grep mod2_la_LIBTOOLFLAGS Makefile | wc -l) $MAKE env LIBTOOLFLAGS=--silent $MAKE install >output 2>&1 || { diff --git a/t/lisp3.sh b/t/lisp3.sh index a1531d355..0d8be77bb 100755 --- a/t/lisp3.sh +++ b/t/lisp3.sh @@ -40,7 +40,7 @@ $ACLOCAL $AUTOCONF $AUTOMAKE --add-missing -./configure --prefix="`pwd`/_inst" +./configure --prefix="$(pwd)/_inst" $MAKE diff --git a/t/lisp4.sh b/t/lisp4.sh index 8d2de591a..82109f5b4 100755 --- a/t/lisp4.sh +++ b/t/lisp4.sh @@ -60,7 +60,9 @@ $ACLOCAL $AUTOCONF $AUTOMAKE --add-missing -./configure --prefix "`pwd`" +cwd=$(pwd) || fatal_ "getting current working directory" + +./configure --prefix "$cwd" $MAKE $MAKE test $MAKE install-test @@ -70,7 +72,7 @@ $MAKE not-installed # Fake the absence of emacs. # *.el files should not be installed, but "make install" and # "make uninstall" should continue to work. -./configure EMACS=no --prefix "`pwd`" +./configure EMACS=no --prefix "$cwd" $MAKE $MAKE test $MAKE install diff --git a/t/lisp5.sh b/t/lisp5.sh index 997a56e73..34edf3b57 100755 --- a/t/lisp5.sh +++ b/t/lisp5.sh @@ -59,7 +59,9 @@ $ACLOCAL $AUTOCONF $AUTOMAKE --add-missing -./configure --prefix "`pwd`" +cwd=$(pwd) || fatal_ "getting current working directory" + +./configure --prefix "$cwd" $MAKE $MAKE test $MAKE install-test @@ -69,7 +71,7 @@ $MAKE not-installed # Fake the absence of emacs. # *.el files SHOULD be installed by "make install" (and uninstalled # by "make uninstall"). -./configure EMACS=no --prefix "`pwd`" +./configure EMACS=no --prefix "$cwd" $MAKE $MAKE test $MAKE install-test diff --git a/t/lisp6.sh b/t/lisp6.sh index 9635ea275..1e3bc4186 100755 --- a/t/lisp6.sh +++ b/t/lisp6.sh @@ -38,6 +38,9 @@ AM_PATH_LISPDIR AC_OUTPUT EOF +# Avoid possible spurious influences from the environment. +want_two=; unset want_two + echo "(provide 'am-one)" > am-one.el echo "(require 'am-one)" > am-two.el echo "(require 'am-one)" > am-three.el @@ -46,7 +49,9 @@ $ACLOCAL $AUTOCONF $AUTOMAKE --add-missing -./configure "--with-lispdir=`pwd`/lisp" +cwd=$(pwd) || fatal_ "getting current working directory" + +./configure --with-lispdir="$cwd/lisp" $MAKE test -f am-one.elc @@ -70,7 +75,7 @@ test ! -f am-two.elc test ! -f am-three.elc test ! -f elc-stamp -./configure "--with-lispdir=`pwd`/lisp" want_two=1 +./configure --with-lispdir="$cwd/lisp" want_two=1 $MAKE test -f am-one.elc diff --git a/t/lisp7.sh b/t/lisp7.sh index 79799d160..6022334fc 100755 --- a/t/lisp7.sh +++ b/t/lisp7.sh @@ -39,7 +39,7 @@ $AUTOMAKE --add-missing $MAKE >stdout || { cat stdout; Exit 1; } cat stdout -test 1 -eq `grep 'Warnings can be ignored' stdout | wc -l` +test 1 -eq $(grep -c 'Warnings can be ignored' stdout) test ! -f am-one.elc test ! -f am-two.elc diff --git a/t/lisp8.sh b/t/lisp8.sh index 738cbd6ec..8c1982bd9 100755 --- a/t/lisp8.sh +++ b/t/lisp8.sh @@ -42,7 +42,7 @@ $AUTOMAKE --add-missing $MAKE -j >>stdout || { cat stdout; Exit 1; } cat stdout -test 1 -eq `grep 'Warnings can be ignored' stdout | wc -l` +test 1 -eq $(grep -c 'Warnings can be ignored' stdout) test -f am-one.elc test -f am-two.elc @@ -56,7 +56,7 @@ rm -f am-*.elc $MAKE -j >>stdout || { cat stdout; Exit 1; } cat stdout -test 1 -eq `grep 'Warnings can be ignored' stdout | wc -l` +test 1 -eq $(grep -c 'Warnings can be ignored' stdout) test -f am-one.elc test -f am-two.elc test -f am-three.elc diff --git a/t/longlin2.sh b/t/longlin2.sh index 1ba8072f3..ab3d5d4ce 100755 --- a/t/longlin2.sh +++ b/t/longlin2.sh @@ -19,16 +19,14 @@ . ./defs || Exit 1 -n=1 -files= -match= +n=1 files= match= while test $n -le 100 do files="$files filename$n" match="..........$match" - n=`expr $n + 1` + n=$(($n + 1)) done -files2=`echo "$files" | sed s/filename/filenameb/g` +files2=$(echo "$files" | sed s/filename/filenameb/g) cat >Makefile.am <<EOF FOO = $files $files2 \ @@ -46,3 +44,5 @@ $AUTOMAKE grep $match Makefile.in && Exit 1 grep 'filenameb100 grepme' Makefile.in + +: diff --git a/t/longline.sh b/t/longline.sh index dd5664d31..0c7e09e82 100755 --- a/t/longline.sh +++ b/t/longline.sh @@ -27,4 +27,6 @@ done) > Makefile.am $ACLOCAL $AUTOMAKE -test 80 -ge `grep DUMMY Makefile.in | wc -c` +test 80 -ge $(grep DUMMY Makefile.in | wc -c) + +: diff --git a/t/ltcond.sh b/t/ltcond.sh index d5098ea9b..7562d92bd 100755 --- a/t/ltcond.sh +++ b/t/ltcond.sh @@ -61,10 +61,12 @@ $ACLOCAL $AUTOCONF $AUTOMAKE --add-missing +cwd=$(pwd) || fatal_ "getting current working directory" + # Install libraries in lib/, and the rest in empty/. # (in fact there is no "rest", so as the name imply empty/ is # expected to remain empty). -./configure "--prefix=`pwd`/empty" "--libdir=`pwd`/lib" +./configure --prefix="$cwd/empty" --libdir="$cwd/lib" $MAKE test -f lib1foo.la @@ -85,12 +87,11 @@ test -f lib/lib1bar.la test -f lib/lib2foo.la test ! -f lib/lib3foo.la find empty -type f -print > empty.lst -cat empty.lst -test 0 = `wc -l < empty.lst` +test -s empty.lst && { cat empty.lst; Exit 1; } $MAKE uninstall find lib -type f -print > lib.lst -test 0 = `wc -l < lib.lst` +test -s lib.lst && { cat lib.lst; Exit 1; } test -f lib1foo.la test -f lib1bar.la test -f lib2foo.la diff --git a/t/ltconv.sh b/t/ltconv.sh index 19ed8b34b..7a6258575 100755 --- a/t/ltconv.sh +++ b/t/ltconv.sh @@ -110,10 +110,12 @@ $ACLOCAL $AUTOCONF $AUTOMAKE --add-missing +cwd=$(pwd) || fatal_ "getting current working directory" + # Install libraries in lib/, programs in bin/, and the rest in empty/. # (in fact there is no "rest", so as the name imply empty/ is # expected to remain empty). -./configure "--prefix=`pwd`/empty" "--libdir=`pwd`/lib" "--bindir=`pwd`/bin" +./configure --prefix="$cwd/empty" --libdir="$cwd/lib" --bindir="$cwd/bin" $MAKE test -f libtop.la @@ -132,8 +134,7 @@ test -f installcheck-ok rm -f installcheck-ok find empty -type f -print > empty.lst -cat empty.lst -test 0 = `wc -l < empty.lst` +test -s empty.lst && { cat empty.lst; Exit 1; } $MAKE clean test ! -f libtop.la @@ -148,9 +149,10 @@ test -f installcheck-ok rm -f installcheck-ok $MAKE uninstall -find lib -type f -print > lib.lst -test 0 = `wc -l < lib.lst` -find bin -type f -print > bin.lst -test 0 = `wc -l < bin.lst` +for d in lib bin; do + find $d -type f -print > $d.lst + test -s $d.lst && { cat $d.lst; Exit 1; } + : For shells with busted 'set -e'. +done : diff --git a/t/ltinit.sh b/t/ltinit.sh index 49ddbe0f8..e0f9b02ad 100755 --- a/t/ltinit.sh +++ b/t/ltinit.sh @@ -55,8 +55,7 @@ libtoolize $EGREP 'LT_(INIT|PREREQ)' configure && Exit 1 # Sanity check. $AUTOMAKE -a -cwd=`pwd` -./configure --prefix="$cwd/inst" >stdout || { cat stdout; Exit 1; } +./configure --prefix="$(pwd)/inst" >stdout || { cat stdout; Exit 1; } cat stdout grep '^checking.*dlfcn\.h.* no$' stdout || grep '^checking.*dlopen' stdout diff --git a/t/ltorder.sh b/t/ltorder.sh index 358e620fe..59047a0a6 100755 --- a/t/ltorder.sh +++ b/t/ltorder.sh @@ -49,7 +49,7 @@ $ACLOCAL $AUTOCONF $AUTOMAKE --add-missing -./configure "--prefix=`pwd`/inst" +./configure --prefix="$(pwd)/inst" $MAKE $MAKE install 2>stderr || { cat stderr >&2; Exit 1; } @@ -57,6 +57,6 @@ cat stderr >&2 grep 'has not been installed' stderr && Exit 1 $MAKE uninstall -test `find inst -type f -print | wc -l` -eq 0 +test $(find inst -type f -print | wc -l) -eq 0 : diff --git a/t/maintmode-configure-msg.sh b/t/maintmode-configure-msg.sh index 8a7c45104..5396cbf35 100755 --- a/t/maintmode-configure-msg.sh +++ b/t/maintmode-configure-msg.sh @@ -37,8 +37,7 @@ check_configure_message_with () ./configure ${1+"$@"} >stdout || { cat stdout; Exit 1; } cat stdout grep "^checking whether to enable maintainer-specific.*\\.\\.\\. $answer$" stdout - test `grep -c 'checking.*maint' stdout` -eq 1 - : + test $(grep -c 'checking.*maint' stdout) -eq 1 } set_maintmode "DEFAULT" diff --git a/t/make-dryrun.tap b/t/make-dryrun.tap index 2172124b5..8e25d88f8 100755 --- a/t/make-dryrun.tap +++ b/t/make-dryrun.tap @@ -53,7 +53,7 @@ $AUTOMAKE || fatal_ "automake failed" check_no_dryrun () { command_ok_ "dry-run ($cnt)" $MAKE notdry ${1+"$@"} - cnt=`expr $cnt + 1` + cnt=$(($cnt + 1)) } cnt=1 @@ -86,7 +86,7 @@ check_dryrun () fi result_ "$r" -D "$directive" -r "$reason" "not dry-run ($cnt)" unset r directive reason - cnt=`expr $cnt + 1` + cnt=$(($cnt + 1)) } cnt=1 @@ -108,7 +108,7 @@ check_metachars () fi result_ "$r" "dry-run, with shell metachars ($cnt)" unset r - cnt=`expr $cnt + 1` + cnt=$(($cnt + 1)) } cnt=1 diff --git a/t/makej2.sh b/t/makej2.sh index 8183887a4..2e5d55b94 100755 --- a/t/makej2.sh +++ b/t/makej2.sh @@ -35,10 +35,10 @@ $AUTOMAKE mkdir build cd build -../configure "--prefix=`pwd`/inst" +../configure --prefix="$(pwd)/inst" $MAKE -j2 || skip_ "$MAKE failed to run with two parallel jobs" $MAKE -j2 distcheck $MAKE test-distdir-removed -Exit 0 +: diff --git a/t/maken.sh b/t/maken.sh index bb6444461..86c40c3a5 100755 --- a/t/maken.sh +++ b/t/maken.sh @@ -56,7 +56,7 @@ for target in dist distcheck; do $MAKE -n $target | grep stamp-sub-dist-hook || Exit 1 fi $MAKE test-no-distdir - test `ls -1t | sed 1q` = stampfile + test $(ls -1t | sed 1q) = stampfile done -Exit 0 +: @@ -36,15 +36,17 @@ $ACLOCAL $AUTOCONF $AUTOMAKE +cwd=$(pwd) || fatal_ "getting current working directory" + # Let's play with $DESTDIR too, it shouldn't hurt. ./configure --prefix='' --mandir=/man -$MAKE DESTDIR="`pwd`/_inst" install +$MAKE DESTDIR="$cwd/_inst" install test -f ./_inst/man/man2/foo.2 test -f ./_inst/man/man4/foo.4 test -f ./_inst/man/man4/bar.4 -$MAKE DESTDIR="`pwd`/_inst" uninstall +$MAKE DESTDIR="$cwd/_inst" uninstall test ! -f ./_inst/man/man2/foo.2 test ! -f ./_inst/man/man4/foo.4 @@ -67,7 +67,7 @@ cat > bin/help2man <<'END' exit 127 END chmod +x bin/help2man -PATH=`pwd`/bin$PATH_SEPARATOR$PATH +PATH=$(pwd)/bin$PATH_SEPARATOR$PATH grep_error_messages() { @@ -40,28 +40,30 @@ $ACLOCAL $AUTOCONF $AUTOMAKE +cwd=$(pwd) || fatal_ "getting current working directory" + # Let's play with $DESTDIR too, it shouldn't hurt. ./configure --mandir=/man -$MAKE DESTDIR="`pwd`/_inst" install +$MAKE DESTDIR="$cwd/_inst" install -test -f ./_inst/man/man2/foo.2 -test -f ./_inst/man/man2/nfoo.2 -test -f ./_inst/man/man2/baz-1.4.2 -test -f ./_inst/man/man2/nbaz-1.4.2 -test -f ./_inst/man/man3/bar.3 -test -f ./_inst/man/man3/nbar.3 +test -f _inst/man/man2/foo.2 +test -f _inst/man/man2/nfoo.2 +test -f _inst/man/man2/baz-1.4.2 +test -f _inst/man/man2/nbaz-1.4.2 +test -f _inst/man/man3/bar.3 +test -f _inst/man/man3/nbar.3 -test ! -d ./_inst/man/man1 -test ! -d ./_inst/man/man4 -test ! -d ./_inst/man/man5 +test ! -d _inst/man/man1 +test ! -d _inst/man/man4 +test ! -d _inst/man/man5 -$MAKE DESTDIR="`pwd`/_inst" uninstall +$MAKE DESTDIR="$cwd/_inst" uninstall -test ! -f ./_inst/man/man2/foo.2 -test ! -f ./_inst/man/man2/nfoo.2 -test ! -f ./_inst/man/man2/baz-1.4.2 -test ! -f ./_inst/man/man2/nbaz-1.4.2 -test ! -f ./_inst/man/man3/bar.3 -test ! -f ./_inst/man/man3/nbar.3 +test ! -f _inst/man/man2/foo.2 +test ! -f _inst/man/man2/nfoo.2 +test ! -f _inst/man/man2/baz-1.4.2 +test ! -f _inst/man/man2/nbaz-1.4.2 +test ! -f _inst/man/man3/bar.3 +test ! -f _inst/man/man3/nbar.3 : diff --git a/t/mdate5.sh b/t/mdate5.sh index 4cef9526d..66afac1bc 100755 --- a/t/mdate5.sh +++ b/t/mdate5.sh @@ -21,7 +21,7 @@ am_create_testdir=empty get_shell_script mdate-sh -set x `./mdate-sh mdate-sh` +set x $(./mdate-sh mdate-sh) shift echo "$*" # For debugging. @@ -38,7 +38,7 @@ case $2 in esac # Stricter checks on the year required a POSIX date(1) command. -if year=`date +%Y` && test $year -gt 2010; then +if year=$(date +%Y) && test $year -gt 2010; then test $year = $3 || Exit 1 fi diff --git a/t/missing5.sh b/t/missing5.sh index 80bba3691..363cc1aab 100755 --- a/t/missing5.sh +++ b/t/missing5.sh @@ -24,7 +24,7 @@ get_shell_script missing # These programs may be invoked by 'missing'. needed_tools='chmod find sed test touch' -needed_tools_csep=`echo $needed_tools | sed 's/ /, /g'` +needed_tools_csep=$(echo $needed_tools | sed 's/ /, /g') cat >configure.ac <<EOF AC_INIT([missing4], [1.0]) diff --git a/t/mkinst2.sh b/t/mkinst2.sh index 658283600..2a4fb0b0c 100755 --- a/t/mkinst2.sh +++ b/t/mkinst2.sh @@ -30,7 +30,11 @@ END $ACLOCAL $AUTOCONF $AUTOMAKE -./configure --prefix "`pwd`/sub" +./configure --prefix "$(pwd)/sub" $MAKE installdirs test ! -d sub/man +$MAKE install +test ! -d sub/man + +: diff --git a/t/mkinst3.sh b/t/mkinst3.sh index fbe01c652..08cfb76e8 100755 --- a/t/mkinst3.sh +++ b/t/mkinst3.sh @@ -19,6 +19,8 @@ am_create_testdir=empty . ./defs || Exit 1 +cwd=$(pwd) || fatal_ "getting current working directory" + # Make sure the directory we will create can be created... mkdir '~a b' && mkdir '~a b/-x y' \ || skip_ "directory names with spaces and metacharacters not accepted" @@ -49,10 +51,9 @@ exec mkdir "$@" EOF chmod +x bin/mkdir -AM_PATH=$PATH -export AM_PATH -PATH=`pwd`/bin$PATH_SEPARATOR$PATH -export PATH + +AM_PATH=$PATH; export AM_PATH +PATH=$cwd/bin$PATH_SEPARATOR$PATH; export PATH # Test mkinstalldirs without mkdir -p. @@ -60,6 +61,8 @@ export PATH test -d '~a b/-x y' rm -rf '~a b' -./mkinstalldirs "`pwd`///~a b//-x y" -test -d "`pwd`/~a b/-x y" +./mkinstalldirs "$cwd///~a b//-x y" +test -d "$cwd/~a b/-x y" rm -rf '~a b' + +: diff --git a/t/mmodely.sh b/t/mmodely.sh index 6c6191520..25139aa88 100755 --- a/t/mmodely.sh +++ b/t/mmodely.sh @@ -81,7 +81,7 @@ cat >mylex.sh <<'END' echo "$@" >lex.yy.c END chmod +x myyacc.sh mylex.sh -PATH="`pwd`$PATH_SEPARATOR$PATH" +PATH=$(pwd)$PATH_SEPARATOR$PATH; export PATH # "make maintainer-clean; ./configure; make" should always work, # per GNU Standard. @@ -89,5 +89,7 @@ $MAKE maintainer-clean ./configure YACC="myyacc.sh" LEX="mylex.sh" \ LEX_OUTPUT_ROOT='lex.yy' $MAKE -e zardoz.c joe.c -grep zardoz.y zardoz.c -grep joe.l joe.c +$FGREP zardoz.y zardoz.c +$FGREP joe.l joe.c + +: diff --git a/t/multlib.sh b/t/multlib.sh index 0295ccc45..698f1c0bd 100755 --- a/t/multlib.sh +++ b/t/multlib.sh @@ -27,7 +27,7 @@ mkdir m4 cp "$mldir"/config-ml.in "$mldir"/symlink-tree . cp "$mldir"/multi.m4 m4 -ACLOCAL_PATH=${ACLOCAL_PATH+"$ACLOCAL_PATH:"}`pwd`/m4 +ACLOCAL_PATH=${ACLOCAL_PATH+"$ACLOCAL_PATH:"}$(pwd)/m4 export ACLOCAL_PATH cat >configure.ac <<'END' @@ -53,7 +53,7 @@ gcc ${1+"$@"} END chmod +x mycc -PATH=`pwd`$PATH_SEPARATOR$PATH +PATH=$(pwd)$PATH_SEPARATOR$PATH; export PATH cat >Makefile.am <<'EOF' SUBDIRS = @subdirs@ diff --git a/t/nobase-libtool.sh b/t/nobase-libtool.sh index 38008cd0a..163ffd36f 100755 --- a/t/nobase-libtool.sh +++ b/t/nobase-libtool.sh @@ -54,8 +54,7 @@ EOF mkdir sub cat >source.c <<'EOF' -int -main (int argc, char *argv[]) +int main (int argc, char *argv[]) { return 0; } @@ -68,14 +67,14 @@ libtoolize $ACLOCAL $AUTOCONF $AUTOMAKE -a --copy -./configure --prefix "`pwd`/inst" --program-prefix=p +./configure --prefix "$(pwd)/inst" --program-prefix=p $MAKE $MAKE test-install-data $MAKE test-install-exec $MAKE uninstall -test `find inst/foo -type f -print | wc -l` = 0 +test $(find inst/foo -type f -print | wc -l) -eq 0 $MAKE install-strip @@ -85,11 +84,11 @@ $MAKE uninstall $MAKE distclean mkdir build cd build -../configure --prefix "`pwd`/inst" --program-prefix=p +../configure --prefix "$(pwd)/inst" --program-prefix=p $MAKE $MAKE test-install-data $MAKE test-install-exec $MAKE uninstall -test `find inst/foo -type f -print | wc -l` = 0 +test $(find inst/foo -type f -print | wc -l) -eq 0 : diff --git a/t/nobase-python.sh b/t/nobase-python.sh index 28509018b..d086bbe43 100755 --- a/t/nobase-python.sh +++ b/t/nobase-python.sh @@ -45,8 +45,7 @@ END mkdir sub -for file in one.py sub/base.py two.py sub/nobase.py -do +for file in one.py sub/base.py two.py sub/nobase.py; do echo 'def one(): return 1' >$file done @@ -54,7 +53,7 @@ $ACLOCAL $AUTOCONF $AUTOMAKE --add-missing -./configure --prefix "`pwd`/inst" --program-prefix=p +./configure --prefix "$(pwd)/inst" --program-prefix=p $MAKE $MAKE test-install-data @@ -70,7 +69,7 @@ $MAKE uninstall $MAKE distclean mkdir build cd build -../configure --prefix "`pwd`/inst" --program-prefix=p +../configure --prefix "$(pwd)/inst" --program-prefix=p $MAKE $MAKE test-install-data $MAKE uninstall diff --git a/t/nobase.sh b/t/nobase.sh index e7661c09a..a7219ed45 100755 --- a/t/nobase.sh +++ b/t/nobase.sh @@ -120,14 +120,14 @@ rm -f install-sh $ACLOCAL $AUTOCONF $AUTOMAKE -a --copy -./configure --prefix "`pwd`/inst" --program-prefix=p +./configure --prefix "$(pwd)/inst" --program-prefix=p $MAKE $MAKE test-install-data $MAKE test-install-exec $MAKE uninstall -test `find inst/foo -type f -print | wc -l` = 0 +test $(find inst/foo -type f -print | wc -l) -eq 0 $MAKE install-strip @@ -137,11 +137,11 @@ $MAKE uninstall $MAKE distclean mkdir build cd build -../configure --prefix "`pwd`/inst" --program-prefix=p +../configure --prefix "$(pwd)/inst" --program-prefix=p $MAKE $MAKE test-install-data $MAKE test-install-exec $MAKE uninstall -test `find inst/foo -type f -print | wc -l` = 0 +test $(find inst/foo -type f -print | wc -l) -eq 0 : diff --git a/t/nodist2.sh b/t/nodist2.sh index 36851be90..9c7ec30e3 100755 --- a/t/nodist2.sh +++ b/t/nodist2.sh @@ -32,7 +32,7 @@ EOF $ACLOCAL $AUTOCONF $AUTOMAKE -a -./configure --prefix "`pwd`/install" +./configure --prefix "$(pwd)/install" $MAKE install-data : diff --git a/t/notrans.sh b/t/notrans.sh index 487b66f3d..81ed4d89d 100755 --- a/t/notrans.sh +++ b/t/notrans.sh @@ -79,8 +79,8 @@ test-install: install test -f inst/man/man2/z-bar2.2 test -f inst/man/man1/z-baz.1 test -f inst/man/man1/z-baz2.1 - if test -d inst/man/man8; then (exit 1); else :; fi - if test -d inst/man/man9; then (exit 1); else :; fi + test ! -d inst/man/man8 + test ! -d inst/man/man9 EOF : > foo.1 @@ -106,16 +106,18 @@ grep '^install-man3:' Makefile.in | grep '\$(nodist_man_MANS)' grep '^install-man4:' Makefile.in | grep '\$(notrans_man_MANS)' grep '^install-man5:' Makefile.in | grep '\$(notrans_dist_man_MANS)' grep '^install-man6:' Makefile.in | grep '\$(notrans_nodist_man_MANS)' +grep '^install-man8:' Makefile.in && Exit 1 +grep '^install-man9:' Makefile.in && Exit 1 -if grep '^install-man8:' Makefile.in; then Exit 1; else :; fi -if grep '^install-man9:' Makefile.in; then Exit 1; else :; fi +cwd=$(pwd) || fatal_ "getting current working directory" -./configure --program-prefix=gnu- --prefix "`pwd`"/inst --mandir "`pwd`"/inst/man +./configure --program-prefix=gnu- --prefix "$cwd"/inst \ + --mandir "$cwd"/inst/man $MAKE $MAKE test-install -test `find inst/man -type f -print | wc -l` = 24 +test $(find inst/man -type f -print | wc -l) -eq 24 $MAKE uninstall -test `find inst/man -type f -print | wc -l` = 0 +test $(find inst/man -type f -print | wc -l) -eq 0 # Opportunistically test for installdirs. rm -rf inst @@ -127,5 +129,7 @@ test -d inst/man/man4 test -d inst/man/man5 test -d inst/man/man6 test -d inst/man/man7 -if test -d inst/man/man8; then Exit 1; else :; fi -if test -d inst/man/man9; then Exit 1; else :; fi +test -d inst/man/man8 && Exit 1 +test -d inst/man/man9 && Exit 1 + +: diff --git a/t/number.sh b/t/number.sh index b96e1180d..d5c3acf0e 100755 --- a/t/number.sh +++ b/t/number.sh @@ -14,7 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -# Test to make sure _OBJECTS only generated once. Bug reported by +# Test to make sure _OBJECTS is only generated once. Bug reported by # Joerg-Martin Schwarz. . ./defs || Exit 1 @@ -31,7 +31,6 @@ $ACLOCAL $AUTOMAKE grep '^zardoz_OBJECTS' Makefile.in -count=`grep -c '^zardoz_OBJECTS' Makefile.in` -test $count -eq 1 +test $(grep -c '^zardoz_OBJECTS' Makefile.in) -eq 1 : diff --git a/t/objc-megademo.sh b/t/objc-megademo.sh index 3a0977d8b..8a26db78f 100755 --- a/t/objc-megademo.sh +++ b/t/objc-megademo.sh @@ -330,7 +330,7 @@ END ./configure $MAKE -if cross_compiling; then :; else +if ! cross_compiling; then unindent > exp << 'END' [Hello C, world C] [Hello C++, world C++] diff --git a/t/objext-pr10128.sh b/t/objext-pr10128.sh index 2fe2dfd2c..440fc1d19 100755 --- a/t/objext-pr10128.sh +++ b/t/objext-pr10128.sh @@ -52,7 +52,7 @@ touch foo.lisp mu1.lisp mu2.lisp $MAKE all cat foo cat zardoz -test "`cat foo`" = "Linked foo from foo.fasl" -test "`cat zardoz`" = "Linked zardoz from mu1.fasl mu2.fasl" +test "$(cat foo)" = "Linked foo from foo.fasl" +test "$(cat zardoz)" = "Linked zardoz from mu1.fasl mu2.fasl" : diff --git a/t/obsolete.sh b/t/obsolete.sh index c4240c200..e48d435ea 100755 --- a/t/obsolete.sh +++ b/t/obsolete.sh @@ -39,7 +39,7 @@ cat obs.1 # Likewise. cat obs.2 # Likewise. # Sanity check. Make sure we have added something to configure.ac. -test `wc -l <configure.ac` -gt 1 +test $(wc -l <configure.ac) -gt 1 $ACLOCAL diff --git a/t/oldvars.sh b/t/oldvars.sh index 87d9cf1fa..dd162fff8 100755 --- a/t/oldvars.sh +++ b/t/oldvars.sh @@ -32,4 +32,6 @@ EOF $ACLOCAL AUTOMAKE_fails -test `grep -c anachronism stderr` -eq 8 +test $(grep -c anachronism stderr) -eq 8 + +: diff --git a/t/output8.sh b/t/output8.sh index 1339c67dd..943e75865 100755 --- a/t/output8.sh +++ b/t/output8.sh @@ -42,11 +42,13 @@ $AUTOMAKE --add-missing ./configure $MAKE -test "`cat a/foo.sh`" = foo +test "$(cat a/foo.sh)" = foo $sleep echo 'bar' >a/foo.sh.in cd a $MAKE foo.sh -test "`cat foo.sh`" = bar +test "$(cat foo.sh)" = bar + +: diff --git a/t/override-conditional-1.sh b/t/override-conditional-1.sh index 1f66d3f47..020a6e37e 100755 --- a/t/override-conditional-1.sh +++ b/t/override-conditional-1.sh @@ -36,7 +36,7 @@ $ACLOCAL $AUTOMAKE -Wno-override # "ps:" should be output in two conditions -test `grep '[^-]ps:' Makefile.in | wc -l` = 2 +test $(grep -c '[^-]ps:' Makefile.in) -eq 2 grep '@COND_TRUE@ps: *foobar' Makefile.in grep '@COND_FALSE@ps: *ps-am' Makefile.in diff --git a/t/override-html.sh b/t/override-html.sh index 6438c998b..cf57880bc 100755 --- a/t/override-html.sh +++ b/t/override-html.sh @@ -28,6 +28,6 @@ $ACLOCAL $AUTOMAKE -Wno-override # Overriding 'html' should cause only one "html:" rule to be output. -test `grep '^html:' Makefile.in | wc -l` = 1 +test $(grep -c '^html:' Makefile.in) -eq 1 : diff --git a/t/parallel-am.sh b/t/parallel-am.sh index db184b283..a27c663e9 100755 --- a/t/parallel-am.sh +++ b/t/parallel-am.sh @@ -83,7 +83,7 @@ $ACLOCAL unset AUTOMAKE_JOBS || : AUTOMAKE_run --add-missing mv stderr expected -Makefile_ins=`find . -name Makefile.in` +Makefile_ins=$(find . -name Makefile.in) for file in $Makefile_ins; do mv $file $file.exp done diff --git a/t/parallel-tests-exit-statuses.sh b/t/parallel-tests-exit-statuses.sh index 90583d59c..8d8e6a972 100755 --- a/t/parallel-tests-exit-statuses.sh +++ b/t/parallel-tests-exit-statuses.sh @@ -25,15 +25,15 @@ END # $failure_statuses should be defined to the list of all integers between # 1 and 255 (inclusive), excluded 77 and 99. -failure_statuses=`seq_ 1 255 | $EGREP -v '^(77|99)$' | tr "$nl" ' '` +failure_statuses=$(seq_ 1 255 | $EGREP -v '^(77|99)$' | tr "$nl" ' ') # For debugging. echo "failure_statuses: $failure_statuses" # Sanity check. -test `for st in $failure_statuses; do echo $st; done | wc -l` -eq 253 \ +test $(for st in $failure_statuses; do echo $st; done | wc -l) -eq 253 \ || fatal_ "initializing list of exit statuses for simple failures" cat > Makefile.am <<END -LOG_COMPILER = ./do-exit +LOG_COMPILER = $AM_TEST_RUNNER_SHELL ./do-exit fail_tests = $failure_statuses TESTS = 0 77 99 $failure_statuses \$(TESTS): @@ -44,7 +44,7 @@ cat > do-exit <<'END' echo "$0: $1" case $1 in [0-9]|[0-9][0-9]|[0-9][0-9][0-9]) st=$1;; - */[0-9]|*/[0-9][0-9]|*/[0-9][0-9][0-9]) st=`echo x"$1" | sed 's|.*/||'`;; + */[0-9]|*/[0-9][0-9]|*/[0-9][0-9][0-9]) st=${1##*/};; *) st=99;; esac exit $st diff --git a/t/parallel-tests-interrupt.tap b/t/parallel-tests-interrupt.tap index afc19568d..50b734e0f 100755 --- a/t/parallel-tests-interrupt.tap +++ b/t/parallel-tests-interrupt.tap @@ -30,7 +30,7 @@ END cat > Makefile.am << 'END' TESTS = foo.test ## Provide more debugging info. -TEST_LOG_COMPILER = $(SHELL) -x +TEST_LOG_COMPILER = $(SHELL) -ex ## Required by foo.test; see below. AM_TESTS_FD_REDIRECT = 9>&1 END diff --git a/t/parallel-tests-log-compiler-1.sh b/t/parallel-tests-log-compiler-1.sh index 1f16d9f03..10519e072 100755 --- a/t/parallel-tests-log-compiler-1.sh +++ b/t/parallel-tests-log-compiler-1.sh @@ -69,7 +69,7 @@ END sed 's/--chk/--am-test/' chk-compiler > test-compiler mkdir bin -PATH=`pwd`/bin$PATH_SEPARATOR$PATH; export PATH +PATH=$(pwd)/bin$PATH_SEPARATOR$PATH; export PATH cat > bin/t-compiler <<'END' #! /bin/sh diff --git a/t/parallel-tests-many.sh b/t/parallel-tests-many.sh index 65db6e6ca..13eee3474 100755 --- a/t/parallel-tests-many.sh +++ b/t/parallel-tests-many.sh @@ -116,7 +116,7 @@ setup_data () for count in 1 2 4 8 12 16 20 24 28 32 48 64 96 128 E_HUGE; do test $count = E_HUGE && break - count=`expr $count '*' 100` || Exit 99 + count=$(($count * 100)) setup_data if $MAKE this-will-fail; then continue @@ -125,7 +125,8 @@ for count in 1 2 4 8 12 16 20 24 28 32 48 64 96 128 E_HUGE; do # hit the system command-line limits; we can stop. But first, for # good measure, increase the number of tests of some 20%, to be # "even more sure" of really tickling command line length limits. - count=`expr '(' $count '*' 12 ')' / 10` || Exit 99 + count=$(($count * 12)) + count=$(($count / 10)) setup_data break fi @@ -159,15 +160,15 @@ ls -1 $deepdir | grep '\.log$' > lst sed 20q lst # For debugging. sed 20q grp # Likewise. -test `cat <grp | wc -l` -eq $count -test `cat <lst | wc -l` -eq $count +test $(cat <grp | wc -l) -eq $count +test $(cat <lst | wc -l) -eq $count # We need to simulate a failure of two tests. st=0 env TESTS="$deepdir/$tname-1.test $deepdir/$tname-2.test" \ TEST_LOG_COMPILER=false $MAKE -e check > stdout && st=1 cat stdout -test `grep -c '^FAIL:' stdout` -eq 2 || st=1 +test $(grep -c '^FAIL:' stdout) -eq 2 || st=1 test $st -eq 0 || fatal_ "couldn't simulate failure of two tests" unset st @@ -175,7 +176,7 @@ $MAKE recheck > stdout || { cat stdout; Exit 1; } cat stdout grep "^PASS: .*$tname-1\.test" stdout grep "^PASS: .*$tname-2\.test" stdout -test `LC_ALL=C grep -c "^[A-Z][A-Z]*:" stdout` -eq 2 +test $(LC_ALL=C grep -c "^[A-Z][A-Z]*:" stdout) -eq 2 grep "^# TOTAL: 2$" stdout grep "^# PASS: 2$" stdout diff --git a/t/parallel-tests-trailing-bslash.sh b/t/parallel-tests-trailing-bslash.sh index 129176480..e6fd2ade9 100755 --- a/t/parallel-tests-trailing-bslash.sh +++ b/t/parallel-tests-trailing-bslash.sh @@ -94,7 +94,7 @@ chmod a+x my-shell cat my-shell -CONFIG_SHELL=`pwd`/my-shell; export CONFIG_SHELL +CONFIG_SHELL=$(pwd)/my-shell; export CONFIG_SHELL $ACLOCAL $AUTOCONF diff --git a/t/parallel-tests.sh b/t/parallel-tests.sh index 459a24daf..b152fc53a 100755 --- a/t/parallel-tests.sh +++ b/t/parallel-tests.sh @@ -69,8 +69,8 @@ cat stdout count_test_results total=3 pass=1 fail=1 skip=0 xfail=0 xpass=0 error=1 test -f test-suite.log cat test-suite.log -test `grep -c '^FAIL:' test-suite.log` -eq 1 -test `grep -c '^ERROR:' test-suite.log` -eq 1 +test $(grep -c '^FAIL:' test-suite.log) -eq 1 +test $(grep -c '^ERROR:' test-suite.log) -eq 1 $EGREP '^(X?PASS|XFAIL|SKIP)' test-suite.log && Exit 1 test -f baz.log test -f bar.log diff --git a/t/parallel-tests2.sh b/t/parallel-tests2.sh index d54b9e827..a793dec2a 100755 --- a/t/parallel-tests2.sh +++ b/t/parallel-tests2.sh @@ -26,10 +26,8 @@ while :; do for r2h in $RST2HTML rst2html rst2html.py; do echo "$me: running $r2h --version" - # Don't use "&&" here, or a bug of 'set -e' present in some - # versions of the BSD shell will be triggered. We add the - # dummy "else" branch for extra safety. - if $r2h --version; then break 2; else :; fi + $r2h --version && break 2 + : For shells with busted 'set -e'. done skip_all_ "no proper rst2html program found" done diff --git a/t/parallel-tests3.sh b/t/parallel-tests3.sh index 8e3be0e50..6a6a9983c 100755 --- a/t/parallel-tests3.sh +++ b/t/parallel-tests3.sh @@ -98,7 +98,7 @@ cd .. # still be ongoing when the parallel one has terminated. kill -0 $! cat parallel/stdout -test `grep -c '^PASS:' parallel/stdout` -eq 12 +test $(grep -c '^PASS:' parallel/stdout) -eq 12 # Wait long enough so that there are no open files any more when the # post-test cleanup runs. But exit after we've waited for two minutes @@ -106,7 +106,7 @@ test `grep -c '^PASS:' parallel/stdout` -eq 12 # already happened). i=1 while test ! -f serial/test-suite.log && test $i -le 120; do - i=`expr $i + 1` + i=$(($i + 1)) sleep '1' # Extra quoting to please maintainer-check. done $sleep diff --git a/t/phony.sh b/t/phony.sh index a818cfb70..7ee11163c 100755 --- a/t/phony.sh +++ b/t/phony.sh @@ -26,4 +26,6 @@ EOF $ACLOCAL $AUTOMAKE -test `$FGREP .PHONY: Makefile.in | wc -l` = 3 +test $($FGREP -c '.PHONY:' Makefile.in) -eq 3 + +: diff --git a/t/pluseq5.sh b/t/pluseq5.sh index 5db9c47b3..b8b18a5bd 100755 --- a/t/pluseq5.sh +++ b/t/pluseq5.sh @@ -43,7 +43,7 @@ AUTOMAKE_fails # Is !CHECK mentioned? grep ':.*!CHECK$' stderr # Is there only one missing condition? -test `grep ': ' stderr | wc -l` = 1 +test $(grep -c ': ' stderr) -eq 1 # By the way, Automake should suggest using AM_CPPFLAGS, # because INCLUDES is an obsolete name. diff --git a/t/pluseq6.sh b/t/pluseq6.sh index 7a8f18706..2b65e1ac3 100755 --- a/t/pluseq6.sh +++ b/t/pluseq6.sh @@ -30,9 +30,9 @@ END $ACLOCAL $AUTOMAKE -$FGREP '@mandir@ foo' Makefile.in -num=`grep '^mandir =' Makefile.in | wc -l` -test $num -eq 1 +$FGREP 'mandir' Makefile.in # For debugging. +$FGREP '@mandir@ foo' Makefile.in +test $(grep -c '^mandir =' Makefile.in) -eq 1 : diff --git a/t/pluseq7.sh b/t/pluseq7.sh index 7f5a32ec3..e6e299ce6 100755 --- a/t/pluseq7.sh +++ b/t/pluseq7.sh @@ -32,7 +32,6 @@ END $ACLOCAL AUTOMAKE_fails -Wno-portability -q="[\`'\"]" -grep "^Makefile\.am:3:.* AR .* with $q=$q before .*$q+=$q" stderr +grep "^Makefile\.am:3:.* AR .* with '=' before .*'+='" stderr : diff --git a/t/pluseq9.sh b/t/pluseq9.sh index f3c802158..981a86899 100755 --- a/t/pluseq9.sh +++ b/t/pluseq9.sh @@ -66,6 +66,6 @@ AUTOMAKE_fails grep '[cC]annot apply.*+=' stderr grep ': !COND1 and !COND3$' stderr # Make sure there is exactly one missing condition. -test `grep ': ' stderr | wc -l` = 1 +test $(grep -c ': ' stderr) -eq 1 : diff --git a/t/posixsubst-data.sh b/t/posixsubst-data.sh index c2c2d7e3e..82be4e62c 100755 --- a/t/posixsubst-data.sh +++ b/t/posixsubst-data.sh @@ -62,7 +62,7 @@ $ACLOCAL $AUTOCONF $AUTOMAKE -cwd=`pwd` || Exit 1 +cwd=$(pwd) || fatal_ "getting current working directory" ./configure --prefix="$cwd/_inst" $MAKE install test -f bar.data diff --git a/t/posixsubst-libraries.sh b/t/posixsubst-libraries.sh index f437571b9..f3e89a7d7 100755 --- a/t/posixsubst-libraries.sh +++ b/t/posixsubst-libraries.sh @@ -54,7 +54,7 @@ $ACLOCAL $AUTOCONF $AUTOMAKE -a -cwd=`pwd` || Exit 1 +cwd=$(pwd) || fatal_ "getting current working directory" ./configure --prefix="$cwd/_inst" $MAKE test -f libfoo2.c diff --git a/t/posixsubst-ltlibraries.sh b/t/posixsubst-ltlibraries.sh index b4b2a925d..54958145c 100755 --- a/t/posixsubst-ltlibraries.sh +++ b/t/posixsubst-ltlibraries.sh @@ -55,7 +55,7 @@ $ACLOCAL $AUTOCONF $AUTOMAKE -a -cwd=`pwd` || Exit 1 +cwd=$(pwd) || fatal_ "getting current working directory" ./configure --prefix="$cwd/_inst" $MAKE test -f libfoo2.c diff --git a/t/posixsubst-programs.sh b/t/posixsubst-programs.sh index a02cb9209..99642c26a 100755 --- a/t/posixsubst-programs.sh +++ b/t/posixsubst-programs.sh @@ -53,7 +53,7 @@ $ACLOCAL $AUTOCONF $AUTOMAKE -cwd=`pwd` || Exit 1 +cwd=$(pwd) || fatal_ "getting current working directory" ./configure --prefix="$cwd/_inst" $MAKE $MAKE install diff --git a/t/posixsubst-scripts.sh b/t/posixsubst-scripts.sh index cda515fb5..79c95e2ee 100755 --- a/t/posixsubst-scripts.sh +++ b/t/posixsubst-scripts.sh @@ -88,7 +88,7 @@ $ACLOCAL $AUTOCONF $AUTOMAKE -cwd=`pwd` || Exit 1 +cwd=$(pwd) || fatal_ "getting current working directory" ./configure --prefix="$cwd/_inst" $MAKE $MAKE test1 test2 diff --git a/t/pr287.sh b/t/pr287.sh index 681f6d61b..1cd26aebb 100755 --- a/t/pr287.sh +++ b/t/pr287.sh @@ -31,7 +31,6 @@ cat > foo << 'END' #! /bin/sh echo Maude END - chmod +x foo mkdir install @@ -40,7 +39,7 @@ $ACLOCAL $AUTOCONF $AUTOMAKE -a -./configure "--prefix=`cd install && pwd`" +./configure "--prefix=$(cd install && pwd)" $MAKE $MAKE distdir diff --git a/t/pr300-lib.sh b/t/pr300-lib.sh index b655cf013..a676a3a69 100755 --- a/t/pr300-lib.sh +++ b/t/pr300-lib.sh @@ -50,7 +50,7 @@ $AUTOMAKE --copy --add-missing # or distributions possibly overriding '${libdir}' in their $CONFIG_SITE # file (for example, defining it to '${prefix}/lib64' on 64-bit systems, # as is the case with openSUSE 12.1). See automake bug#10426. -cwd=`pwd` || Exit 99 +cwd=$(pwd) || fatal_ "getting current working directory" ./configure --prefix "$cwd/inst" --libdir "$cwd/inst/lib" $MAKE diff --git a/t/pr300-ltlib.sh b/t/pr300-ltlib.sh index 8db6b0792..1495b0b75 100755 --- a/t/pr300-ltlib.sh +++ b/t/pr300-ltlib.sh @@ -48,7 +48,7 @@ $AUTOMAKE --copy --add-missing # or distributions possibly overriding '${libdir}' in their $CONFIG_SITE # file (for example, defining it to '${prefix}/lib64' on 64-bit systems, # as is the case with openSUSE 12.1). See automake bug#10426. -cwd=`pwd` || Exit 99 +cwd=$(pwd) || fatal_ "getting current working directory" ./configure --prefix "$cwd/inst" --libdir "$cwd/inst/lib" # A rule in the Makefile should create subdir. diff --git a/t/pr300-prog.sh b/t/pr300-prog.sh index 6812231bd..7be09110c 100755 --- a/t/pr300-prog.sh +++ b/t/pr300-prog.sh @@ -62,7 +62,7 @@ $ACLOCAL $AUTOCONF $AUTOMAKE --copy --add-missing -./configure --prefix "`pwd`/inst" +./configure --prefix "$(pwd)/inst" $MAKE test-all $MAKE test-install @@ -45,7 +45,7 @@ AC_CONFIG_AUX_DIR([.]) AM_INIT_AUTOMAKE AC_PROG_CC AC_CONFIG_FILES([Makefile]) -AC_CONFIG_FILES([`echo $subdirs | sed 's|\([a-z][a-z]*\)|\1/Makefile|g'`]) +AC_CONFIG_FILES([$(echo $subdirs | sed 's|\([a-z][a-z]*\)|\1/Makefile|g')]) AC_OUTPUT EOF diff --git a/t/primary-prefix-couples-force-valid.sh b/t/primary-prefix-couples-force-valid.sh index 064db2bbb..e7ea63461 100755 --- a/t/primary-prefix-couples-force-valid.sh +++ b/t/primary-prefix-couples-force-valid.sh @@ -77,7 +77,7 @@ $ACLOCAL $AUTOMAKE -a $AUTOCONF -cwd=`pwd` || fatal_ "cannot get current working directory" +cwd=$(pwd) || fatal_ "getting current working directory" ./configure --prefix="$cwd/_inst" $MAKE install diff --git a/t/print-libdir.sh b/t/print-libdir.sh index f5764b368..0c699422d 100755 --- a/t/print-libdir.sh +++ b/t/print-libdir.sh @@ -19,7 +19,7 @@ am_create_testdir=empty . ./defs || Exit 1 -libdir=`$AUTOMAKE --print-libdir` || Exit 1 +libdir=$($AUTOMAKE --print-libdir) || Exit 1 case $libdir in /*);; *) Exit 1;; esac test -d "$libdir" test "$libdir" = "$am_pkgvdatadir" diff --git a/t/py-compile-basedir.sh b/t/py-compile-basedir.sh index 1504f557e..03617fb14 100755 --- a/t/py-compile-basedir.sh +++ b/t/py-compile-basedir.sh @@ -28,7 +28,7 @@ cp "$am_scriptdir/py-compile" . \ || fatal_ "failed to fetch auxiliary script py-compile" f=__init__ -for d in foo foo/bar "`pwd`/foo" . .. ../foo ''; do +for d in foo foo/bar "$(pwd)/foo" . .. ../foo ''; do if test -z "$d"; then d2=. else diff --git a/t/py-compile-basic2.sh b/t/py-compile-basic2.sh index dfa992c15..3a09f45d3 100755 --- a/t/py-compile-basic2.sh +++ b/t/py-compile-basic2.sh @@ -21,7 +21,7 @@ required=python . ./defs || Exit 1 -ocwd=`pwd` || Exit 99 +ocwd=$(pwd) || fatal_ "getting current working directory" pyfiles=" foo.py diff --git a/t/py-compile-usage.sh b/t/py-compile-usage.sh index 19883b03d..9dfe0a70d 100755 --- a/t/py-compile-usage.sh +++ b/t/py-compile-usage.sh @@ -43,15 +43,15 @@ month='(0[0-9]|1[012])' day='([012][0-9]|3[01])' hour='([01][0-9]|2[0123])' LC_ALL=C $EGREP "^py-compile $year-$month-$day\.$hour" stdout -test `wc -l <stdout` -eq 1 +test $(wc -l <stdout) -eq 1 # Unknown option. for opt in -b -d --foo; do ./py-compile $opt 2>stderr && { cat stderr >&2; Exit 1; } cat stderr >&2 - grep "^py-compile: unrecognized option ['\`]$opt'" stderr - grep "^Try [\`']py-compile --help' for more information" stderr + grep "^py-compile: unrecognized option '$opt'" stderr + grep "^Try 'py-compile --help' for more information" stderr done # Missing option argument. @@ -59,8 +59,8 @@ done for opt in --basedir --destdir; do ./py-compile $opt 2>stderr && { cat stderr >&2; Exit 1; } cat stderr >&2 - grep "^py-compile: option ['\`]$opt' requires an argument" stderr - grep "^Try [\`']py-compile --help' for more information" stderr + grep "^py-compile: option '$opt' requires an argument" stderr + grep "^Try 'py-compile --help' for more information" stderr done # Missing files. @@ -69,7 +69,7 @@ for args in '' '--basedir dir' '--destdir dir'; do ./py-compile $args 2>stderr && { cat stderr >&2; Exit 1; } cat stderr >&2 grep '^py-compile: no files given' stderr - grep "^Try [\`']py-compile --help' for more information" stderr + grep "^Try 'py-compile --help' for more information" stderr done : diff --git a/t/python-pr10995.sh b/t/python-pr10995.sh index 3efa5d0d6..375b79295 100755 --- a/t/python-pr10995.sh +++ b/t/python-pr10995.sh @@ -44,14 +44,12 @@ $AUTOCONF $AUTOMAKE --add-missing test -f py-compile -inst=`pwd`/inst - -./configure --prefix="$inst" +./configure --prefix="$(pwd)/inst" $MAKE install -test -f "$inst/py/yes.py" -test -f "$inst/py/yes.pyc" -test ! -f "$inst/py/no.py" -test ! -f "$inst/py/no.pyc" +test -f inst/py/yes.py +test -f inst/py/yes.pyc +test ! -f inst/py/no.py +test ! -f inst/py/no.pyc $MAKE disttest diff --git a/t/python-vars.sh b/t/python-vars.sh index 56c2b619f..97a45c90d 100755 --- a/t/python-vars.sh +++ b/t/python-vars.sh @@ -30,8 +30,8 @@ PYTHON=python # vary among different python installations, so we need more relaxed # and ad-hoc checks for them. Also, more proper "functional" checks # on them should be done in the 'python-virtualenv.test' test. -PYTHON_VERSION=`$PYTHON -c 'import sys; print(sys.version[:3])'` || Exit 1 -PYTHON_PLATFORM=`$PYTHON -c 'import sys; print(sys.platform)'` || Exit 1 +PYTHON_VERSION=$($PYTHON -c 'import sys; print(sys.version[:3])') || Exit 1 +PYTHON_PLATFORM=$($PYTHON -c 'import sys; print(sys.platform)') || Exit 1 PYTHON_EXEC_PREFIX='${exec_prefix}' PYTHON_PREFIX='${prefix}' pkgpythondir="\${pythondir}/$me" diff --git a/t/python-virtualenv.sh b/t/python-virtualenv.sh index c534e8da4..15653a674 100755 --- a/t/python-virtualenv.sh +++ b/t/python-virtualenv.sh @@ -34,8 +34,8 @@ if test -z "$VIRTUAL_ENV"; then framework_failure_ "can't activate python virtual environment" fi -cwd=`pwd` -py_version=`python -c 'import sys; print("%u.%u" % tuple(sys.version_info[:2]))'` +cwd=$(pwd) || fatal_ "getting current working directory" +py_version=$(python -c 'import sys; print("%u.%u" % tuple(sys.version_info[:2]))') py_site=$VIRTUAL_ENV/lib/python$py_version/site-packages # We need control over the package name. diff --git a/t/python.sh b/t/python.sh index de8c0bbfb..0fe5d12d1 100755 --- a/t/python.sh +++ b/t/python.sh @@ -53,8 +53,8 @@ $AUTOMAKE Makefile3 grep "py" Makefile.in Makefile2.in Makefile3.in # For debugging. for f in Makefile.in Makefile2.in Makefile3.in; do - test `grep -c '^py_compile =' $f` -eq 1 - test `grep -c '^am__py_compile =' $f` -eq 1 + test $(grep -c '^py_compile =' $f) -eq 1 + test $(grep -c '^am__py_compile =' $f) -eq 1 done : diff --git a/t/python10.sh b/t/python10.sh index b28c3a449..cc1fd5f12 100755 --- a/t/python10.sh +++ b/t/python10.sh @@ -50,11 +50,13 @@ $ACLOCAL $AUTOCONF $AUTOMAKE --add-missing -mkdir inst -inst=`pwd`/inst -mkdir build -cd build -../configure --prefix="$inst" +inst=inst_ +mkdir inst_ build_ +cd build_ + +cwd=$(pwd) || fatal_ "getting current working directory" + +../configure --prefix="$cwd/$inst" one=0 $MAKE install test -f "$inst/your/two.py" test -f "$inst/your/two.pyc" @@ -67,7 +69,7 @@ test ! -f "$inst/your/two.py" test ! -f "$inst/your/two.pyc" test ! -f "$inst/your/two.pyo" -../configure --prefix="$inst" one=1 +../configure --prefix=$cwd/"$inst" one=1 $MAKE install test ! -f "$inst/your/two.py" test ! -f "$inst/your/two.pyc" diff --git a/t/python12.sh b/t/python12.sh index 3faeb457f..d7b0cc773 100755 --- a/t/python12.sh +++ b/t/python12.sh @@ -36,10 +36,8 @@ $ACLOCAL $AUTOCONF $AUTOMAKE --add-missing -rm -rf inst build -mkdir inst -instdir=`pwd`/inst -mkdir build +instdir=$(pwd)/inst +mkdir inst build cd build ../configure --prefix="/usr" $MAKE install DESTDIR=$instdir diff --git a/t/python3.sh b/t/python3.sh index 72021cd86..33c427599 100755 --- a/t/python3.sh +++ b/t/python3.sh @@ -36,14 +36,12 @@ $ACLOCAL $AUTOCONF $AUTOMAKE --add-missing -mkdir inst -inst=`pwd`/inst mkdir build cd build -../configure --prefix="$inst" +../configure --prefix="$(pwd)/inst" $MAKE install -test -f "$inst/my/one.py" -test -f "$inst/my/one.pyc" -test -f "$inst/my/one.pyo" +test -f inst/my/one.py +test -f inst/my/one.pyc +test -f inst/my/one.pyo : diff --git a/t/python5b.sh b/t/python5b.sh index b382b38f9..366c9b133 100755 --- a/t/python5b.sh +++ b/t/python5b.sh @@ -32,7 +32,7 @@ cat > bin/my-python << 'END' exec python ${1+"$@"} END chmod a+x bin/my-python -PATH=`pwd`/bin$PATH_SEPARATOR$PATH +PATH=$(pwd)/bin$PATH_SEPARATOR$PATH : > Makefile.am diff --git a/t/python6.sh b/t/python6.sh index 0e09a4381..245cf4fec 100755 --- a/t/python6.sh +++ b/t/python6.sh @@ -33,6 +33,6 @@ $AUTOMAKE --add-missing # Simulate no Python. ./configure PYTHON=: -test x"`cat py`" = x: +test x"$(cat py)" = x: : diff --git a/t/python7.sh b/t/python7.sh index ec0ac070a..93f0c96f2 100755 --- a/t/python7.sh +++ b/t/python7.sh @@ -33,6 +33,6 @@ $AUTOCONF $AUTOMAKE --add-missing ./configure -test x"`cat py`" = x: +test x"$(cat py)" = x: : diff --git a/t/python9.sh b/t/python9.sh index e567adcde..a992aab5f 100755 --- a/t/python9.sh +++ b/t/python9.sh @@ -33,6 +33,6 @@ $AUTOCONF $AUTOMAKE --add-missing ./configure -test x"`cat py.out`" = x0:1 +test x"$(cat py.out)" = x0:1 : diff --git a/t/remake-subdir-long-time.sh b/t/remake-subdir-long-time.sh index 8f3174025..7bbc1d40a 100755 --- a/t/remake-subdir-long-time.sh +++ b/t/remake-subdir-long-time.sh @@ -38,7 +38,7 @@ mkdir sub # Both aclocal and automake are expected to run one and just one time. # Create and use wrappers that will verify that. -ocwd=`pwd` || fatal_ "cannot get current working directory" +ocwd=$(pwd) || fatal_ "cannot get current working directory" mkdir bin diff --git a/t/remake11.sh b/t/remake11.sh index b88254f4b..93ef22449 100755 --- a/t/remake11.sh +++ b/t/remake11.sh @@ -21,7 +21,7 @@ . ./defs || Exit 1 -ocwd=`pwd` || Exit 1 +ocwd=$(pwd) || fatal_ "getting current working directory" magic1=::MagicStringOne:: magic2=__MagicStringTwo__ @@ -43,7 +43,8 @@ done echo AC_OUTPUT >> "$ocwd"/configure.ac : > Makefile.am unset d i -bottom=`pwd` + +bottom=$(pwd) || fatal_ "getting current working directory" cd "$ocwd" diff --git a/t/remake6.sh b/t/remake6.sh index c48c1b882..b6a3340e9 100755 --- a/t/remake6.sh +++ b/t/remake6.sh @@ -35,30 +35,29 @@ $AUTOCONF ./configure $MAKE +do_check () +{ + $MAKE >stdout || { cat stdout; Exit 1; } + cat stdout + test $(grep -c " --run " stdout) -eq 1 +} + # Now, we are set up. Ensure that, for either missing Makefile.in, # or updated Makefile.am, rebuild rules are run, and run exactly once # only. rm -f Makefile.in -$MAKE >stdout || { cat stdout; Exit 1; } -cat stdout -test `grep -c " --run " stdout` -eq 1 +do_check rm -f sub/Makefile.in -$MAKE >stdout || { cat stdout; Exit 1; } -cat stdout -test `grep -c " --run " stdout` -eq 1 +do_check $sleep # Let touched files appear newer. touch Makefile.am -$MAKE >stdout || { cat stdout; Exit 1; } -cat stdout -test `grep -c " --run " stdout` -eq 1 +do_check touch sub/Makefile.am -$MAKE >stdout || { cat stdout; Exit 1; } -cat stdout -test `grep -c " --run " stdout` -eq 1 +do_check : diff --git a/t/remake9a.sh b/t/remake9a.sh index 7ee307578..2f4349a1a 100755 --- a/t/remake9a.sh +++ b/t/remake9a.sh @@ -80,7 +80,7 @@ for vpath in : false; do remake_ $FGREP FINGERPRINT Makefile # For debugging. $FGREP $magic1 Makefile - test x"`./foo.sh`" = x"$magic1" + test x"$(./foo.sh)" = x"$magic1" $sleep echo 'sed "s/^\\(FINGERPRINT\\)=.*/\\1='$magic2'/"' \ @@ -89,7 +89,7 @@ for vpath in : false; do $FGREP FINGERPRINT Makefile # For debugging. $FGREP $magic1 Makefile && Exit 1 $FGREP $magic2 Makefile - test x"`./foo.sh`" = x"$magic2" + test x"$(./foo.sh)" = x"$magic2" $sleep echo cat > $srcdir/tweak-configure-in # Make it a no-op again. diff --git a/t/remake9b.sh b/t/remake9b.sh index cab606e4d..4e0bfdcf3 100755 --- a/t/remake9b.sh +++ b/t/remake9b.sh @@ -82,7 +82,7 @@ for vpath in : false; do remake_ $FGREP FINGERPRINT Makefile # For debugging. $FGREP $magic1 Makefile - test x"`./foo.sh`" = x"$magic1" + test x"$(./foo.sh)" = x"$magic1" $sleep echo 'sed "s/^\\(FINGERPRINT\\) *=.*/\\1 = '$magic2'/"' \ @@ -91,7 +91,7 @@ for vpath in : false; do $FGREP FINGERPRINT Makefile # For debugging. $FGREP $magic1 Makefile && Exit 1 $FGREP $magic2 Makefile - test x"`./foo.sh`" = x"$magic2" + test x"$(./foo.sh)" = x"$magic2" $sleep echo cat > $srcdir/tweak-makefile-am # Make it a no-op again. diff --git a/t/remake9c.sh b/t/remake9c.sh index efbec30f0..5ed7893e7 100755 --- a/t/remake9c.sh +++ b/t/remake9c.sh @@ -84,7 +84,7 @@ for vpath in : false; do remake_ $FGREP FINGERPRINT Makefile # For debugging. $FGREP $magic1 Makefile - test x"`./foo.sh`" = x"$magic1" + test x"$(./foo.sh)" = x"$magic1" $sleep echo "echo 'AC_DEFUN([my_fingerprint], [$magic2])'" \ @@ -93,7 +93,7 @@ for vpath in : false; do $FGREP FINGERPRINT Makefile # For debugging. $FGREP $magic1 Makefile && Exit 1 $FGREP $magic2 Makefile - test x"`./foo.sh`" = x"$magic2" + test x"$(./foo.sh)" = x"$magic2" $sleep echo : > $srcdir/tweak-acinclude-m4 # Make it a no-op again. diff --git a/t/remake9d.sh b/t/remake9d.sh index dddb08343..5f4892bba 100755 --- a/t/remake9d.sh +++ b/t/remake9d.sh @@ -84,7 +84,7 @@ for vpath in : false; do remake_ $FGREP FINGERPRINT Makefile # For debugging. $FGREP $magic1 Makefile - test x"`./foo.sh`" = x"$magic1" + test x"$(./foo.sh)" = x"$magic1" $sleep echo "sed 's/.*dnl *%%%.*/AC_DEFUN([my_fingerprint], [$magic2])/'" \ @@ -93,7 +93,7 @@ for vpath in : false; do $FGREP FINGERPRINT Makefile # For debugging. $FGREP $magic1 Makefile && Exit 1 $FGREP $magic2 Makefile - test x"`./foo.sh`" = x"$magic2" + test x"$(./foo.sh)" = x"$magic2" $sleep echo cat > $srcdir/tweak-aclocal-m4 # Make it a no-op again. diff --git a/t/self-check-cleanup.tap b/t/self-check-cleanup.tap index 21c638891..f3868e656 100755 --- a/t/self-check-cleanup.tap +++ b/t/self-check-cleanup.tap @@ -23,7 +23,7 @@ plan_ 43 # We still need a little hack to make ./defs work outside automake's # tree 'tests' subdirectory. Not a big deal. -sed "s|^am_top_builddir=.*|am_top_builddir='`pwd`'|" \ +sed "s|^am_top_builddir=.*|am_top_builddir='$(pwd)'|" \ "$am_top_builddir"/defs-static >defs-static diff "$am_top_builddir"/defs-static defs-static \ && fatal_ "failed to edit defs-static" @@ -57,7 +57,7 @@ command_ok_ '"keep_testdirs=yes" causes testdir to be kept around' eval ' env keep_testdirs=yes \ $AM_TEST_RUNNER_SHELL -c ". ./defs && echo okok >foo" t/dummy.sh \ && test -f t/dummy.dir/foo \ - && test okok = `cat t/dummy.dir/foo`' + && test okok = $(cat t/dummy.dir/foo)' do_clean @@ -133,7 +133,7 @@ if test $have_symlinks = yes; then command_ok_ "post-cleanup with testdir with zero-perms symlinks" \ $AM_TEST_RUNNER_SHELL -c ' - ocwd=`pwd` || exit 1 + ocwd=$(pwd) || exit 1 stderr_fileno_=2 . ./defs || Exit 1 ln -s "$ocwd/dir" "$ocwd/file" . diff --git a/t/self-check-dir.tap b/t/self-check-dir.tap index 424367eac..6a0fbd3c3 100755 --- a/t/self-check-dir.tap +++ b/t/self-check-dir.tap @@ -29,7 +29,7 @@ keep_testdirs=; unset keep_testdirs # This needs to be consistent with what $AM_TEST_RUNNER_SHELL # deems to be the current working directory. -cwd=`$AM_TEST_RUNNER_SHELL -c 'pwd'` \ +cwd=$($AM_TEST_RUNNER_SHELL -c 'pwd') \ || fatal_ "can't get current working directory" echo "$cwd" @@ -48,17 +48,17 @@ do_check () do_check 'testdir has the expected path' \ 'unset am_create_testdir' \ - 'case `pwd` in '"$cwd"'/t/_self.dir);; *) Exit 1;; esac' + 'case $(pwd) in '"$cwd"'/t/_self.dir);; *) Exit 1;; esac' do_check 'fully pre-populated testdir' \ 'unset am_create_testdir' \ 'test -f install-sh || Exit 1 test -f configure.ac || Exit 1 - case `pwd` in '"$cwd"'/t/_self.dir) : ;; *) Exit 1;; esac' + case $(pwd) in '"$cwd"'/t/_self.dir) : ;; *) Exit 1;; esac' do_check 'testdir has the expected path' \ 'am_create_testdir=empty' \ - 'case `pwd` in '"$cwd"'/t/_self.dir) : ;; *) Exit 1;; esac' + 'case $(pwd) in '"$cwd"'/t/_self.dir) : ;; *) Exit 1;; esac' do_check 'do not pre-populate testdir' \ 'am_create_testdir=empty' \ @@ -70,6 +70,6 @@ do_check 'do not create nor chdir in testdir' \ test ! -f t/_self.dir || Exit 1 test ! -r t/_self.dir || Exit 1 grep "self-check-dir\.tap" Makefile || Exit 1 - case `pwd` in '"$cwd"') : ;; *) Exit 1;; esac' + case $(pwd) in '"$cwd"') : ;; *) Exit 1;; esac' : diff --git a/t/self-check-explicit-skips.sh b/t/self-check-explicit-skips.sh index 7a92671de..6fff27eee 100755 --- a/t/self-check-explicit-skips.sh +++ b/t/self-check-explicit-skips.sh @@ -22,7 +22,7 @@ am_create_testdir=empty # We still need a little hack to make ./defs work outside automake's # tree 'tests' subdirectory. Not a big deal. -sed "s|^am_top_builddir=.*|am_top_builddir='`pwd`'|" \ +sed "s|^am_top_builddir=.*|am_top_builddir='$(pwd)'|" \ "$am_top_builddir"/defs-static > defs-static diff "$am_top_builddir"/defs-static defs-static \ && fatal_ "failed to edit defs-static" diff --git a/t/self-check-me.tap b/t/self-check-me.tap index cddc9b5d7..2b720fafa 100755 --- a/t/self-check-me.tap +++ b/t/self-check-me.tap @@ -48,7 +48,7 @@ do_check abc. 'abc\.' # If we override $me, ./defs should not modify it. -s=`$AM_TEST_RUNNER_SHELL -c 'me=foo.sh && . ./defs && echo me=$me' bad.sh` +s=$($AM_TEST_RUNNER_SHELL -c 'me=foo.sh && . ./defs && echo me=$me' bad.sh) command_ok_ "override of \$me before ./defs causes no error" \ test $? -eq 0 diff --git a/t/self-check-reexec.tap b/t/self-check-reexec.tap index e19a6814b..63d3d0968 100755 --- a/t/self-check-reexec.tap +++ b/t/self-check-reexec.tap @@ -25,7 +25,7 @@ plan_ 32 unset AM_TESTS_REEXEC BASH_VERSION || : -cwd=`pwd` || fatal_ "cannot get current working directory" +cwd=$(pwd) || fatal_ "getting current working directory" cp "$am_top_builddir"/defs . || fatal_ "fetching 'defs' from top_builddir" # diff --git a/t/self-check-sanity.sh b/t/self-check-sanity.sh index 8e31afa1c..508f0c7e3 100755 --- a/t/self-check-sanity.sh +++ b/t/self-check-sanity.sh @@ -62,7 +62,7 @@ fi # We still need a little hack to make ./defs work outside automake's # tree 'tests' subdirectory. Not a big deal. -sed "s|^am_top_builddir=.*|am_top_builddir='`pwd`'|" \ +sed "s|^am_top_builddir=.*|am_top_builddir='$(pwd)'|" \ "$am_top_builddir"/defs-static > defs-static # Redefining *srcdir and *builddir variables in the environment shouldn't # cause problems diff --git a/t/self-check-seq.tap b/t/self-check-seq.tap index a92230ea5..8162a4ebe 100755 --- a/t/self-check-seq.tap +++ b/t/self-check-seq.tap @@ -26,7 +26,7 @@ unset stderr_fileno_ || : check_work () { desc=$1 args=$2 exp=$3 - st=0; got=`seq_ $args` || st=$? + st=0; got=$(seq_ $args) || st=$? command_ok_ "$desc [exit status = 0]" test $st -eq 0 command_ok_ "$desc [output]" test x"$exp" = x"$got" } diff --git a/t/silent-many-gcc.sh b/t/silent-many-gcc.sh index 8b457caaf..b418ae9ce 100755 --- a/t/silent-many-gcc.sh +++ b/t/silent-many-gcc.sh @@ -58,7 +58,7 @@ do_and_check_silent_build () grep 'CXXLD .*baz' stdout grep 'CCLD .*bla' stdout - if $rebuild; then :; else + if ! $rebuild; then grep 'YACC .*foo6\.' stdout grep 'YACC .*baz6\.' stdout grep 'LEX .*foo5\.' stdout @@ -84,7 +84,7 @@ do_and_check_verbose_build () $EGREP '(CC|CXX|FC|F77|LD) ' stdout && Exit 1 - if $rebuild; then :; else + if ! $rebuild; then grep 'ylwrap ' stdout $EGREP '(LEX|YACC) ' stdout && Exit 1 fi diff --git a/t/silent-many-generic.sh b/t/silent-many-generic.sh index 394900978..242c8fe07 100755 --- a/t/silent-many-generic.sh +++ b/t/silent-many-generic.sh @@ -59,7 +59,7 @@ do_and_check_silent_build () grep 'CXXLD .*baz' stdout grep 'CCLD .*bla' stdout - if $rebuild; then :; else + if ! $rebuild; then grep 'YACC .*foo6\.' stdout grep 'YACC .*baz6\.' stdout grep 'LEX .*foo5\.' stdout @@ -85,7 +85,7 @@ do_and_check_verbose_build () $EGREP '(CC|CXX|FC|F77|LD) ' stdout && Exit 1 - if $rebuild; then :; else + if ! $rebuild; then grep 'ylwrap ' stdout $EGREP '(LEX|YACC) ' stdout && Exit 1 fi @@ -216,7 +216,7 @@ cp foo6.y sub/baz6.y mkdir bin saved_PATH=$PATH; export saved_PATH -PATH=`pwd`/bin$PATH_SEPARATOR$PATH; export PATH +PATH=$(pwd)/bin$PATH_SEPARATOR$PATH; export PATH $ACLOCAL $AUTOMAKE --add-missing diff --git a/t/specflg6.sh b/t/specflg6.sh index f420cdfd2..5566ae31b 100755 --- a/t/specflg6.sh +++ b/t/specflg6.sh @@ -41,7 +41,7 @@ END $ACLOCAL $AUTOMAKE -uncondval=`$FGREP 'foo-foo.o: foo.c' Makefile.in` +uncondval=$($FGREP 'foo-foo.o: foo.c' Makefile.in) cat >> Makefile.am << 'END' foo_SOURCES += $(BAR_SRCS) @@ -49,7 +49,7 @@ END $AUTOMAKE -condval=`$FGREP 'foo-foo.o: foo.c' Makefile.in` +condval=$($FGREP 'foo-foo.o: foo.c' Makefile.in) test "x$uncondval" = "x$condval" diff --git a/t/specflg7.sh b/t/specflg7.sh index 26ad75cf5..8caf93018 100755 --- a/t/specflg7.sh +++ b/t/specflg7.sh @@ -58,7 +58,7 @@ $MAKE ./true | grep true ./false | grep false -objext=`sed -n -e 's/^OBJEXT = //p' < Makefile` +objext=$(sed -n -e 's/^OBJEXT = //p' < Makefile) test -f ./t-false.$objext test -f ./f-false.$objext diff --git a/t/specflg8.sh b/t/specflg8.sh index 435ce1624..d0c198f04 100755 --- a/t/specflg8.sh +++ b/t/specflg8.sh @@ -57,7 +57,7 @@ $MAKE ./true ./false && Exit 1 -objext=`sed -n -e 's/^OBJEXT = //p' < Makefile` +objext=$(sed -n -e 's/^OBJEXT = //p' < Makefile) test -f ./true-true.$objext test -f ./false-true.$objext @@ -80,18 +80,18 @@ touch b c $sleep : > a $MAKE -test "`cat a`" = '' +test x"$(cat a)" = x $sleep touch b $MAKE -test "`cat a`" = rule1 +test "$(cat a)" = "rule1" # Ensure a is strictly newer than b, so HP-UX make does not execute rule2. $sleep : > a $sleep touch c $MAKE -test "`cat a`" = rule2 +test "$(cat a)" = "rule2" # Unfortunately, the following is not portable to FreeBSD/NetBSD/OpenBSD # make, see explanation above. diff --git a/t/stdlib.sh b/t/stdlib.sh index 1594707c5..d2268d209 100755 --- a/t/stdlib.sh +++ b/t/stdlib.sh @@ -41,12 +41,11 @@ END $ACLOCAL AUTOMAKE_fails -q="[\`'\"]" badname='not a standard library name' # We're specifically testing for line-number information. -grep "^Makefile\\.am:1:.*${q}sub/foo${q}.*$badname" stderr +grep "^Makefile\\.am:1:.*'sub/foo'.*$badname" stderr grep "^Makefile\\.am:1:.*sub/libfoo\\.a" stderr -grep "^foo\\.mk:5:.*${q}zardoz\\.a${q}.*$badname" stderr +grep "^foo\\.mk:5:.*'zardoz\\.a'.*$badname" stderr grep "^foo\\.mk:5:.*libzardoz\\.a" stderr : diff --git a/t/strip.sh b/t/strip.sh index dfefcd9c2..abc2c86aa 100755 --- a/t/strip.sh +++ b/t/strip.sh @@ -41,7 +41,7 @@ $ACLOCAL $AUTOCONF $AUTOMAKE -a -prefix=`cd install && pwd` || Exit 1 +prefix=$(cd install && pwd) || Exit 99 ./configure --prefix="$prefix" $MAKE $MAKE install-strip diff --git a/t/strip2.sh b/t/strip2.sh index 49a5c066c..9c43496f7 100755 --- a/t/strip2.sh +++ b/t/strip2.sh @@ -15,7 +15,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # Ensure install-strip works when STRIP consists of more than one word. -# This test needs GNU binutils strip. See sister test strip3. +# This test needs GNU binutils strip. See sister test 'strip3.sh'. required='cc strip' . ./defs || Exit 1 @@ -32,21 +32,14 @@ bin_PROGRAMS = foo lib_LIBRARIES = libfoo.a END -cat > foo.c << 'END' -int main () { return 0; } -END - -cat > libfoo.c << 'END' -int foo () { return 0; } -END - +echo 'int main (void) { return 0; }' > foo.c +echo 'int foo (void) { return 0; }' > libfoo.c $ACLOCAL $AUTOCONF $AUTOMAKE -a -prefix=`pwd`/inst -./configure --prefix="$prefix" STRIP='strip --verbose' +./configure --prefix="$(pwd)/inst" STRIP='strip --verbose' $MAKE $MAKE install-strip diff --git a/t/strip3.sh b/t/strip3.sh index 187e8a58e..897901610 100755 --- a/t/strip3.sh +++ b/t/strip3.sh @@ -15,7 +15,8 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # Ensure install-strip works when STRIP consists of more than one word. -# This test needs GNU binutils strip. Libtool variant. +# This test needs GNU binutils strip. Libtool variant. See sister +# test 'strip2.sh'. required='cc libtoolize strip' . ./defs || Exit 1 @@ -32,21 +33,15 @@ bin_PROGRAMS = foo lib_LTLIBRARIES = libfoo.la END -cat > foo.c << 'END' -int main () { return 0; } -END - -cat > libfoo.c << 'END' -int foo () { return 0; } -END +echo 'int main (void) { return 0; }' > foo.c +echo 'int foo (void) { return 0; }' > libfoo.c libtoolize $ACLOCAL $AUTOCONF $AUTOMAKE -a -prefix=`pwd`/inst -./configure --prefix="$prefix" STRIP='strip --verbose' +./configure --prefix="$(pwd)/inst" STRIP='strip --verbose' $MAKE $MAKE install-strip diff --git a/t/subobj-clean-lt-pr10697.sh b/t/subobj-clean-lt-pr10697.sh index cfebc998d..4d8b18cf7 100755 --- a/t/subobj-clean-lt-pr10697.sh +++ b/t/subobj-clean-lt-pr10697.sh @@ -33,18 +33,16 @@ AC_OUTPUT END oPATH=$PATH -ocwd=`pwd` || fatal_ "getting current working directory" +ocwd=$(pwd) || fatal_ "getting current working directory" # An rm(1) wrapper that fails when invoked too many times. mkdir rm-wrap max_rm_invocations=6 count_file=$ocwd/rm-wrap/count cat > rm-wrap/rm <<END -#!/bin/sh -set -e -count=\`cat '$count_file'\` -count=\`expr \$count + 1\` -if test \$count -le $max_rm_invocations; then :; else +#!$AM_TEST_RUNNER_SHELL -e +count=\$((\$(cat '$count_file') + 1)) +if ! test \$count -le $max_rm_invocations; then echo "rm invoked more than $max_rm_invocations times" >&2 exit 1 fi diff --git a/t/subobj-clean-pr10697.sh b/t/subobj-clean-pr10697.sh index 69abc107b..a545658f7 100755 --- a/t/subobj-clean-pr10697.sh +++ b/t/subobj-clean-pr10697.sh @@ -34,21 +34,19 @@ END echo "OBJEXT='@OBJEXT@'" > get-objext.in oPATH=$PATH -ocwd=`pwd` || fatal_ "getting current working directory" +ocwd=$(pwd) || fatal_ "getting current working directory" # An rm(1) wrapper that fails when invoked too many times. mkdir rm-wrap max_rm_invocations=3 count_file=$ocwd/rm-wrap/count cat > rm-wrap/rm <<END -#!/bin/sh -set -e -count=\`cat '$count_file'\` -count=\`expr \$count + 1\` -if test \$count -le $max_rm_invocations; then :; else +#!$AM_TEST_RUNNER_SHELL -e +count=\$((\$(cat '$count_file') + 1)) +test \$count -le $max_rm_invocations || { echo "rm invoked more than $max_rm_invocations times" >&2 exit 1 -fi +} echo "\$count" > '$count_file' PATH='$oPATH'; export PATH exec rm "\$@" diff --git a/t/subobj11a.sh b/t/subobj11a.sh index 461325af2..aeb4fa957 100755 --- a/t/subobj11a.sh +++ b/t/subobj11a.sh @@ -57,7 +57,7 @@ $AUTOMAKE -a ./configure --enable-dependency-tracking -depdir=`sed -n 's/^ *DEPDIR *= *//p' Makefile` +depdir=$(sed -n 's/^ *DEPDIR *= *//p' Makefile) if test x"$depdir" != x; then depdir=src/$depdir else diff --git a/t/subobj11b.sh b/t/subobj11b.sh index 129b6ea61..eef884f02 100755 --- a/t/subobj11b.sh +++ b/t/subobj11b.sh @@ -69,7 +69,7 @@ grep 'include.*//.*foobar' Makefile.in && Exit 1 # internals are changed. for x in zardoz0 zardoz1 path/to/zardoz2 another/path/to/zardoz3; do case $x in - */*) d=`echo $x | sed 's,[^/]*$,,'`; b=`echo $x | sed 's,^.*/,,'`;; + */*) d=$(echo $x | sed 's,[^/]*$,,'); b=$(echo $x | sed 's,^.*/,,');; *) d=''; b=$x;; esac # Be a little lax in the regexp, to account for automake conditionals, diff --git a/t/subobj9.sh b/t/subobj9.sh index f706edf4d..6964a80cc 100755 --- a/t/subobj9.sh +++ b/t/subobj9.sh @@ -37,7 +37,7 @@ END cat > Makefile.am << 'END' noinst_LTLIBRARIES = libfoo.la -libfoo_la_SOURCES = src/foo.cc .//src/bar.cc # The `.//' is meant. +libfoo_la_SOURCES = src/foo.cc .//src/bar.cc # The './/' is meant. .PHONY: print print: @echo BEG1: "$(LTCXXCOMPILE)" :1END diff --git a/t/subobjname.sh b/t/subobjname.sh index bef3bf0bd..9d3b63de3 100755 --- a/t/subobjname.sh +++ b/t/subobjname.sh @@ -59,14 +59,14 @@ grep '^am_c_OBJECTS = ' Makefile.in grep '^am_d_OBJECTS = ' Makefile.in # Now the actual test. Are both values equal? -cobj=`sed -n '/^am_c_OBJECTS = / { - s/.* = \(.*\)$/\1/ - p - }' Makefile.in` -dobj=`sed -n '/^am_d_OBJECTS = / { - s/^.* = \(.*\)$/\1/ - p - }' Makefile.in` +cobj=$(sed -n '/^am_c_OBJECTS = / { + s/.* = \(.*\)$/\1/ + p + }' Makefile.in) +dobj=$(sed -n '/^am_d_OBJECTS = / { + s/^.* = \(.*\)$/\1/ + p + }' Makefile.in) test "$cobj" = "$dobj" : diff --git a/t/subst-no-trailing-empty-line.sh b/t/subst-no-trailing-empty-line.sh index 2069e3a1c..aed52bcd7 100755 --- a/t/subst-no-trailing-empty-line.sh +++ b/t/subst-no-trailing-empty-line.sh @@ -70,7 +70,7 @@ $AUTOMAKE # For debugging. $EGREP -n 'ABCD|am__empty' Makefile.in # Sanity check. -test `$EGREP -c "^[ $tab]*@$v2@ @$v3@[ $tab]*$bs?$" Makefile.in` -eq 3 +test $($EGREP -c "^[ $tab]*@$v2@ @$v3@[ $tab]*$bs?$" Makefile.in) -eq 3 ./configure { diff --git a/t/subst3.sh b/t/subst3.sh index cc81063e3..f20133614 100755 --- a/t/subst3.sh +++ b/t/subst3.sh @@ -23,7 +23,7 @@ cat >> configure.ac <<'EOF' AC_PROG_CC AM_PROG_AR AC_PROG_RANLIB -if test -n "$doit"; then +if test x"$doit" = x"yes"; then AC_SUBST([basehdr], [sub/base.h]) AC_SUBST([nobasehdr], [sub/nobase.h]) AC_SUBST([basedata], [sub/base.dat]) @@ -139,7 +139,7 @@ rm -f install-sh $ACLOCAL $AUTOCONF $AUTOMAKE -a --copy -./configure --prefix "`pwd`/inst" --program-prefix=p doit=yes +./configure --prefix "$(pwd)/inst" --program-prefix=p doit=yes $MAKE $MAKE test-install-data @@ -147,9 +147,9 @@ $MAKE test-install-exec $MAKE uninstall $MAKE clean -test `find inst/foo -type f -print | wc -l` = 0 +test $(find inst/foo -type f -print | wc -l) -eq 0 -./configure --prefix "`pwd`/inst" --program-prefix=p doit= +./configure --prefix "$(pwd)/inst" --program-prefix=p doit=no $MAKE $MAKE test-install-nothing-data @@ -162,14 +162,14 @@ $MAKE uninstall $MAKE distclean mkdir build cd build -../configure --prefix "`pwd`/inst" --program-prefix=p doit=yes +../configure --prefix "$(pwd)/inst" --program-prefix=p doit=yes $MAKE $MAKE test-install-data $MAKE test-install-exec $MAKE uninstall -test `find inst/foo -type f -print | wc -l` = 0 +test $(find inst/foo -type f -print | wc -l) -eq 0 -../configure --prefix "`pwd`/inst" --program-prefix=p doit= +../configure --prefix "$(pwd)/inst" --program-prefix=p doit=no $MAKE $MAKE test-install-nothing-data $MAKE test-install-nothing-exec diff --git a/t/substtarg.sh b/t/substtarg.sh index 2e695f843..5fd4f826a 100755 --- a/t/substtarg.sh +++ b/t/substtarg.sh @@ -46,5 +46,6 @@ $ACLOCAL AUTOMAKE_fails grep 'overrid.*libfake@SUBST@.a' stderr $AUTOMAKE -Wno-override -num=`grep '^libfake@SUBST@.a:' Makefile.in | wc -l` -test $num -eq 1 +test $(grep -c '^libfake@SUBST@.a:' Makefile.in) -eq 1 + +: diff --git a/t/suffix.sh b/t/suffix.sh index 600aedf1e..899118de0 100755 --- a/t/suffix.sh +++ b/t/suffix.sh @@ -46,13 +46,13 @@ for use_arlib in false :; do $AUTOMAKE $am_warns -i grep '^ *\.c' Makefile.in # For debugging. - test `grep -c '^\.c\.o:' Makefile.in` -eq 1 - test `grep -c '^\.c\.obj:' Makefile.in` -eq 1 + test $(grep -c '^\.c\.o:' Makefile.in) -eq 1 + test $(grep -c '^\.c\.obj:' Makefile.in) -eq 1 $AUTOMAKE $am_warns grep '^ *\.c' Makefile.in # For debugging. - test `grep -c '^\.c\.o:' Makefile.in` -eq 1 - test `grep -c '^\.c\.obj:' Makefile.in` -eq 1 + test $(grep -c '^\.c\.o:' Makefile.in) -eq 1 + test $(grep -c '^\.c\.obj:' Makefile.in) -eq 1 done diff --git a/t/suffix2.sh b/t/suffix2.sh index 6dd26164d..5bf24d3b1 100755 --- a/t/suffix2.sh +++ b/t/suffix2.sh @@ -43,12 +43,12 @@ $ACLOCAL $AUTOMAKE -a grep '^ *\.c' Makefile.in # For debugging. -test `grep -c '^\.c\.o:' Makefile.in` -eq 1 -test `grep -c '^\.c\.obj:' Makefile.in` -eq 1 +test $(grep -c '^\.c\.o:' Makefile.in) -eq 1 +test $(grep -c '^\.c\.obj:' Makefile.in) -eq 1 $AUTOMAKE -i grep '^ *\.c' Makefile.in # For debugging. -test `grep -c '^\.c\.o:' Makefile.in` -eq 1 -test `grep -c '^\.c\.obj:' Makefile.in` -eq 1 +test $(grep -c '^\.c\.o:' Makefile.in) -eq 1 +test $(grep -c '^\.c\.obj:' Makefile.in) -eq 1 : diff --git a/t/symlink.sh b/t/symlink.sh index f4b4338d8..b57f02a43 100755 --- a/t/symlink.sh +++ b/t/symlink.sh @@ -35,6 +35,6 @@ AUTOMAKE_fails --add-missing grep '^configure\.ac:3: .*missing.*error while making link' stderr grep '^configure\.ac:3: .*install-sh.*error while making link' stderr -test `$FGREP -c 'error while making link' stderr` -eq 2 +test $(grep -c 'error while making link' stderr) -eq 2 : diff --git a/t/tap-bailout-suppress-later-errors.sh b/t/tap-bailout-suppress-later-errors.sh index ff8388726..bbdd54218 100755 --- a/t/tap-bailout-suppress-later-errors.sh +++ b/t/tap-bailout-suppress-later-errors.sh @@ -66,8 +66,8 @@ grep '^PASS: baz\.test 1$' stdout $FGREP 'Not seen' stdout && Exit 1 -test `$FGREP -c ': foo.test' stdout` -eq 1 -test `$FGREP -c ': bar.test' stdout` -eq 2 -test `$FGREP -c ': baz.test' stdout` -eq 2 +test $($FGREP -c ': foo.test' stdout) -eq 1 +test $($FGREP -c ': bar.test' stdout) -eq 2 +test $($FGREP -c ': baz.test' stdout) -eq 2 : diff --git a/t/tap-basic.sh b/t/tap-basic.sh index c19c326b7..2e12e6ec0 100755 --- a/t/tap-basic.sh +++ b/t/tap-basic.sh @@ -138,7 +138,7 @@ test -f test-suite.log grep '^ERROR: bail\.test - Bail out!' stdout grep '^PASS:' stdout && Exit 1 -test `$FGREP -c ': bail.test' stdout` -eq 1 +test $($FGREP -c ': bail.test' stdout) -eq 1 $FGREP 'success.test' stdout && Exit 1 # Override TEST_LOGS from the command line, making it point to a test diff --git a/t/tap-diagnostic-custom.sh b/t/tap-diagnostic-custom.sh index c90f46fe0..fc2d36acf 100755 --- a/t/tap-diagnostic-custom.sh +++ b/t/tap-diagnostic-custom.sh @@ -57,7 +57,7 @@ for string in \ '## leave its behaviour in this context undefined for the moment.' do case $string in '##'*) continue;; esac - i=`expr $i + 1` + i=$(($i + 1)) unindent >> Makefile.am << END TEST_EXTENSIONS += .t$i TESTS += foo$i.t$i diff --git a/t/tap-diagnostic.sh b/t/tap-diagnostic.sh index c849d657d..e23d96b89 100755 --- a/t/tap-diagnostic.sh +++ b/t/tap-diagnostic.sh @@ -118,6 +118,6 @@ grep "^# all.test:${ws0p}bar${ws0p}$" stdout grep "^# all.test:${ws1p}zardoz${ws0p}$" stdout grep "^# all.test:${ws1p}foo bar${tab}baz${ws0p}$" stdout -test `grep -c '^# all\.test:' stdout` -eq 4 +test $(grep -c '^# all\.test:' stdout) -eq 4 : diff --git a/t/tap-fancy.sh b/t/tap-fancy.sh index 846a9d0e6..e17cc78a9 100755 --- a/t/tap-fancy.sh +++ b/t/tap-fancy.sh @@ -24,9 +24,9 @@ # # From manpage Test::Harness::TAP(3): # -# ``Lines written to standard output matching /^(not )?ok\b/ must be +# Lines written to standard output matching /^(not )?ok\b/ must be # interpreted as test lines. All other lines must not be considered -# test output.'' +# test output. # # Unfortunately, the exact format of TODO and SKIP directives is not as # clearly described in that manpage; but a simple reverse-engineering of diff --git a/t/tap-fancy2.sh b/t/tap-fancy2.sh index 6ab67c9f6..4bf014f8a 100755 --- a/t/tap-fancy2.sh +++ b/t/tap-fancy2.sh @@ -24,9 +24,9 @@ # # From manpage Test::Harness::TAP(3): # -# ``Lines written to standard output matching /^(not )?ok\b/ must be +# Lines written to standard output matching /^(not )?ok\b/ must be # interpreted as test lines. All other lines must not be considered -# test output.'' +# test output. # # Unfortunately, the exact format of TODO and SKIP directives is not as # clearly described in that manpage; but a simple reverse-engineering of @@ -108,7 +108,7 @@ xfail=130 # = 4 * 34 - 6 xpass=130 # = 4 * 34 - 6 skip=130 # = 4 * 34 - 6 error=0 -total=`expr $pass + $fail + $xfail + $xpass + $skip` +total=$(($pass + $fail + $xfail + $xpass + $skip)) # Even nastier! But accordingly to the specifics, it should still work. for result in 'ok' 'not ok'; do @@ -117,10 +117,10 @@ done echo "ok{[(<#${tab}SKIP>)]}" >> all.test # We have to update some test counts. -xfail=`expr $xfail + 1` -xpass=`expr $xpass + 1` -skip=`expr $skip + 1` -total=`expr $total + 3` +xfail=$(($xfail + 1)) +xpass=$(($xpass + 1)) +skip=$(($skip + 1)) +total=$(($total + 3)) # And add the test plan! echo 1..$total >> all.test diff --git a/t/tap-global-log.sh b/t/tap-global-log.sh index 29e582c3f..493a5a46d 100755 --- a/t/tap-global-log.sh +++ b/t/tap-global-log.sh @@ -102,7 +102,7 @@ cat > skipall.test << 'END' END # We don't care about the exit status of "make check" here. -TESTS="`echo *.test`" $MAKE -e check || : +TESTS="$(echo *.test)" $MAKE -e check || : cat test-suite.log grep ':.*ok|not seen' test-suite.log && Exit 1 diff --git a/t/tap-global-result.sh b/t/tap-global-result.sh index 30215c714..6d7a4dd27 100755 --- a/t/tap-global-result.sh +++ b/t/tap-global-result.sh @@ -138,13 +138,13 @@ ok 4 # TODO Bail out! END -tests=`echo *.test` # Also required later. +tests=$(echo *.test) # Also required later. TESTS="$tests" $MAKE -e check >stdout && { cat stdout; Exit 1; } cat stdout # Dirty trick required here. -for tst in `echo " $tests " | sed 's/.test / /'`; do +for tst in $(echo " $tests " | sed 's/\.test / /'); do echo :copy-in-global-log: yes >> $tst.trs done @@ -154,7 +154,7 @@ cat test-suite.log have_rst_section () { - eqeq=`echo "$1" | sed 's/./=/g'` + eqeq=$(echo "$1" | sed 's/./=/g') # Assume $1 contains no RE metacharacters. sed -n "/^$1$/,/^$eqeq$/p" test-suite.log > got (echo "$1" && echo "$eqeq") > exp diff --git a/t/tap-log.sh b/t/tap-log.sh index 5faf83894..92d63ec01 100755 --- a/t/tap-log.sh +++ b/t/tap-log.sh @@ -103,8 +103,8 @@ for result in xfail fail xpass skip error; do $FGREP "$pmarker $result $pmarker" my.log || st=1 $FGREP "$cmarker $result $cmarker" my.log || st=1 done -test `$FGREP -c "$pmarker" my.log` -eq 5 -test `$FGREP -c "$cmarker" my.log` -eq 5 +test $($FGREP -c "$pmarker" my.log) -eq 5 +test $($FGREP -c "$cmarker" my.log) -eq 5 # Passed test scripts shouldn't be mentioned in the global log. $EGREP '(^pass|[^x]pass)\.test' my.log && Exit 1 @@ -139,8 +139,8 @@ test ! -f my.log test ! -f test-suite.log # Check that VERBOSE causes the global testsuite log to be # emitted on stdout. -out=`cat stdout` -log=`cat global.log` +out=$(cat stdout) +log=$(cat global.log) case $out in *"$log"*) ;; *) Exit 1;; esac touch error2.log test-suite.log my.log diff --git a/t/tap-more.sh b/t/tap-more.sh index 7970d7f80..baa7e2807 100755 --- a/t/tap-more.sh +++ b/t/tap-more.sh @@ -127,14 +127,14 @@ for try in 0 1; do count_test_results total=6 pass=4 fail=0 xpass=0 xfail=1 skip=1 error=0 grep '^PASS: 1\.test 1 - mu$' stdout grep '^SKIP: 1\.test 2 zardoz # SKIP$' stdout - test `$FGREP -c '1.test' stdout` -eq 2 + test $(grep -c '1\.test' stdout) -eq 2 grep '^PASS: 2\.test 1$' stdout grep '^XFAIL: 2\.test 2 # TODO not implemented$' stdout grep '^PASS: 2\.test 3$' stdout - test `$FGREP -c '2.test' stdout` -eq 3 + test $(grep -c '2\.test' stdout) -eq 3 grep '^PASS: 3\.test 1 - blah blah blah$' stdout grep '^# 3\.test: Some diagnostic$' stdout - test `$FGREP -c '3.test' stdout` -eq 2 + test $(grep -c '3\.test' stdout) -eq 2 # Failure. @@ -152,15 +152,15 @@ for try in 0 1; do count_test_results total=7 pass=4 fail=1 xpass=0 xfail=1 skip=0 error=1 grep '^PASS: 1\.test 1 - mu$' stdout grep '^FAIL: 1\.test 2 zardoz$' stdout - test `$FGREP -c '1.test' stdout` -eq 2 + test $(grep -c '1\.test' stdout) -eq 2 grep '^PASS: 2\.test 1$' stdout grep '^XFAIL: 2\.test 2 # TODO not implemented$' stdout grep '^PASS: 2\.test 3$' stdout - test `$FGREP -c '2.test' stdout` -eq 3 + test $(grep -c '2\.test' stdout) -eq 3 grep '^PASS: 3\.test 1 - blah blah blah$' stdout grep '^# 3\.test: Some diagnostic$' stdout grep '^ERROR: 3\.test - Bail out! Kernel Panic$' stdout - test `$FGREP -c '3.test' stdout` -eq 3 + test $(grep -c '3\.test' stdout) -eq 3 cd $srcdir diff --git a/t/tap-no-spurious-numbers.sh b/t/tap-no-spurious-numbers.sh index 4cdace02b..0c07510a7 100755 --- a/t/tap-no-spurious-numbers.sh +++ b/t/tap-no-spurious-numbers.sh @@ -57,16 +57,16 @@ $ > END -n=`wc -l <prefixes` +n=$(wc -l <prefixes) # See the loop below to understand this initialization. -pass=`expr $n '*' 3` +pass=$(($n * 3)) fail=$pass -skip=`expr $pass - 3` +skip=$(($pass - 3)) xfail=$skip xpass=$xfail error=0 -total=`expr $pass + $fail + $skip + $xfail + $xpass` +total=$(($pass + $fail + $skip + $xfail + $xpass)) echo 1..$total > all.test @@ -86,8 +86,10 @@ done >> all.test cat all.test # For debugging. # Sanity checks. -grep '#.*#' all.test && framework_failure_ "creating all.test" -test `wc -l <all.test` -lt $highno || framework_failure_ "creating all.test" +grep '#.*#' all.test \ + && framework_failure_ "creating all.test" +test $(wc -l <all.test) -lt $highno \ + || framework_failure_ "creating all.test" $MAKE check >stdout || : cat stdout diff --git a/t/tap-no-spurious.sh b/t/tap-no-spurious.sh index b9bca21fb..ea2993d43 100755 --- a/t/tap-no-spurious.sh +++ b/t/tap-no-spurious.sh @@ -36,9 +36,9 @@ END # According to documentation of Test::Harness::TAP(3): # -# ``Lines written to standard output matching /^(not )?ok\b/ +# Lines written to standard output matching /^(not )?ok\b/ # must be interpreted as test lines. All other lines must -# not be considered test output.'' +# not be considered test output. cat >> all.test <<END ok @@ -98,11 +98,11 @@ Bail out # Bail out! END -cat all.test # For debugging. -# Minor sanity check. -test `grep -c '^ok1$' all.test` -eq 1 \ - && test `grep -c '^not ok1$' all.test` -eq 1 \ +# Debugging info and minor sanity check. +cat all.test \ + && test $(grep -c '^ok1$' all.test) -eq 1 \ + && test $(grep -c '^not ok1$' all.test) -eq 1 \ || framework_failure_ "creating all.test" $MAKE check >stdout || { cat stdout; Exit 1; } diff --git a/t/tap-number-wordboundary.sh b/t/tap-number-wordboundary.sh index 324adb627..bd1bf8d78 100755 --- a/t/tap-number-wordboundary.sh +++ b/t/tap-number-wordboundary.sh @@ -93,7 +93,7 @@ $ END # Strip any extra whitespace, for Solaris' wc. -planned=`wc -l <punctuation | tr -d " $tab"` +planned=$(wc -l <punctuation | tr -d " $tab") echo 1..$planned > all.test awk '{print "ok " NR $0 }' punctuation >> all.test diff --git a/t/tap-out-of-order.sh b/t/tap-out-of-order.sh index 9e3d755fa..20bba0a59 100755 --- a/t/tap-out-of-order.sh +++ b/t/tap-out-of-order.sh @@ -63,10 +63,10 @@ cat stdout count_test_results total=17 pass=8 fail=0 xpass=0 xfail=1 skip=0 error=8 -test `$FGREP -c ': a.test' stdout` -eq 3 -test `$FGREP -c ': b.test' stdout` -eq 5 -test `$FGREP -c ': c.test' stdout` -eq 4 -test `$FGREP -c ': d.test' stdout` -eq 5 +test $($FGREP -c ': a.test' stdout) -eq 3 +test $($FGREP -c ': b.test' stdout) -eq 5 +test $($FGREP -c ': c.test' stdout) -eq 4 +test $($FGREP -c ': d.test' stdout) -eq 5 grep '^ERROR: a\.test 71 # OUT-OF-ORDER (expecting 3)$' stdout grep '^ERROR: b\.test 4 foo # OUT-OF-ORDER (expecting 3)$' stdout diff --git a/t/tap-plan-malformed.sh b/t/tap-plan-malformed.sh index 8aca466a5..99fd8c583 100755 --- a/t/tap-plan-malformed.sh +++ b/t/tap-plan-malformed.sh @@ -45,7 +45,7 @@ cat > e.test <<END 0..0 END -tests_list=`echo *.test` +tests_list=$(echo *.test) TESTS="$tests_list" $MAKE -e check >stdout && { cat stdout; Exit 1; } cat stdout diff --git a/t/tap-plan-middle.sh b/t/tap-plan-middle.sh index 1c752fc75..3a63821cf 100755 --- a/t/tap-plan-middle.sh +++ b/t/tap-plan-middle.sh @@ -70,7 +70,7 @@ ok 4 # SKIP END -tests=`echo *.test` +tests=$(echo *.test) for tap_flags in "" "--comments"; do env TEST_LOG_DRIVER_FLAGS="$tap_flags" TESTS="$tests" \ diff --git a/t/tap-planskip-case-insensitive.sh b/t/tap-planskip-case-insensitive.sh index 9de6bc509..f53534c48 100755 --- a/t/tap-planskip-case-insensitive.sh +++ b/t/tap-planskip-case-insensitive.sh @@ -21,19 +21,18 @@ . "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh" -# These nested loops are clearer without indentation. - +# These nested loops below are clearer without indentation. i=0 for c1 in s S; do for c2 in k K; do for c3 in i I; do for c4 in p P; do - i=`expr $i + 1` - case $i in ?) i=0$i; esac - echo "1..0 # $c1$c2$c3$c4 foobar" > $i.test + i=$(($i + 1)) + case $i in ?) j=0$i;; *) j=$i;; esac + echo "1..0 # $c1$c2$c3$c4 foobar" > $j.test done; done; done; done -TESTS="`echo *.test`" $MAKE -e check >stdout || { cat stdout; Exit 1; } +TESTS="$(echo *.test)" $MAKE -e check >stdout || { cat stdout; Exit 1; } cat stdout count_test_results total=16 pass=0 fail=0 xpass=0 xfail=0 skip=16 error=0 diff --git a/t/tap-planskip-late.sh b/t/tap-planskip-late.sh index e0d3513f3..52917d53c 100755 --- a/t/tap-planskip-late.sh +++ b/t/tap-planskip-late.sh @@ -37,7 +37,7 @@ cat stdout grep '^SKIP: foo\.test .* from the last line$' stdout grep '^SKIP: bar\.test$' stdout -test `grep -c ': .*\.test' stdout` -eq 2 +test $(grep -c ': .*\.test' stdout) -eq 2 count_test_results total=2 pass=0 fail=0 xpass=0 xfail=0 skip=2 error=0 : diff --git a/t/tap-planskip-later-errors.sh b/t/tap-planskip-later-errors.sh index 7bf3cb12c..f216f88a3 100755 --- a/t/tap-planskip-later-errors.sh +++ b/t/tap-planskip-later-errors.sh @@ -34,6 +34,6 @@ $MAKE check >stdout && { cat stdout; Exit 1; } cat stdout count_test_results total=4 pass=0 fail=0 xpass=0 xfail=0 skip=1 error=3 -test `grep -c '^ERROR: all\.test - multiple test plans' stdout` -eq 3 +test $(grep -c '^ERROR: all\.test - multiple test plans' stdout) -eq 3 : diff --git a/t/tap-planskip.sh b/t/tap-planskip.sh index 142afd7a8..2c1d9debc 100755 --- a/t/tap-planskip.sh +++ b/t/tap-planskip.sh @@ -72,6 +72,6 @@ grep '^SKIP: baz\.test' stdout # Deliberately laxer, see above for why. grep '^SKIP: wget\.test .* wget(1) not installed$' stdout grep '^SKIP: curl\.test .* Can'\''t connect to gnu\.org!$' stdout grep '^SKIP: mu\.test' stdout | $FGREP "$weirdchars" stdout -test `grep -c ': .*\.test' stdout` -eq 6 +test $(grep -c ': .*\.test' stdout) -eq 6 : diff --git a/t/tap-realtime.sh b/t/tap-realtime.sh index d874b0c2c..2cad91ca1 100755 --- a/t/tap-realtime.sh +++ b/t/tap-realtime.sh @@ -43,7 +43,7 @@ rm -f expect-check # out its output progressively and "in sync" with test execution -- it is # make that is stowing such output away instead of presenting it to the # user as soon as it gets it. -if using_gmake; then :; else +if ! using_gmake; then case $MAKE in *\ -j*) skip_ "doesn't with non-GNU concurrent make";; esac diff --git a/t/tap-signal.tap b/t/tap-signal.tap index e23deea4c..fce48bf69 100755 --- a/t/tap-signal.tap +++ b/t/tap-signal.tap @@ -60,7 +60,7 @@ for sig in $all_signals; do END echo TESTS += signal-$sig.test >> Makefile.am done -results_count=`ls *.test | wc -l | tr -d "$tab$sp"` +results_count=$(ls *.test | wc -l | tr -d "$tab$sp") chmod a+x *.test @@ -70,7 +70,7 @@ $AUTOMAKE ./configure -system=`uname -s -r || echo unknown` # Needed later. +system=$(uname -s -r || echo unknown) # Needed later. signal_caught () { @@ -120,7 +120,7 @@ command_ok_ '"make check" fails' eval ' cat stdout # For debugging. command_ok_ "count of test results" count_test_results \ - total=`expr $results_count '*' 2` \ + total=$(($results_count * 2)) \ pass=$results_count error=$results_count \ fail=0 xpass=0 xfail=0 skip=0 diff --git a/t/tap-unplanned.sh b/t/tap-unplanned.sh index e8d9dad04..dce485c99 100755 --- a/t/tap-unplanned.sh +++ b/t/tap-unplanned.sh @@ -148,7 +148,7 @@ for x in 'ok' 'ok 3' 'not ok' 'not ok # TODO' 'ok # TODO' 'ok # SKIP'; do END $MAKE check >stdout && { cat stdout; Exit 1; } cat stdout - test `$FGREP -c ': all.test' stdout` -eq 4 + test $($FGREP -c ': all.test' stdout) -eq 4 $EGREP '^PASS: all\.test 1($| )' stdout $EGREP '^SKIP: all\.test 2($| )' stdout $EGREP ': all\.test 3($| )' stdout diff --git a/t/tar-override.sh b/t/tar-override.sh index 641ce861d..0bf8ac737 100755 --- a/t/tar-override.sh +++ b/t/tar-override.sh @@ -21,7 +21,7 @@ . ./defs || Exit 1 -cwd=`pwd` || fatal_ "couldn't get current working directory" +cwd=$(pwd) || fatal_ "getting current working directory" echo AC_OUTPUT >> configure.ac @@ -52,7 +52,7 @@ rm -f *.tar.* *has-run* TAR="$cwd/am--tar foo" $MAKE distcheck test -f $me-1.0.tar.gz -test "`cat am--tar-has-run`" = foo +test "$(cat am--tar-has-run)" = foo rm -f *.tar.* *has-run* @@ -60,6 +60,6 @@ TAR=; unset TAR # Creative use of eval to pacify maintainer checks. eval \$'MAKE dist "TAR=./am--tar mu"' test -f $me-1.0.tar.gz -test "`cat am--tar-has-run`" = mu +test "$(cat am--tar-has-run)" = mu : @@ -31,7 +31,7 @@ $ACLOCAL AUTOMAKE_fails grep "^configure\.ac:2:.*mutually exclusive" stderr > tar-err cat tar-err -test 1 = `wc -l < tar-err` +test 1 -eq $(wc -l < tar-err) grep "'tar-pax'" tar-err grep "'tar-v7'" tar-err diff --git a/t/target-cflags.sh b/t/target-cflags.sh index ad0e94d4f..97a95d893 100755 --- a/t/target-cflags.sh +++ b/t/target-cflags.sh @@ -60,7 +60,7 @@ mkdir build cd build ../configure $MAKE -if cross_compiling; then :; else +if ! cross_compiling; then ./foo ./bar fi @@ -68,7 +68,7 @@ cd .. ./configure $MAKE -if cross_compiling; then :; else +if ! cross_compiling; then ./foo ./bar fi diff --git a/t/test-driver-create-log-dir.sh b/t/test-driver-create-log-dir.sh index dc8e6811f..3b0839708 100755 --- a/t/test-driver-create-log-dir.sh +++ b/t/test-driver-create-log-dir.sh @@ -44,8 +44,8 @@ check-local: $(TEST_SUITE_LOG) test -f sub1/baz.trs END -cat > checkdir-driver <<'END' -#! /bin/sh +echo "#!$AM_TEST_RUNNER_SHELL" > checkdir-driver +cat >> checkdir-driver <<'END' set -e; set -u while test $# -gt 0; do case $1 in @@ -60,8 +60,8 @@ done echo "log: $log_file" # For debugging. echo "trs: $trs_file" # Ditto. case $log_file in */*);; *) exit 1;; esac -dir_log=`expr "$log_file" : '\(.*\)/[^/]*'` -dir_trs=`expr "$trs_file" : '\(.*\)/[^/]*'` +dir_log=${log_file%/*} +dir_trs=${trs_file%/*} echo "dir_log: $dir_log" # For debugging. echo "dir_trs: $dir_trs" # Likewise. test x"$dir_trs" = x"$dir_log" || exit 1 diff --git a/t/test-driver-custom-multitest.sh b/t/test-driver-custom-multitest.sh index c660ec276..28e170081 100755 --- a/t/test-driver-custom-multitest.sh +++ b/t/test-driver-custom-multitest.sh @@ -156,7 +156,7 @@ for vpath in : false; do grep '%% fail2 %%' test-suite.log grep '%% pass-fail %%' test-suite.log grep '%% pass-xpass-fail-xfail-skip-error %%' test-suite.log - test `grep -c '%% ' test-suite.log` -eq 4 + test $(grep -c '%% ' test-suite.log) -eq 4 TESTS='pass.t pass3-skip2-xfail.t' $MAKE -e check >stdout \ || { cat stdout; cat test-suite.log; Exit 1; } diff --git a/t/test-driver-custom-xfail-tests.sh b/t/test-driver-custom-xfail-tests.sh index 14568c096..d8455deab 100755 --- a/t/test-driver-custom-xfail-tests.sh +++ b/t/test-driver-custom-xfail-tests.sh @@ -143,8 +143,8 @@ $AUTOMAKE $MAKE check >stdout || { cat stdout; Exit 1; } cat stdout -test `grep -c '^PASS:' stdout` -eq 3 -test `grep -c '^XFAIL:' stdout` -eq 13 +test $(grep -c '^PASS:' stdout) -eq 3 +test $(grep -c '^XFAIL:' stdout) -eq 13 for dir in sub1 sub2; do cd $dir @@ -152,9 +152,9 @@ for dir in sub1 sub2; do cp x2.test pass.test $MAKE check >stdout && { cat stdout; Exit 1; } cat stdout - test "`cat pass.trs`" = ":test-result: FAIL" - test "`cat x1.trs`" = ":test-result: XPASS" - test "`cat x2.trs`" = ":test-result: XFAIL" + test "$(cat pass.trs)" = ":test-result: FAIL" + test "$(cat x1.trs)" = ":test-result: XPASS" + test "$(cat x2.trs)" = ":test-result: XFAIL" grep '^FAIL: pass\.test$' stdout grep '^XPASS: x1\.test$' stdout grep '^XFAIL: x2\.test$' stdout diff --git a/t/test-driver-custom.sh b/t/test-driver-custom.sh index ce4a7fcdf..d56d661a2 100755 --- a/t/test-driver-custom.sh +++ b/t/test-driver-custom.sh @@ -41,7 +41,7 @@ LOG_DRIVER_FLAGS = _ END mkdir sub bin -PATH=`pwd`/bin$PATH_SEPARATOR$PATH; export PATH +PATH=$(pwd)/bin$PATH_SEPARATOR$PATH; export PATH cat > wrapper.skel <<'END' #! /bin/sh diff --git a/t/test-driver-is-distributed.sh b/t/test-driver-is-distributed.sh index 9b2f08bba..12f9c0b9d 100755 --- a/t/test-driver-is-distributed.sh +++ b/t/test-driver-is-distributed.sh @@ -21,7 +21,7 @@ am_create_testdir=empty . ./defs || Exit 1 -ocwd=`pwd` || fatal_ "getting current working directory" +ocwd=$(pwd) || fatal_ "getting current working directory" do_check () { diff --git a/t/test-driver-strip-vpath.sh b/t/test-driver-strip-vpath.sh index 0f51c3e76..b2d8588cc 100755 --- a/t/test-driver-strip-vpath.sh +++ b/t/test-driver-strip-vpath.sh @@ -19,7 +19,7 @@ . ./defs || Exit 1 -ocwd=`pwd` || fatal_ "cannot get current working directory" +ocwd=$(pwd) || fatal_ "cannot get current working directory" mkdir src build mv install-sh missing configure.ac src diff --git a/t/test-extensions-cond.sh b/t/test-extensions-cond.sh index e081d797b..c8d58ac8b 100755 --- a/t/test-extensions-cond.sh +++ b/t/test-extensions-cond.sh @@ -60,7 +60,7 @@ END for i in 1 2 3; do AUTOMAKE_fails $i - lineno=`sed -n 's/^## lineno //p' $i.am` \ + lineno=$(sed -n 's/^## lineno //p' $i.am) \ && test 0 -lt "$lineno" \ || Exit 99 grep "^$i\\.am:$lineno:.*TEST_EXTENSIONS.*conditional content" stderr diff --git a/t/test-extensions.sh b/t/test-extensions.sh index fa23481ca..c4444899b 100755 --- a/t/test-extensions.sh +++ b/t/test-extensions.sh @@ -39,7 +39,7 @@ $AUTOMAKE -a grep -i 'log' Makefile.in # For debugging. for lc in $valid_extensions; do - uc=`echo $lc | tr '[a-z]' '[A-Z]'` + uc=$(echo $lc | tr '[a-z]' '[A-Z]') $FGREP "\$(${uc}_LOG_COMPILER)" Makefile.in grep "^${uc}_LOG_COMPILE =" Makefile.in grep "^\.${lc}\.log:" Makefile.in @@ -57,7 +57,7 @@ END AUTOMAKE_fails for suf in mu .x-y a-b .t.1 .6c .0 .11 @suf@ .@ext@ '.=' '_&_'; do - suf2=`printf '%s\n' "$suf" | sed -e 's/\./\\./'` + suf2=$(printf '%s\n' "$suf" | sed -e 's/\./\\./') $EGREP "^Makefile\.am:2:.*invalid test extension.* $suf2( |$)" stderr done diff --git a/t/test-log.sh b/t/test-log.sh index 0e6065db2..4a4dec360 100755 --- a/t/test-log.sh +++ b/t/test-log.sh @@ -106,12 +106,12 @@ for result in xfail fail xpass skip error; do $FGREP "$pmarker $result $pmarker" my.log || st=1 $FGREP "$cmarker $result $cmarker" my.log || st=1 done -test `$FGREP -c "$pmarker" my.log` -eq 5 -test `$FGREP -c "$cmarker" my.log` -eq 5 +test $($FGREP -c "$pmarker" my.log) -eq 5 +test $($FGREP -c "$cmarker" my.log) -eq 5 have_rst_section () { - eqeq=`echo "$1" | sed 's/./=/g'` + eqeq=$(echo "$1" | sed 's/./=/g') # Assume $1 contains no RE metacharacters. sed -n "/^$1$/,/^$eqeq$/p" $2 > got (echo "$1" && echo "$eqeq") > exp @@ -153,8 +153,8 @@ test ! -f my.log test ! -f test-suite.log # Check that VERBOSE causes the global testsuite log to be # emitted on stdout. -out=`cat stdout` -log=`cat global.log` +out=$(cat stdout) +log=$(cat global.log) case $out in *"$log"*) ;; *) Exit 1;; esac touch error2.log test-suite.log my.log diff --git a/t/test-metadata-global-result.sh b/t/test-metadata-global-result.sh index 4aa633f3a..d3c05f00f 100755 --- a/t/test-metadata-global-result.sh +++ b/t/test-metadata-global-result.sh @@ -60,7 +60,7 @@ get_escaped_line() have_result () { cat > exp; echo >> exp; echo logloglog >> exp - eline=`get_escaped_line exp` + eline=$(get_escaped_line exp) sed -n -e "/^$eline$/,/^logloglog$/p" test-suite.log > got cat exp; cat got diff exp got diff --git a/t/test-metadata-recheck.sh b/t/test-metadata-recheck.sh index 88747458c..0a106b3fc 100755 --- a/t/test-metadata-recheck.sh +++ b/t/test-metadata-recheck.sh @@ -109,7 +109,7 @@ cat > n-100 <<END :recheck: no END -rechecked=`echo y-[0-9]*` +rechecked=$(echo y-[0-9]*) for t in [yn]-[0-9]*; do echo $t; done \ | sed 's/.*/TESTS += &/' >> Makefile.am diff --git a/t/test-trs-basic.sh b/t/test-trs-basic.sh index 42456b407..b8d13d81d 100755 --- a/t/test-trs-basic.sh +++ b/t/test-trs-basic.sh @@ -68,11 +68,11 @@ for vpath in : false; do $srcdir/configure $MAKE tb - test x"`cat tb`" = x"foo bar sub/zardoz" + test x"$(cat tb)" = x"foo bar sub/zardoz" rm -f tb # Please don't change the order of the stuff in TESTS, below. TESTS='foo.test foo2.sh foo-log foolog.test a.log.b.sh 0.exe' $MAKE -e tb - test x"`cat tb`" = x"foo foo2 foo-log foolog a.log.b 0.exe" + test x"$(cat tb)" = x"foo foo2 foo-log foolog a.log.b 0.exe" rm -f tb cd $srcdir diff --git a/t/testsuite-summary-count.sh b/t/testsuite-summary-count.sh index 1d13e7e6b..8d2ce74d7 100755 --- a/t/testsuite-summary-count.sh +++ b/t/testsuite-summary-count.sh @@ -110,12 +110,12 @@ xpass_count=23 error_count=17 tests_count=120 -pass=` seq_ 1 $pass_count | sed 's/.*/pass-&.t/'` -skip=` seq_ 1 $skip_count | sed 's/.*/skip-&.t/'` -xfail=`seq_ 1 $xfail_count | sed 's/.*/xfail-&.t/'` -fail=` seq_ 1 $fail_count | sed 's/.*/fail-&.t/'` -xpass=`seq_ 1 $xpass_count | sed 's/.*/xpass-&.t/'` -error=`seq_ 1 $error_count | sed 's/.*/error-&.t/'` + pass=$(seq_ 1 $pass_count | sed 's/.*/pass-&.t/') + skip=$(seq_ 1 $skip_count | sed 's/.*/skip-&.t/') +xfail=$(seq_ 1 $xfail_count | sed 's/.*/xfail-&.t/') + fail=$(seq_ 1 $fail_count | sed 's/.*/fail-&.t/') +xpass=$(seq_ 1 $xpass_count | sed 's/.*/xpass-&.t/') +error=$(seq_ 1 $error_count | sed 's/.*/error-&.t/') do_check $pass $skip $xfail $fail $xpass $error <<END $header @@ -139,12 +139,12 @@ fail_count=126 xpass_count=17 error_count=9 -pass=` seq_ 1 $pass_count | sed 's/.*/pass-&.t/'` -skip=` seq_ 1 $skip_count | sed 's/.*/skip-&.t/'` -xfail=`seq_ 1 $xfail_count | sed 's/.*/xfail-&.t/'` -fail=` seq_ 1 $fail_count | sed 's/.*/fail-&.t/'` -xpass=`seq_ 1 $xpass_count | sed 's/.*/xpass-&.t/'` -error=`seq_ 1 $error_count | sed 's/.*/error-&.t/'` + pass=$(seq_ 1 $pass_count | sed 's/.*/pass-&.t/') + skip=$(seq_ 1 $skip_count | sed 's/.*/skip-&.t/') +xfail=$(seq_ 1 $xfail_count | sed 's/.*/xfail-&.t/') + fail=$(seq_ 1 $fail_count | sed 's/.*/fail-&.t/') +xpass=$(seq_ 1 $xpass_count | sed 's/.*/xpass-&.t/') +error=$(seq_ 1 $error_count | sed 's/.*/error-&.t/') do_check $pass $skip $xfail $fail $xpass $error <<END $header diff --git a/t/transform.sh b/t/transform.sh index 7aa958ea0..6a89862bf 100755 --- a/t/transform.sh +++ b/t/transform.sh @@ -50,11 +50,14 @@ $ACLOCAL $AUTOCONF $AUTOMAKE -./configure --program-prefix=gnu- --prefix "`pwd`/inst" --mandir "`pwd`/inst/man" +cwd=$(pwd) || fatal_ "getting current working directory" + +./configure --program-prefix=gnu- --prefix "$cwd/inst" \ + --mandir "$cwd/inst/man" $MAKE $MAKE test-install $MAKE uninstall -test `find inst -type f -print | wc -l` = 0 +test $(find inst -type f -print | wc -l) -eq 0 # Opportunistically test for installdirs. rm -rf inst diff --git a/t/transform2.sh b/t/transform2.sh index a4a94f7a9..357e6b7e1 100755 --- a/t/transform2.sh +++ b/t/transform2.sh @@ -66,17 +66,20 @@ $ACLOCAL $AUTOCONF $AUTOMAKE -./configure --program-transform-name='s/[12]//' --prefix "`pwd`/inst" --mandir "`pwd`/inst/man" +cwd=$(pwd) || fatal_ "getting current working directory" + +./configure --program-transform-name='s/[12]//' --prefix "$cwd/inst" \ + --mandir "$cwd/inst/man" $MAKE $MAKE test-install $MAKE uninstall -test `find inst -type f -print | wc -l` = 0 +test $(find inst -type f -print | wc -l) -eq 0 # Also squash all file types in question. # On newer Cygwin versions, that won't work, likely due to overly # aggressive appending of '.exe' suffix when copying/renaming Windows -# executables). So let's skip this part of the test if we detect the +# executables. So let's skip this part of the test if we detect the # faulty heuristic is present. See also: # <http://lists.gnu.org/archive/html/automake-patches/2010-08/msg00153.html> # <http://thread.gmane.org/gmane.os.cygwin/119380> @@ -86,10 +89,11 @@ chmod a+x foo bar.exe cp foo bar && cmp foo bar \ || skip_ "your Cygwin is too aggressive in tweaking '.exe' suffixes" -./configure --program-transform-name='s/.*/foo/' --prefix "`pwd`/inst" --mandir "`pwd`/inst/man" +./configure --program-transform-name='s/.*/foo/' --prefix "$cwd/inst" \ + --mandir "$cwd/inst/man" $MAKE $MAKE test-install-foo $MAKE uninstall -test `find inst -type f -print | wc -l` = 0 +test $(find inst -type f -print | wc -l) -eq 0 : diff --git a/t/transform3.sh b/t/transform3.sh index 6f1b81179..9efefa25a 100755 --- a/t/transform3.sh +++ b/t/transform3.sh @@ -78,12 +78,12 @@ $ACLOCAL $AUTOCONF $AUTOMAKE -a -./configure --program-prefix=gnu- --prefix "`pwd`/inst" +./configure --program-prefix=gnu- --prefix "$(pwd)/inst" $MAKE test-install $MAKE uninstall -test `find inst -type f -print | wc -l` = 0 +test $(find inst -type f -print | wc -l) -eq 0 # Opportunistically test for installdirs. rm -rf inst diff --git a/t/txinfo19.sh b/t/txinfo19.sh index 63417f8b9..a77c41945 100755 --- a/t/txinfo19.sh +++ b/t/txinfo19.sh @@ -38,7 +38,7 @@ $ACLOCAL $AUTOMAKE --add-missing $AUTOCONF -./configure "--infodir=`pwd`/_inst" +./configure "--infodir=$(pwd)/_inst" $MAKE # Make sure .iNN files are installed. diff --git a/t/txinfo21.sh b/t/txinfo21.sh index 93543a785..6436dd8f0 100755 --- a/t/txinfo21.sh +++ b/t/txinfo21.sh @@ -120,7 +120,8 @@ AM_MAKEINFOHTMLFLAGS = --no-headers --no-split AM_MAKEINFOFLAGS = --unsupported-option EOF $AUTOMAKE -./configure --prefix "`pwd`" +./configure --prefix "$(pwd)" + $MAKE html test -f main.html test -f sub/main2.html diff --git a/t/txinfo26.sh b/t/txinfo26.sh index e336bba79..223a4eaa6 100755 --- a/t/txinfo26.sh +++ b/t/txinfo26.sh @@ -46,15 +46,21 @@ $AUTOCONF $MAKE $MAKE distclean -case `pwd` in +abscwd=$(pwd) || fatal_ "getting current working directory" + +case $abscwd in *\ * | *\ *) skip_ "this test might fail in a directory containing white spaces";; esac mkdir build cd build -../configure "--srcdir=`pwd`/.." "--prefix=`pwd`/_inst" "--infodir=`pwd`/_inst/info" +../configure --srcdir="$abscwd" \ + --prefix="$abscwd/build/_inst" \ + --infodir="$abscwd/build/_inst/info" + $MAKE install + test -f ../main.info test ! -f ./main.info test -f _inst/info/main.info diff --git a/t/txinfo27.sh b/t/txinfo27.sh index 131300ae9..f94c0bcce 100755 --- a/t/txinfo27.sh +++ b/t/txinfo27.sh @@ -41,6 +41,8 @@ $ACLOCAL $AUTOMAKE --add-missing $AUTOCONF -./configure "--prefix=`pwd`/inst" "--infodir=`pwd`/inst/info" +./configure --prefix="$(pwd)/inst" --infodir="$(pwd)/inst/info" $MAKE install-info test -f inst/info/main.info + +: diff --git a/t/txinfo29.sh b/t/txinfo29.sh index a0013d252..eab87dd13 100755 --- a/t/txinfo29.sh +++ b/t/txinfo29.sh @@ -34,7 +34,7 @@ grep 'overrides Automake variable.*INFO_DEPS' stderr $AUTOMAKE -Wno-override # There is only one definition of INFO_DEPS ... -test 1 = `grep '^INFO_DEPS.*=' Makefile.in | wc -l` +test 1 -eq $(grep -c '^INFO_DEPS.*=' Makefile.in) # ... and it is the right one. grep '^INFO_DEPS *= *foo.info *$' Makefile.in @@ -55,7 +55,7 @@ grep 'overrides Automake variable.*INFO_DEPS' stderr $AUTOMAKE -Wno-override # There is only one definition of INFO_DEPS ... -test 1 = `grep '^INFO_DEPS.*=' Makefile.in | wc -l` +test 1 -eq $(grep -c '^INFO_DEPS.*=' Makefile.in) # ... and it is the right one. grep '^INFO_DEPS *= *@INFO_DEPS@ *$' Makefile.in diff --git a/t/txinfo30.sh b/t/txinfo30.sh index 09ebd5e18..1766cacb0 100755 --- a/t/txinfo30.sh +++ b/t/txinfo30.sh @@ -39,7 +39,7 @@ EOF chmod +x makeinfo -PATH=`pwd`$PATH_SEPARATOR$PATH +PATH=$(pwd)$PATH_SEPARATOR$PATH export PATH # Otherwise configure might pick up a working makeinfo from the diff --git a/t/txinfo32.sh b/t/txinfo32.sh index 7fa793858..6f0c5a3a4 100755 --- a/t/txinfo32.sh +++ b/t/txinfo32.sh @@ -32,9 +32,9 @@ END $ACLOCAL $AUTOCONF $AUTOMAKE -./configure "--prefix=`pwd`/inst" +./configure --prefix="$(pwd)/inst" $MAKE html dvi ps pdf info \ install-html install-dvi install-ps install-pdf install-info \ install-man install-data install-exec install uninstall -Exit 0 +: diff --git a/t/txinfo9.sh b/t/txinfo9.sh index eb2cbdcae..6d9c28b4c 100755 --- a/t/txinfo9.sh +++ b/t/txinfo9.sh @@ -35,7 +35,7 @@ $AUTOMAKE # overkill. for t in info dist-info dvi-am install-html uninstall-pdf-am; do $EGREP "(^| )$t*.:" Makefile.in # For debugging. - test `$EGREP -c "(^| )$t(:| *.:)" Makefile.in` -eq 1 + test $($EGREP -c "(^| )$t(:| *.:)" Makefile.in) -eq 1 done : diff --git a/t/uninstall-fail.sh b/t/uninstall-fail.sh index aee1fb5b7..7eac34252 100755 --- a/t/uninstall-fail.sh +++ b/t/uninstall-fail.sh @@ -53,9 +53,10 @@ $ACLOCAL $AUTOMAKE $AUTOCONF +# Make it harder to experience false postives when grepping error messages. inst=__inst-dir__ -./configure --prefix="`pwd`/$inst" +./configure --prefix="$(pwd)/$inst" mkdir $inst $inst/share : > $inst/share/foobar.txt diff --git a/t/uninstall-pr9578.sh b/t/uninstall-pr9578.sh index 1ba6ac7ed..1be2a26f5 100755 --- a/t/uninstall-pr9578.sh +++ b/t/uninstall-pr9578.sh @@ -40,7 +40,7 @@ $ACLOCAL $AUTOMAKE $AUTOCONF -./configure --prefix="`pwd`/inst" +./configure --prefix="$(pwd)/inst" $MAKE uninstall test ! -d inst diff --git a/t/vala-mix.sh b/t/vala-mix.sh index 7e04b60c2..c353aab25 100755 --- a/t/vala-mix.sh +++ b/t/vala-mix.sh @@ -36,7 +36,7 @@ mu_CFLAGS = -DHAVE_MU baz_SOURCES = baz.c END -if cross_compiling; then :; else +if ! cross_compiling; then unindent >> Makefile.am <<'END' check-local: ./zardoz diff --git a/t/vala-vapi.sh b/t/vala-vapi.sh index 3a9271613..637e73a58 100755 --- a/t/vala-vapi.sh +++ b/t/vala-vapi.sh @@ -47,7 +47,7 @@ cat > foo.vapi <<'END' public const string BARBAR; END -if cross_compiling; then :; else +if ! cross_compiling; then unindent >> Makefile.am <<'END' check-local: test2 .PHONY: test1 test2 @@ -65,7 +65,7 @@ $FGREP 'am_zardoz_OBJECTS' Makefile.in $FGREP 'am_libzardoz_la_OBJECTS' Makefile.in $FGREP 'zardoz_vala.stamp:' Makefile.in $FGREP 'libzardoz_la_vala.stamp:' Makefile.in -test `$FGREP -c '.stamp:' Makefile.in` -eq 2 +test $($FGREP -c '.stamp:' Makefile.in) -eq 2 $FGREP 'zardoz.c' Makefile.in $FGREP 'zardoz-foo.c' Makefile.in $FGREP 'zardoz-bar.c' Makefile.in @@ -76,7 +76,7 @@ $FGREP 'am_foo_OBJECTS' sub/Makefile.in $FGREP 'bar.c' sub/Makefile.in $FGREP 'baz.c' sub/Makefile.in $FGREP 'foo_vala.stamp:' sub/Makefile.in -test `$FGREP -c '.stamp:' sub/Makefile.in` -eq 1 +test $($FGREP -c '.stamp:' sub/Makefile.in) -eq 1 # Check against regression for weird bug due to unescaped '@' # characters used in a "..." perl string when writing the vala diff --git a/t/vala4.sh b/t/vala4.sh index 879803f8b..2d3951abb 100755 --- a/t/vala4.sh +++ b/t/vala4.sh @@ -35,10 +35,7 @@ exit 0 END chmod +x valac -cwd=`pwd` - -# Use $cwd instead of `pwd` in the && list below to avoid a bug in -# the way Solaris/Heirloom Sh handles 'set -e'. +cwd=$(pwd) || fatal_ "getting current working directory" $ACLOCAL $AUTOMAKE -a diff --git a/t/vala5.sh b/t/vala5.sh index 6ea273873..1943b8662 100755 --- a/t/vala5.sh +++ b/t/vala5.sh @@ -73,11 +73,11 @@ grep PKG_CHECK_MODULES configure && skip_ "pkg-config m4 macros not found" ./configure $MAKE -if cross_compiling; then :; else +if ! cross_compiling; then ./src/foo ./src/bar - test `./src/foo` = foo - test `./src/bar` = bar + test "$(./src/foo)" = foo + test "$(./src/bar)" = bar fi # Test clean rules. diff --git a/t/vartypo2.sh b/t/vartypo2.sh index 9b52df683..cc9f4dd00 100755 --- a/t/vartypo2.sh +++ b/t/vartypo2.sh @@ -53,9 +53,8 @@ AUTOMAKE_fails --add-missing # Makefile.am:5: warning: variable `libfoo_la_DEPENDENCIES' is defined but no program or # Makefile.am:5: library has `libfoo_la' as canonical name (possible typo) - grep 'as canonical' stderr | grep -v ' .libfoo_la. ' && Exit 1 -test `grep 'variable.*is defined but' stderr | wc -l` = 6 +test $(grep -c 'variable.*is defined but' stderr) -eq 6 # If we add a global -Wnone, all warnings should disappear. $AUTOMAKE -Wnone diff --git a/t/vartypos.sh b/t/vartypos.sh index eb924cc06..c323fff52 100755 --- a/t/vartypos.sh +++ b/t/vartypos.sh @@ -73,7 +73,7 @@ AUTOMAKE_fails -Wno-extra-portability grep 'as canonical' stderr | grep -v ' .foo. ' | grep -v ' .libfoo_a. ' \ && Exit 1 -test `grep 'variable.*is defined but' stderr | wc -l` = 13 +test $(grep -c 'variable.*is defined but' stderr) -eq 13 # If we add a global -Wnone, all warnings should disappear. $AUTOMAKE -Wnone diff --git a/t/version6.sh b/t/version6.sh index 1c04ab427..8d33c44fc 100755 --- a/t/version6.sh +++ b/t/version6.sh @@ -18,7 +18,7 @@ . ./defs || Exit 1 -amver=`$AUTOMAKE --version | sed -e 's/.* //;1q'` +amver=$($AUTOMAKE --version | sed -e 's/.* //;1q') # Does the extracted version number seems legit? case $amver in diff --git a/t/vtexi3.sh b/t/vtexi3.sh index 9dd3e6712..5bea2811b 100755 --- a/t/vtexi3.sh +++ b/t/vtexi3.sh @@ -91,7 +91,7 @@ do_check () # Check that UPDATED seems right, and that UPDATED and UPDATED-MONTH # are consistent. $EGREP "^@set UPDATED $date$" $srcdir/$vfile.texi - vmonth=`grep '^@set UPDATED ' $srcdir/$vfile.texi | awk '{print $4, $5}'` + vmonth=$(grep '^@set UPDATED ' $srcdir/$vfile.texi | awk '{print $4, $5}') grep "^@set UPDATED-MONTH $vmonth$" $srcdir/$vfile.texi # Check that the vers*.texi file is distributed according # to $(DISTFILES). diff --git a/t/vtexi4.sh b/t/vtexi4.sh index 6038444b5..27b0636f7 100755 --- a/t/vtexi4.sh +++ b/t/vtexi4.sh @@ -24,16 +24,12 @@ required='makeinfo tex texi2dvi-o' . ./defs || Exit 1 -case `LC_ALL=C date '+%u'` in - [1-7]) date_is_posix=:;; - *) date_is_posx=false;; -esac -$date_is_posix \ - && day=`LC_ALL=C date '+%d'` && test -n "$day" \ - && month=`LC_ALL=C date '+%B'` && test -n "$month" \ - && year=`LC_ALL=C date '+%Y'`&& test -n "$year" \ +test $(LC_ALL=C date '+%u') -gt 0 && test $(LC_ALL=C date '+%u') -lt 8 \ + && day=$(LC_ALL=C date '+%d') && test -n "$day" \ + && month=$(LC_ALL=C date '+%B') && test -n "$month" \ + && year=$(LC_ALL=C date '+%Y') && test -n "$year" \ || skip_ "'date' is not POSIX-compliant enough" -day=`echo "$day" | sed 's/^0//'` +day=$(echo "$day" | sed 's/^0//') (echo 'x' | grep x) \ || skip_ "grep doesn't work on input that is not pure text" diff --git a/t/warnings-win-over-strictness.sh b/t/warnings-win-over-strictness.sh index 5d47f5047..d0af92411 100755 --- a/t/warnings-win-over-strictness.sh +++ b/t/warnings-win-over-strictness.sh @@ -32,7 +32,7 @@ ko () { AUTOMAKE_run $* grep '^Makefile\.am:.*:=.*not portable' stderr - test `wc -l <stderr` -eq 1 + test $(wc -l <stderr) -eq 1 } set_am_opts() diff --git a/t/warnopts.sh b/t/warnopts.sh index 1662d91d6..584f864d0 100755 --- a/t/warnopts.sh +++ b/t/warnopts.sh @@ -52,7 +52,7 @@ grep '^sub/Makefile.am:.*INCLUDES' stderr grep '^sub/Makefile.am:.*foo_SOURCES' stderr && Exit 1 grep '^Makefile.am:.*INCLUDES' stderr && Exit 1 # Only three lines of warnings. -test `grep -v 'warnings are treated as errors' stderr | wc -l` = 3 +test $(grep -v 'warnings are treated as errors' stderr | wc -l) -eq 3 # On fast machines the autom4te.cache created during the above run of # $AUTOMAKE is likely to have the same time stamp as the configure.ac @@ -71,3 +71,5 @@ AC_OUTPUT END $ACLOCAL $AUTOMAKE + +: diff --git a/t/werror4.sh b/t/werror4.sh index b2f3f6a78..9a9a1665c 100755 --- a/t/werror4.sh +++ b/t/werror4.sh @@ -40,7 +40,7 @@ $ACLOCAL AUTOMAKE_fails -Wno-error grep 'VAR multiply defined' stderr grep 'SUB multiply defined' stderr -test `grep -c 'warnings are treated as errors' stderr` -eq 1 +test $(grep -c 'warnings are treated as errors' stderr) -eq 1 sed '/AUTOMAKE_OPTIONS/d' sub/Makefile.am > t mv -f t sub/Makefile.am @@ -48,7 +48,7 @@ mv -f t sub/Makefile.am AUTOMAKE_fails -Wno-error grep 'VAR multiply defined' stderr grep 'SUB multiply defined' stderr -test `grep -c 'warnings are treated as errors' stderr` -eq 1 +test $(grep -c 'warnings are treated as errors' stderr) -eq 1 sed '/AUTOMAKE_OPTIONS/d' Makefile.am > t mv -f t Makefile.am @@ -56,7 +56,7 @@ mv -f t Makefile.am AUTOMAKE_fails -Werror grep 'VAR multiply defined' stderr grep 'SUB multiply defined' stderr -test `grep -c 'warnings are treated as errors' stderr` -eq 1 +test $(grep -c 'warnings are treated as errors' stderr) -eq 1 AUTOMAKE_run -Wno-error grep 'VAR multiply defined' stderr diff --git a/t/yacc-basic.sh b/t/yacc-basic.sh index d2fd49061..34c7565b2 100755 --- a/t/yacc-basic.sh +++ b/t/yacc-basic.sh @@ -67,7 +67,7 @@ test -f bar-parse.c # Check that per-object flags are honored. test -f bar-parse.output -if cross_compiling; then :; else +if ! cross_compiling; then echo a | ./foo echo b | ./foo && Exit 1 echo a | ./bar diff --git a/t/yacc-cxx.sh b/t/yacc-cxx.sh index 41a25ec4a..94e5dad89 100755 --- a/t/yacc-cxx.sh +++ b/t/yacc-cxx.sh @@ -89,7 +89,7 @@ test -f foo4-parse4.cpp test -f foo3-parse3.output test -f foo4-parse4.output -if cross_compiling; then :; else +if ! cross_compiling; then for i in 1 2 3 4; do echo a | ./foo$i echo b | ./foo$i && Exit 1 diff --git a/t/yacc-dist-nobuild.sh b/t/yacc-dist-nobuild.sh index 6f02f1109..52abb87a1 100755 --- a/t/yacc-dist-nobuild.sh +++ b/t/yacc-dist-nobuild.sh @@ -65,7 +65,7 @@ exit 1 END cp bin/yacc bin/bison chmod a+x bin/yacc bin/bison -PATH=`pwd`/bin$PATH_SEPARATOR$PATH +PATH=$(pwd)/bin$PATH_SEPARATOR$PATH YACC=yacc BISON=bison export YACC BISON diff --git a/t/yacc-pr204.sh b/t/yacc-pr204.sh index 6507b5103..791066a62 100755 --- a/t/yacc-pr204.sh +++ b/t/yacc-pr204.sh @@ -78,7 +78,7 @@ touch parse.y parse2.y $sleep $MAKE parse.c parse2.c stat parse.c parse.y parse2.c parse2.y || : # For debugging. -test `ls -t parse.c parse.y | sed 1q` = parse.c -test `ls -t parse2.c parse2.y | sed 1q` = parse2.c +test $(ls -t parse.c parse.y | sed 1q) = parse.c +test $(ls -t parse2.c parse2.y | sed 1q) = parse2.c : diff --git a/t/yacc8.sh b/t/yacc8.sh index bab627dfb..5dead2131 100755 --- a/t/yacc8.sh +++ b/t/yacc8.sh @@ -79,12 +79,12 @@ $sleep $sleep touch ../foo/parse.y $MAKE obj -test `ls -1t foo/parse.h z | sed 1q` = z +test $(ls -1t foo/parse.h z | sed 1q) = z $sleep sed 's/%%/%token TOKEN\n%%/g' ../foo/parse.y >../foo/parse.yt mv -f ../foo/parse.yt ../foo/parse.y $MAKE obj -test `ls -1t foo/parse.h z | sed 1q` = foo/parse.h +test $(ls -1t foo/parse.h z | sed 1q) = foo/parse.h # Now, adds another parser to test ylwrap. diff --git a/t/yflags-force-conditional.sh b/t/yflags-force-conditional.sh index 53038a82a..8a98903dc 100755 --- a/t/yflags-force-conditional.sh +++ b/t/yflags-force-conditional.sh @@ -33,7 +33,7 @@ echo "/* $* */" > y.tab.c echo 'extern int dummy;' >> y.tab.c END chmod a+x bin/fake-yacc -PATH=`pwd`/bin$PATH_SEPARATOR$PATH; export PATH +PATH=$(pwd)/bin$PATH_SEPARATOR$PATH; export PATH YACC=fake-yacc; export YACC cat > Makefile.am <<'END' |