2 # Make sure all these programs work properly
3 # when invoked with --help or --version.
5 test "$VERBOSE" = yes && set -x
7 # Ensure that $SHELL is set to *some* value.
8 # This is required for dircolors, which would fail e.g., when
9 # invoked via debuild (which removes SHELL from the environment).
10 if test "x$SHELL" = x; then
15 expected_failure_status_nohup=127
16 expected_failure_status_printenv=2
17 expected_failure_status_tty=3
18 expected_failure_status_sort=2
19 expected_failure_status_expr=3
20 expected_failure_status_lbracket=2
21 expected_failure_status_dir=2
22 expected_failure_status_ls=2
23 expected_failure_status_vdir=2
25 case "$all_programs" in
27 if test -w /dev/full && test -c /dev/full \
28 && echo > /dev/full 2>/dev/null; then
30 ************************************************
31 WARNING: On this system, the built-in echo function of /bin/sh
32 does not report failure when writing to a full device.
33 To demonstrate, run this command:
35 /bin/sh -c 'echo hello > /dev/full; echo status=$?'
37 Notice that the failing echo leaves its exit status set to zero
38 and does not produce a diagnostic.
40 That bug in /bin/sh would cause the test of the groups
41 scripts to fail, so it is being removed from the list of
42 programs checked by this test.
43 ************************************************
45 all_programs=`echo $all_programs | tr ' ' '\n' | grep -v '^groups$'`
52 for lang in C fr da; do
53 for i in $all_programs; do
55 # Skip `test'; it doesn't accept --help or --version.
56 test $i = test && continue;
58 # false fails even when invoked with --help or --version.
59 if test $i = false; then
60 env LC_MESSAGES=$lang ../src/$i --help >/dev/null && fail=1
61 env LC_MESSAGES=$lang ../src/$i --version >/dev/null && fail=1
65 # The just-built install executable is always named `ginstall'.
66 test $i = install && i=ginstall
68 # Make sure they exit successfully, under normal conditions.
69 ../src/$i --help > h-$i || fail=1
70 ../src/$i --version >/dev/null || fail=1
72 # Make sure they mention the bug-reporting address in --help output.
73 grep "$PACKAGE_BUGREPORT" h-$i > /dev/null || fail=1
76 # Make sure they fail upon `disk full' error.
77 if test -w /dev/full && test -c /dev/full; then
78 ../src/$i --help >/dev/full 2>/dev/null && fail=1
79 ../src/$i --version >/dev/full 2>/dev/null && fail=1
81 test $i = [ && prog=lbracket || prog=$i
82 eval "expected=\$expected_failure_status_$prog"
83 test x$expected = x && expected=1
84 if test $status = $expected; then
88 echo "*** $i: bad exit status \`$status' (expected $expected)," 1>&2
89 echo " with --help or --version output redirected to /dev/full" 1>&2
103 comm_args="$tmp_in $tmp_in"
104 csplit_args="$tmp_in //"
106 join_args="$tmp_in $tmp_in"
109 chmod_args="a+x $tmp_in"
113 mkfifo_args=--version
115 # Punt on uptime, since it fails (e.g., failing to get boot time)
116 # on some systems, and we shouldn't let that stop `make check'.
117 uptime_args=--version
119 cmp_args="$tmp_in $tmp_in2"
120 diff_args="$tmp_in $tmp_in2"
121 sdiff_args="$tmp_in $tmp_in2"
122 diff3_args="$tmp_in $tmp_in2 $tmp_in2"
123 cp_args="$tmp_in $tmp_in2"
124 ln_args="$tmp_in ln-target"
125 ginstall_args="$tmp_in $tmp_in2"
126 mv_args="$tmp_in $tmp_in2"
127 mkdir_args=$tmp_dir/subdir
133 basename_args=$tmp_in
137 # Punt, in case GNU `id' hasn't been installed yet.
138 groups_args=--version
142 logname_args=--version
150 # This is necessary in the unusual event that there is
151 # no valid entry in /etc/mtab.
154 # This is necessary in the unusual event that getpwuid (getuid ()) fails.
160 link_args="$tmp_in link-target"
170 for i in $all_programs; do
172 case $i in chroot|stty|tty|false) continue;; esac
174 rm -rf $tmp_in $tmp_in2 $tmp_dir $tmp_out
178 # echo ================== $i
179 test $i = [ && prog=lbracket || prog=$i
180 eval "args=\$${prog}_args"
181 if ../../src/$i $args < $tmp_in > $tmp_out; then
187 rm -rf $tmp_in $tmp_in2 $tmp_out $tmp_dir