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
14 case "$all_programs" in
16 if test -w /dev
/full
&& test -c /dev
/full
&& echo > /dev
/full
; then
18 ************************************************
19 WARNING
: On this system
, the built-in
echo function of
/bin
/sh
20 does not report failure when writing to a full device.
21 To demonstrate
, run this
command:
23 /bin
/sh
-c 'echo hello > /dev/full; echo status=$?'
25 Notice that the failing
echo leaves its
exit status
set to zero
26 and does not produce a diagnostic.
28 That bug
in /bin
/sh would cause the
test of the groups
29 scripts to fail
, so it is being removed from the list of
30 programs checked by this
test.
31 ************************************************
33 all_programs
=`echo $all_programs|sed 's/\<groups\> *//'`
40 for lang
in C fr da
; do
41 for i
in $all_programs; do
43 # Skip `test'; it doesn't accept --help or --version.
44 test $i = test && continue;
46 # false fails even when invoked with --help or --version.
47 if test $i = false
; then
48 env LC_MESSAGES
=$lang ..
/src
/$i --help >/dev
/null
&& fail
=1
49 env LC_MESSAGES
=$lang ..
/src
/$i --version >/dev
/null
&& fail
=1
53 # The just-built install executable is always named `ginstall'.
54 test $i = install && i
=ginstall
56 # Make sure they exit successfully, under normal conditions.
57 ..
/src
/$i --help > h-
$i || fail
=1
58 ..
/src
/$i --version >/dev
/null || fail
=1
60 # Make sure they mention the bug-reporting address in --help output.
61 grep "$PACKAGE_BUGREPORT" h-
$i > /dev
/null || fail
=1
64 # Make sure they fail upon `disk full' error.
65 if test -w /dev
/full
&& test -c /dev
/full
; then
66 ..
/src
/$i --help >/dev
/full
2>/dev
/null
&& fail
=1
67 ..
/src
/$i --version >/dev
/full
2>/dev
/null
&& fail
=1
69 test $i = [ && prog
=lbracket || prog
=$i
70 eval "expected=\$expected_failure_status_$prog"
71 test x
$expected = x
&& expected
=1
72 if test $status = $expected; then
76 echo "*** $i: bad exit status \`$status' (expected $expected)," 1>&2
77 echo " with --help or --version output redirected to /dev/full" 1>&2
91 comm_args
="$tmp_in $tmp_in"
92 csplit_args
="$tmp_in //"
94 join_args
="$tmp_in $tmp_in"
97 chmod_args
="a+x $tmp_in"
101 mkfifo_args
=--version
104 cmp_args
="$tmp_in $tmp_in2"
105 diff_args
="$tmp_in $tmp_in2"
106 sdiff_args
="$tmp_in $tmp_in2"
107 diff3_args
="$tmp_in $tmp_in2 $tmp_in2"
108 cp_args
="$tmp_in $tmp_in2"
109 ln_args
="$tmp_in ln-target"
110 ginstall_args
="$tmp_in $tmp_in2"
111 mv_args
="$tmp_in $tmp_in2"
112 mkdir_args
=$tmp_dir/subdir
118 basename_args
=$tmp_in
122 # Punt, in case GNU `id' hasn't been installed yet.
123 groups_args
=--version
127 logname_args
=--version
135 # This is necessary in the unusual event that there is
136 # no valid entry in /etc/mtab.
139 # This is necessary in the unusual event that getpwuid (getuid ()) fails.
145 link_args
="$tmp_in link-target"
155 for i
in $all_programs; do
157 case $i in chroot|stty|tty|false
) continue;; esac
159 rm -rf $tmp_in $tmp_in2 $tmp_dir $tmp_out
163 # echo ================== $i
164 test $i = [ && prog
=lbracket || prog
=$i
165 eval "args=\$${prog}_args"
166 if ..
/..
/src
/$i $args < $tmp_in > $tmp_out; then
172 rm -rf $tmp_in $tmp_in2 $tmp_out $tmp_dir