tests: use "Exit $fail", not (exit $fail); exit $fail

* tests/test-lib.sh (Exit): New function by Ralf Wildenhues in automake
http://git.sv.gnu.org/gitweb/?p=automake.git;a=commitdiff;h=20594c08f63
* tests/**: Convert all uses:

This restrictive change converted the vast majority:

  git grep -l '^(exit \$fail); exit \$fail$' \
    | xargs perl -pi -e 's/'^\(exit \$fail\); exit \$fail$/Exit \$fail/'

And this did the rest, plus a few undesirable ones, so I manually
backed out the changes to ChangeLog-* and build-aux/check.mk:

  git grep -l -E '\(exit [^)]+\); exit ' \
    | xargs perl -pi -e 's/\(exit (.+?)\); exit \1/Exit $1/'
This commit is contained in:
Jim Meyering 2008-09-07 10:31:27 +02:00
parent 22e5102f19
commit 68561594ca
300 changed files with 323 additions and 311 deletions

View File

@ -377,18 +377,18 @@ sc_program_name:
fi
# Require that the final line of each test-lib.sh-using test be this one:
# (exit $fail); exit $fail
# Exit $fail
# Note: this test requires GNU grep's --label= option.
sc_require_test_exit_idiom:
@if test -f $(srcdir)/tests/test-lib.sh; then \
die=0; \
for i in $$(grep -l -F /../test-lib.sh $$($(VC_LIST) tests)); do \
tail -n1 $$i | grep '^(exit \$$fail); exit \$$fail$$' > /dev/null \
tail -n1 $$i | grep '^Exit \$$fail$$' > /dev/null \
&& : || { die=1; echo $$i; } \
done; \
test $$die = 1 && \
{ echo 1>&2 '$(ME): the final line in each of the above is not:'; \
echo 1>&2 '(exit $$fail); exit $$fail'; \
echo 1>&2 'Exit $$fail'; \
exit 1; } || :; \
fi

View File

@ -112,4 +112,4 @@ test "`ls -C -c -t f g`" = 'f g' || \
esac
}
(exit $fail); exit $fail
Exit $fail

View File

@ -35,4 +35,4 @@ g_init=`stat --printf=%g f`
chgrp -R $g2 d || fail=1
test `stat --printf=%g f` = $g_init || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -62,4 +62,4 @@ chgrp --dereference $g1 symlink
set _ `ls -ln f`; g=$5; test "$g" = $g1 || fail=1
set _ `ls -ln symlink`; g=$5; test "$g" = $g2 || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -56,4 +56,4 @@ EOF
compare out exp || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -72,4 +72,4 @@ for i in $not_changed; do
test $group = $g1 || fail=1
done
(exit $fail); exit $fail
Exit $fail

View File

@ -55,4 +55,4 @@ set _ `ls -ln e/ee`; g=$5; test "$g" = $g2 || fail=1
# But it *should* change d/dd.
set _ `ls -ln d/dd`; g=$5; test "$g" = $g1 || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -42,4 +42,4 @@ case "`cat out`" in
*) fail=1 ;;
esac
(exit $fail); exit $fail
Exit $fail

View File

@ -36,4 +36,4 @@ for mode in =x =xX =Xx =x,=X =X,=x; do
esac
done
(exit $fail); exit $fail
Exit $fail

View File

@ -48,4 +48,4 @@ chmod a=,u=rwx,=u f || fail=1
actual_perms=`ls -l f|cut -b-10`
test "$actual_perms" = "-rwxr-x---" || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -30,4 +30,4 @@ fail=0
chmod u+rwx d d/e || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -59,4 +59,4 @@ chmod a-x . b 2> /dev/null && fail=1
# an abort (exit with status 134) on recent glibc-based systems.
test $? = 1 || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -31,4 +31,4 @@ chmod 0-followed-by-anything . 2> /dev/null && fail=1
chmod 7-followed-by-anything . 2> /dev/null && fail=1
chmod 8 . 2> /dev/null && fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -50,4 +50,4 @@ chmod 755 d
case `ls -ld d` in drwxr-sr-x*);; *) fail=1;; esac
(exit $fail); exit $fail
Exit $fail

View File

@ -33,4 +33,4 @@ chmod 644 dangle 2> out && fail=1
echo "chmod: cannot operate on dangling symlink \`dangle'" > exp
compare out exp || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -28,4 +28,4 @@ touch file
chmod 755 file
(umask 77 && chmod -x file) 2>/dev/null && fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -88,4 +88,4 @@ for case in $cases; do
esac
done
(exit $fail); exit $fail
Exit $fail

View File

@ -50,4 +50,4 @@ chown --no-dereference --from=0:1 2:010 slink || fail=1
# owner/group on the symlink should be changed
set _ `ls -n slink`; shift; test "$3:$4" = 2:10 || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -40,4 +40,4 @@ EOF
compare out exp || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -68,4 +68,4 @@ EOF
compare out exp || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -65,4 +65,4 @@ for u in $id_u "$id_un" ''; do
done
done
(exit $fail); exit $fail
Exit $fail

View File

@ -52,4 +52,4 @@ for i in dangling-dest existing-dest; do
&& case $(cat t) in i);; *) fail=1;; esac
done
(exit $fail); exit $fail
Exit $fail

View File

@ -60,4 +60,4 @@ cp -p a/file b/ || fail=1
acl2=`cd b && getfacl file` || framework_failure
test "$acl1" = "$acl2" || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -41,4 +41,4 @@ test -f $file || fail=1
test -f $file_backup || fail=1
compare $file $file_backup > /dev/null || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -34,4 +34,4 @@ cp -ab x y || fail=1
test -d y/x || fail=1
test -d y/x~ && fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -37,4 +37,4 @@ EOF
compare out2 exp || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -42,4 +42,4 @@ cat dest-dir/src-dir/slink > /dev/null 2>&1 && fail=1
# FIXME: test -L, too.
(exit $fail); exit $fail
Exit $fail

View File

@ -80,4 +80,4 @@ EOF
compare out exp || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -36,4 +36,4 @@ cp -RL a b d || fail=1
test -d a/c || fail=1
test -d b/c || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -31,4 +31,4 @@ fail=0
# coreutils 6.2 cp would neglect to prompt in this case.
echo n | cp -iR a b 2>/dev/null || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -94,4 +94,4 @@ sed 's/: x/:/' $expected-tmp |cat $expected-tmp - > $expected
compare $expected $actual || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -61,4 +61,4 @@ p=`ls -ld g/sym|cut -b-10`; case $p in drwx-w--w-);; *) fail=1;; esac
p=`ls -ld e/d/a/b/c|cut -b-10`; case $p in drwxr-xr-x);; *) fail=1;; esac
p=`ls -ld g/sym/b/c|cut -b-10`; case $p in drwxr-xr-x);; *) fail=1;; esac
(exit $fail); exit $fail
Exit $fail

View File

@ -30,4 +30,4 @@ ln -s slink-target slink || framework_failure
fail=0
cp -d f slink || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -32,4 +32,4 @@ cp -R --remove-destination d e || fail=1
# ...and again, with an existing destination.
cp -R --remove-destination d e || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -37,4 +37,4 @@ test -r dir2/file && fail=1
test -r dir2/dir1/file || fail=1
test -r dir1/file || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -35,4 +35,4 @@ cp -R dir file 2>/dev/null && fail=1
# In 4.0.35, it was.
test -f file || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -89,4 +89,4 @@ case $mode in
*) fail=1;;
esac
(exit $fail); exit $fail
Exit $fail

View File

@ -61,4 +61,4 @@ compare out exp || fail=1
chmod 700 D
(exit $fail); exit $fail
Exit $fail

View File

@ -57,4 +57,4 @@ esac
wait $cp_pid || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -42,4 +42,4 @@ EOF
compare out exp || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -33,4 +33,4 @@ fail=0
cp -f --link src dest || fail=1
cp -f --symbolic-link src dest2 || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -31,4 +31,4 @@ fail=0
# with link being applied to the dangling symlink.
cp --link --no-dereference dangling-slink d2 || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -87,4 +87,4 @@ test "$mode" = "-rwx------" || fail=1
umask 022
# --------------------------------------
(exit $fail); exit $fail
Exit $fail

View File

@ -41,4 +41,4 @@ test $? = 1 || fail=1
test "`cat a/foo`" = $msg || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -41,4 +41,4 @@ test $? = 1 || fail=1
test "`cat a`" = $msg || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -38,4 +38,4 @@ test $? = 1 || fail=1
test "`cat a`" = $msg || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -53,4 +53,4 @@ for dir in a a/b a/b/d; do
fail=1
done
(exit $fail); exit $fail
Exit $fail

View File

@ -64,4 +64,4 @@ do
wait $cp_pid || fail=1
done
(exit $fail); exit $fail
Exit $fail

View File

@ -75,4 +75,4 @@ for u in 31 37 2; do
done
done
(exit $fail); exit $fail
Exit $fail

View File

@ -29,4 +29,4 @@ fail=0
cp --preserve=mode,links f g || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -42,7 +42,7 @@ t0() {
:
else
echo "$0: $* $f b: $u $g != $s" 1>&2
(exit 1); exit 1
Exit 1
fi
fi
}
@ -103,4 +103,4 @@ t1 c0 "$nameless_uid" "$nameless_gid1" cp -p
t1 c1 "$nameless_uid" "$nameless_gid2" cp -p
fail=0
(exit $fail); exit $fail
Exit $fail

View File

@ -42,4 +42,4 @@ test -s exp && { rm -f exp; echo nonempty > exp; }
compare out exp || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -43,4 +43,4 @@ case $mode in
*) fail=1;;
esac
(exit $fail); exit $fail
Exit $fail

View File

@ -225,4 +225,4 @@ fail=0;
compare $expected $actual 1>&2 || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -34,4 +34,4 @@ fail=0
cp --update --no-dereference a b || fail=1
cp --update --no-dereference c d || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -38,4 +38,4 @@ cp --sparse=always sparse copy || fail=1
# Ensure that the copy has the same block count as the original.
test `stat --printf %b copy` -le `stat --printf %b sparse` || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -52,4 +52,4 @@ set _ `ls -l c`; shift; p1=$1
set _ `ls -l c2`; shift; p2=$1
test $p1 = $p2 && fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -37,4 +37,4 @@ cp -R fifo e || fail=1
cp -Rf fifo e || fail=1
test -p fifo || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -34,4 +34,4 @@ EOF
compare out exp || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -38,4 +38,4 @@ set `ls -l s`
# call and so cp ends up dereferencing the symlink and copying the directory.
test "$*" = 'total 0' && : || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -43,4 +43,4 @@ cat no-such >> out || fail=1
compare out exp || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -98,4 +98,4 @@ compare err_ok err || fail=1
test $fail -eq 0 && fail=$warn
(exit $fail); exit $fail
Exit $fail

View File

@ -33,4 +33,4 @@ case `cat out` in
*) fail=1 ;;
esac
(exit $fail); exit $fail
Exit $fail

View File

@ -40,4 +40,4 @@ case `cat out` in
*) fail=1 ;;
esac
(exit $fail); exit $fail
Exit $fail

View File

@ -37,4 +37,4 @@ EOF
compare out exp || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -39,4 +39,4 @@ $EGREP "$RE_TOTAL" tmp && fail=1
df --total | $EGREP "$RE_TOTAL" || fail=1
df -i --total | $EGREP "$RE_TOTAL" || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -77,4 +77,4 @@ $AWK -f compute_sum.awk tmp > out1 || fail=1
$AWK -f parse_total.awk tmp > out2 || fail=1
compare out1 out2 || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -70,4 +70,4 @@ EOF
compare out exp || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -55,4 +55,4 @@ EOF
compare out exp || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -91,4 +91,4 @@ EOF
compare out exp || fail=1
fi
(exit $fail); exit $fail
Exit $fail

View File

@ -34,4 +34,4 @@ fail=0
# du: `b': No such file or directory
du -sD slink b > /dev/null 2>&1 || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -50,4 +50,4 @@ EOF
compare out exp || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -60,4 +60,4 @@ EOF
compare out exp || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -45,4 +45,4 @@ fail=0
# With coreutils-5.0, this would fail due to a file descriptor leak.
du $f > out || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -50,4 +50,4 @@ EOF
compare out exp || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -58,4 +58,4 @@ sed 's,cannot access,cannot read directory,' out > t && mv t out
compare out exp || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -44,4 +44,4 @@ du -k a > out 2> /dev/null && fail=1
compare out exp || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -37,4 +37,4 @@ fail=0
du "$cwd/a" > /dev/null || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -68,4 +68,4 @@ chmod 0 . || framework_failure
fail=0
du -s "$cwd/$dir" > /dev/null || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -74,4 +74,4 @@ echo "du: cannot access: $too_many" > exp || fail=1
compare out exp || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -35,4 +35,4 @@ EOF
compare out exp || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -51,4 +51,4 @@ EOF
compare out exp || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -42,4 +42,4 @@ EOF
compare out exp || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -33,4 +33,4 @@ fail=0
du a b > out || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -35,4 +35,4 @@ EOF
compare out exp || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -59,4 +59,4 @@ du -a $symlinks > out || fail=1
# Require that at least one of these symlinks has a non-zero size.
grep '^[1-9]' out > /dev/null || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -49,4 +49,4 @@ EOF
compare out exp || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -42,4 +42,4 @@ du $t/1 $t/2 > /dev/null || fail=1
du . $t > /dev/null || fail=1
du .. $t > /dev/null || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -126,4 +126,4 @@ ginstall: creating directory `sub3/a/b/c'
`file' -> `sub3/a/b/c/file'
EOF
(exit $fail); exit $fail
Exit $fail

View File

@ -37,4 +37,4 @@ ginstall -D $file no-dir1/no-dir2/dest || fail=1
test -d no-dir1/no-dir2 || fail=1
test -r no-dir1/no-dir2/dest || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -31,4 +31,4 @@ test -d d1 || fail=1
ginstall -d d2/.. || fail=1
test -d d2 || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -38,4 +38,4 @@ echo aBc > exp || fail=1
ginstall src dest -s --strip-program=./b || fail=1
compare dest exp || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -35,4 +35,4 @@ fail=0
exec ginstall -s "$abs_top_builddir/src/ginstall$EXEEXT" .
)
(exit $fail); exit $fail
Exit $fail

View File

@ -31,4 +31,4 @@ touch a b || framework_failure
ln b b~ || fail=1
ln -f --b=simple a b || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -34,4 +34,4 @@ EOF
compare out exp || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -149,4 +149,4 @@ ln foo '' 2> /dev/null
# ===================================================
(exit $fail); exit $fail
Exit $fail

View File

@ -34,4 +34,4 @@ case `cat err` in
*) fail=1 ;;
esac
(exit $fail); exit $fail
Exit $fail

View File

@ -32,4 +32,4 @@ mkdir d || framework_failure
fail=0
ln -s --target-dir=d ../f || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -40,4 +40,4 @@ LS_COLORS="ca=$code" \
printf "\033[0m\033[${code}mtest\033[0m\n\033[m" > out_ok || fail=1
compare out out_ok || fail=1
(exit $fail); exit $fail
Exit $fail

View File

@ -50,4 +50,4 @@ EOF
compare out exp || fail=1
(exit $fail); exit $fail
Exit $fail

Some files were not shown because too many files have changed in this diff Show More