diff options
author | Pádraig Brady <P@draigBrady.com> | 2014-06-03 10:50:09 +0100 |
---|---|---|
committer | Pádraig Brady <P@draigBrady.com> | 2014-06-03 18:39:57 +0100 |
commit | 9a6a486e6503520fd2581f2d3356b7149f1b225d (patch) | |
tree | 8752754ae8780de8ceb4d2ab1113d8b74faef77c /tests/misc/help-version.sh | |
parent | 1239ac573df0a699d6999aed23caaf4a0eb099df (diff) | |
download | coreutils-9a6a486e6503520fd2581f2d3356b7149f1b225d.tar.xz |
tests: consolidate tests for true and false
* src/true.c (main): Add a comment about the possibility
of true returning EXIT_FAILURE due to write failure.
* tests/misc/false-status.sh: Fix so we're testing
the tool and not the shell builtin. Add a case for true(1).
* tests/misc/help-version.sh: Skip /dev/full test
for true as well as false since the exit status is tested separately.
Also remove the iterations for different LC_MESSAGES, as this was only
applied for false(1). Translations are not honored in the test dir
and so would need separate handling in any case.
Diffstat (limited to 'tests/misc/help-version.sh')
-rwxr-xr-x | tests/misc/help-version.sh | 65 |
1 files changed, 30 insertions, 35 deletions
diff --git a/tests/misc/help-version.sh b/tests/misc/help-version.sh index 4bc02d85d..b4939f7af 100755 --- a/tests/misc/help-version.sh +++ b/tests/misc/help-version.sh @@ -70,43 +70,38 @@ done test "x$v" = "x$VERSION" \ || fail_ "--version-\$VERSION mismatch" -for lang in C fr da; do - for i in $built_programs; do - - # Skip 'test'; it doesn't accept --help or --version. - test $i = test && continue; - - # false fails even when invoked with --help or --version. - if test $i = false; then - env LC_MESSAGES=$lang $i --help >/dev/null && fail=1 - env LC_MESSAGES=$lang $i --version >/dev/null && fail=1 - continue - fi +for i in $built_programs; do - # The just-built install executable is always named 'ginstall'. - test $i = install && i=ginstall - - # Make sure they exit successfully, under normal conditions. - env $i --help >/dev/null || fail=1 - env $i --version >/dev/null || fail=1 - - # Make sure they fail upon 'disk full' error. - if test -w /dev/full && test -c /dev/full; then - env $i --help >/dev/full 2>/dev/null && fail=1 - env $i --version >/dev/full 2>/dev/null && fail=1 - status=$? - test $i = [ && prog=lbracket || prog=$(echo $i|sed "s/$EXEEXT$//") - eval "expected=\$expected_failure_status_$prog" - test x$expected = x && expected=1 - if test $status = $expected; then - : # ok - else - fail=1 - echo "*** $i: bad exit status '$status' (expected $expected)," 1>&2 - echo " with --help or --version output redirected to /dev/full" 1>&2 - fi + # Skip 'test'; it doesn't accept --help or --version. + test $i = test && continue + + # false fails even when invoked with --help or --version. + # true and false are tested with these options separately. + test $i = false || test $i = true && continue + + # The just-built install executable is always named 'ginstall'. + test $i = install && i=ginstall + + # Make sure they exit successfully, under normal conditions. + env $i --help >/dev/null || fail=1 + env $i --version >/dev/null || fail=1 + + # Make sure they fail upon 'disk full' error. + if test -w /dev/full && test -c /dev/full; then + env $i --help >/dev/full 2>/dev/null && fail=1 + env $i --version >/dev/full 2>/dev/null && fail=1 + status=$? + test $i = [ && prog=lbracket || prog=$(echo $i|sed "s/$EXEEXT$//") + eval "expected=\$expected_failure_status_$prog" + test x$expected = x && expected=1 + if test $status = $expected; then + : # ok + else + fail=1 + echo "*** $i: bad exit status '$status' (expected $expected)," 1>&2 + echo " with --help or --version output redirected to /dev/full" 1>&2 fi - done + fi done bigZ_in=bigZ-in.Z |