2 # Make sure all these programs work properly
3 # when invoked with --help or --version.
5 test "$VERBOSE" = yes && set -x
7 expected_failure_status_nohup
=127
8 expected_failure_status_printenv
=2
9 expected_failure_status_tty
=3
10 expected_failure_status_sort
=2
11 expected_failure_status_expr
=3
12 expected_failure_status_lbracket
=2
13 expected_failure_status_dir
=2
14 expected_failure_status_ls
=2
15 expected_failure_status_vdir
=2
17 case "$all_programs" in
19 if test -w /dev
/full
&& test -c /dev
/full
&& echo > /dev
/full
; then
21 ************************************************
22 WARNING
: On this system
, the built-in
echo function of
/bin
/sh
23 does not report failure when writing to a full device.
24 To demonstrate
, run this
command:
26 /bin
/sh
-c 'echo hello > /dev/full; echo status=$?'
28 Notice that the failing
echo leaves its
exit status
set to zero
29 and does not produce a diagnostic.
31 That bug
in /bin
/sh would cause the
test of the groups
32 scripts to fail
, so it is being removed from the list of
33 programs checked by this
test.
34 ************************************************
36 all_programs
=`echo $all_programs|sed 's/\<groups\> *//'`
43 for lang
in C fr da
; do
44 for i
in $all_programs; do
46 # Skip `test'; it doesn't accept --help or --version.
47 test $i = test && continue;
49 # false fails even when invoked with --help or --version.
50 if test $i = false
; then
51 env LC_MESSAGES
=$lang ..
/src
/$i --help >/dev
/null
&& fail
=1
52 env LC_MESSAGES
=$lang ..
/src
/$i --version >/dev
/null
&& fail
=1
56 # The just-built install executable is always named `ginstall'.
57 test $i = install && i
=ginstall
59 # Make sure they exit successfully, under normal conditions.
60 ..
/src
/$i --help > h-
$i || fail
=1
61 ..
/src
/$i --version >/dev
/null || fail
=1
63 # Make sure they mention the bug-reporting address in --help output.
64 grep "$PACKAGE_BUGREPORT" h-
$i > /dev
/null || fail
=1
67 # Make sure they fail upon `disk full' error.
68 if test -w /dev
/full
&& test -c /dev
/full
; then
69 ..
/src
/$i --help >/dev
/full
2>/dev
/null
&& fail
=1
70 ..
/src
/$i --version >/dev
/full
2>/dev
/null
&& fail
=1
72 test $i = [ && prog
=lbracket || prog
=$i
73 eval "expected=\$expected_failure_status_$prog"
74 test x
$expected = x
&& expected
=1
75 if test $status = $expected; then
79 echo "*** $i: bad exit status \`$status' (expected $expected)," 1>&2
80 echo " with --help or --version output redirected to /dev/full" 1>&2
94 comm_args
="$tmp_in $tmp_in"
95 csplit_args
="$tmp_in //"
97 join_args
="$tmp_in $tmp_in"
100 chmod_args
="a+x $tmp_in"
104 mkfifo_args
=--version
106 # Punt on uptime, since it fails (e.g., failing to get boot time)
107 # on some systems, and we shouldn't let that stop `make check'.
108 uptime_args
=--version
110 cmp_args
="$tmp_in $tmp_in2"
111 diff_args
="$tmp_in $tmp_in2"
112 sdiff_args
="$tmp_in $tmp_in2"
113 diff3_args
="$tmp_in $tmp_in2 $tmp_in2"
114 cp_args
="$tmp_in $tmp_in2"
115 ln_args
="$tmp_in ln-target"
116 ginstall_args
="$tmp_in $tmp_in2"
117 mv_args
="$tmp_in $tmp_in2"
118 mkdir_args
=$tmp_dir/subdir
124 basename_args
=$tmp_in
128 # Punt, in case GNU `id' hasn't been installed yet.
129 groups_args
=--version
133 logname_args
=--version
141 # This is necessary in the unusual event that there is
142 # no valid entry in /etc/mtab.
145 # This is necessary in the unusual event that getpwuid (getuid ()) fails.
151 link_args
="$tmp_in link-target"
161 for i
in $all_programs; do
163 case $i in chroot|stty|tty|false
) continue;; esac
165 rm -rf $tmp_in $tmp_in2 $tmp_dir $tmp_out
169 # echo ================== $i
170 test $i = [ && prog
=lbracket || prog
=$i
171 eval "args=\$${prog}_args"
172 if ..
/..
/src
/$i $args < $tmp_in > $tmp_out; then
178 rm -rf $tmp_in $tmp_in2 $tmp_out $tmp_dir