mirror of
git://git.sv.gnu.org/coreutils.git
synced 2026-04-12 15:06:44 +02:00
* maint.mk (sc_require_test_exit_idiom): New rule to enforce policy. * tests/cp/acl: Adhere to the new policy. * tests/cp/preserve-gid: Likewise. * tests/dd/misc: * tests/install/create-leading: * tests/ln/sf-1: * tests/ls/symlink-slash: * tests/misc/help-version: * tests/misc/ls-time: * tests/misc/nice: * tests/misc/shred-remove: * tests/misc/stty: * tests/misc/stty-row-col: * tests/mkdir/p-1: * tests/mkdir/p-2: * tests/mkdir/p-3: * tests/mkdir/p-v: * tests/mkdir/special-1: * tests/mkdir/writable-under-readonly: * tests/mv/acl: * tests/mv/backup-is-src: * tests/mv/diag: * tests/mv/dir-file: * tests/mv/force: * tests/mv/hard-link-1: * tests/mv/i-2: * tests/mv/i-4: * tests/mv/into-self: * tests/mv/into-self-2: * tests/mv/into-self-3: * tests/mv/partition-perm: * tests/mv/to-symlink: * tests/rmdir/ignore: * tests/tail-2/assert: * tests/tail-2/assert-2: * tests/touch/dangling-symlink: * tests/touch/dir-1: * tests/touch/empty-file: * tests/touch/fifo: * tests/touch/no-rights: Likewise. Signed-off-by: Jim Meyering <meyering@redhat.com>
201 lines
5.3 KiB
Bash
Executable File
201 lines
5.3 KiB
Bash
Executable File
#! /bin/sh
|
|
# Make sure all these programs work properly
|
|
# when invoked with --help or --version.
|
|
|
|
# Copyright (C) 2000-2008 Free Software Foundation, Inc.
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
|
|
# 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 "$VERBOSE" = yes && set -x
|
|
|
|
# Ensure that $SHELL is set to *some* value and exported.
|
|
# This is required for dircolors, which would fail e.g., when
|
|
# invoked via debuild (which removes SHELL from the environment).
|
|
test "x$SHELL" = x && SHELL=/bin/sh
|
|
export SHELL
|
|
|
|
. $srcdir/../envvar-check
|
|
. $srcdir/../test-lib.sh
|
|
|
|
expected_failure_status_nohup=127
|
|
expected_failure_status_printenv=2
|
|
expected_failure_status_tty=3
|
|
expected_failure_status_sort=2
|
|
expected_failure_status_expr=3
|
|
expected_failure_status_lbracket=2
|
|
expected_failure_status_dir=2
|
|
expected_failure_status_ls=2
|
|
expected_failure_status_vdir=2
|
|
|
|
fail=0
|
|
|
|
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;
|
|
test $i = chcon && continue;
|
|
test $i = runcon && continue;
|
|
|
|
# false fails even when invoked with --help or --version.
|
|
if test $i = false; then
|
|
env LC_MESSAGES=$lang "$abs_top_builddir/src/$i" --help \
|
|
>/dev/null && fail=1
|
|
env LC_MESSAGES=$lang "$abs_top_builddir/src/$i" --version \
|
|
>/dev/null && fail=1
|
|
continue
|
|
fi
|
|
|
|
# The just-built install executable is always named `ginstall'.
|
|
test $i = install && i=ginstall
|
|
|
|
# Make sure they exit successfully, under normal conditions.
|
|
"$abs_top_builddir/src/$i" --help > h-$i || fail=1
|
|
"$abs_top_builddir/src/$i" --version >/dev/null || fail=1
|
|
|
|
# Make sure they mention the bug-reporting address in --help output.
|
|
grep "$PACKAGE_BUGREPORT" h-$i > /dev/null || fail=1
|
|
rm -f h-$i
|
|
|
|
# Make sure they fail upon `disk full' error.
|
|
if test -w /dev/full && test -c /dev/full; then
|
|
"$abs_top_builddir/src/$i" --help >/dev/full 2>/dev/null && fail=1
|
|
"$abs_top_builddir/src/$i" --version >/dev/full 2>/dev/null && fail=1
|
|
status=$?
|
|
test $i = [ && prog=lbracket || prog=$i
|
|
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
|
|
fi
|
|
done
|
|
done
|
|
|
|
tmp=tmp-$$
|
|
tmp_in=in-$$
|
|
tmp_in2=in2-$$
|
|
tmp_dir=dir-$$
|
|
tmp_out=out-$$
|
|
mkdir $tmp || fail=1
|
|
cd $tmp || fail=1
|
|
|
|
comm_args="$tmp_in $tmp_in"
|
|
csplit_args="$tmp_in //"
|
|
cut_args='-f 1'
|
|
join_args="$tmp_in $tmp_in"
|
|
tr_args='a a'
|
|
|
|
chmod_args="a+x $tmp_in"
|
|
# Punt on these.
|
|
chgrp_args=--version
|
|
chown_args=--version
|
|
mkfifo_args=--version
|
|
mknod_args=--version
|
|
# Punt on uptime, since it fails (e.g., failing to get boot time)
|
|
# on some systems, and we shouldn't let that stop `make check'.
|
|
uptime_args=--version
|
|
|
|
# Create a file in the current directory, not in $TMPDIR.
|
|
mktemp_args=mktemp.XXXX
|
|
|
|
cmp_args="$tmp_in $tmp_in2"
|
|
|
|
# Tell dd not to print the line with transfer rate and total.
|
|
# The transfer rate would vary between runs.
|
|
dd_args=status=noxfer
|
|
|
|
diff_args="$tmp_in $tmp_in2"
|
|
sdiff_args="$tmp_in $tmp_in2"
|
|
diff3_args="$tmp_in $tmp_in2 $tmp_in2"
|
|
cp_args="$tmp_in $tmp_in2"
|
|
ln_args="$tmp_in ln-target"
|
|
ginstall_args="$tmp_in $tmp_in2"
|
|
mv_args="$tmp_in $tmp_in2"
|
|
mkdir_args=$tmp_dir/subdir
|
|
rmdir_args=$tmp_dir
|
|
rm_args=$tmp_in
|
|
shred_args=$tmp_in
|
|
touch_args=$tmp_in2
|
|
|
|
basename_args=$tmp_in
|
|
dirname_args=$tmp_in
|
|
expr_args=foo
|
|
|
|
# Punt, in case GNU `id' hasn't been installed yet.
|
|
groups_args=--version
|
|
|
|
pathchk_args=$tmp_in
|
|
yes_args=--version
|
|
logname_args=--version
|
|
nohup_args=--version
|
|
printf_args=foo
|
|
seq_args=10
|
|
sleep_args=0
|
|
su_args=--version
|
|
|
|
# I'd rather not run sync, since it spins up disks that I've
|
|
# deliberately caused to spin down (but not unmounted).
|
|
sync_args=--version
|
|
|
|
test_args=foo
|
|
|
|
# This is necessary in the unusual event that there is
|
|
# no valid entry in /etc/mtab.
|
|
df_args=/
|
|
|
|
# This is necessary in the unusual event that getpwuid (getuid ()) fails.
|
|
id_args=-u
|
|
|
|
sleep 10m &
|
|
kill_args=$!
|
|
|
|
link_args="$tmp_in link-target"
|
|
unlink_args=$tmp_in
|
|
|
|
ln -s . slink
|
|
readlink_args=slink
|
|
|
|
stat_args=$tmp_in
|
|
unlink_args=$tmp_in
|
|
lbracket_args=": ]"
|
|
|
|
# Ensure that each program "works" (exits successfully) when doing
|
|
# something more than --help or --version.
|
|
for i in $built_programs; do
|
|
# Skip these.
|
|
case $i in chroot|stty|tty|false|chcon|runcon) continue;; esac
|
|
|
|
rm -rf $tmp_in $tmp_in2 $tmp_dir $tmp_out
|
|
echo > $tmp_in
|
|
echo > $tmp_in2
|
|
mkdir $tmp_dir
|
|
# echo ================== $i
|
|
test $i = [ && prog=lbracket || prog=$i
|
|
eval "args=\$${prog}_args"
|
|
if "$abs_top_builddir/src/$i" $args < $tmp_in > $tmp_out; then
|
|
: # ok
|
|
else
|
|
echo FAIL: $i
|
|
fail=1
|
|
fi
|
|
rm -rf $tmp_in $tmp_in2 $tmp_out $tmp_dir
|
|
done
|
|
|
|
(exit $fail); exit $fail
|