1 | #! /bin/sh
|
---|
2 | # Make sure all these programs work properly
|
---|
3 | # when invoked with --help or --version.
|
---|
4 |
|
---|
5 | test "$VERBOSE" = yes && set -x
|
---|
6 |
|
---|
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
|
---|
16 |
|
---|
17 | case "$all_programs" in
|
---|
18 | *groups*)
|
---|
19 | if test -w /dev/full && test -c /dev/full \
|
---|
20 | && echo > /dev/full 2>/dev/null; then
|
---|
21 | cat 1>&2 <<\EOF
|
---|
22 | ************************************************
|
---|
23 | WARNING: On this system, the built-in echo function of /bin/sh
|
---|
24 | does not report failure when writing to a full device.
|
---|
25 | To demonstrate, run this command:
|
---|
26 |
|
---|
27 | /bin/sh -c 'echo hello > /dev/full; echo status=$?'
|
---|
28 |
|
---|
29 | Notice that the failing echo leaves its exit status set to zero
|
---|
30 | and does not produce a diagnostic.
|
---|
31 |
|
---|
32 | That bug in /bin/sh would cause the test of the groups
|
---|
33 | scripts to fail, so it is being removed from the list of
|
---|
34 | programs checked by this test.
|
---|
35 | ************************************************
|
---|
36 | EOF
|
---|
37 | all_programs=`echo $all_programs|sed 's/\<groups\> *//'`
|
---|
38 | fi
|
---|
39 | ;;
|
---|
40 | esac
|
---|
41 |
|
---|
42 | fail=0
|
---|
43 |
|
---|
44 | for lang in C fr da; do
|
---|
45 | for i in $all_programs; do
|
---|
46 |
|
---|
47 | # Skip `test'; it doesn't accept --help or --version.
|
---|
48 | test $i = test && continue;
|
---|
49 |
|
---|
50 | # false fails even when invoked with --help or --version.
|
---|
51 | if test $i = false; then
|
---|
52 | env LC_MESSAGES=$lang ../src/$i --help >/dev/null && fail=1
|
---|
53 | env LC_MESSAGES=$lang ../src/$i --version >/dev/null && fail=1
|
---|
54 | continue
|
---|
55 | fi
|
---|
56 |
|
---|
57 | # The just-built install executable is always named `ginstall'.
|
---|
58 | test $i = install && i=ginstall
|
---|
59 |
|
---|
60 | # Make sure they exit successfully, under normal conditions.
|
---|
61 | ../src/$i --help > h-$i || fail=1
|
---|
62 | ../src/$i --version >/dev/null || fail=1
|
---|
63 |
|
---|
64 | # Make sure they mention the bug-reporting address in --help output.
|
---|
65 | grep "$PACKAGE_BUGREPORT" h-$i > /dev/null || fail=1
|
---|
66 | rm -f h-$i
|
---|
67 |
|
---|
68 | # Make sure they fail upon `disk full' error.
|
---|
69 | if test -w /dev/full && test -c /dev/full; then
|
---|
70 | ../src/$i --help >/dev/full 2>/dev/null && fail=1
|
---|
71 | ../src/$i --version >/dev/full 2>/dev/null && fail=1
|
---|
72 | status=$?
|
---|
73 | test $i = [ && prog=lbracket || prog=$i
|
---|
74 | eval "expected=\$expected_failure_status_$prog"
|
---|
75 | test x$expected = x && expected=1
|
---|
76 | if test $status = $expected; then
|
---|
77 | : # ok
|
---|
78 | else
|
---|
79 | fail=1
|
---|
80 | echo "*** $i: bad exit status \`$status' (expected $expected)," 1>&2
|
---|
81 | echo " with --help or --version output redirected to /dev/full" 1>&2
|
---|
82 | fi
|
---|
83 | fi
|
---|
84 | done
|
---|
85 | done
|
---|
86 |
|
---|
87 | tmp=tmp-$$
|
---|
88 | tmp_in=in-$$
|
---|
89 | tmp_in2=in2-$$
|
---|
90 | tmp_in3=in3-$$ #bird
|
---|
91 | tmp_dir=dir-$$
|
---|
92 | tmp_out=out-$$
|
---|
93 | mkdir $tmp || fail=1
|
---|
94 | cd $tmp || fail=1
|
---|
95 |
|
---|
96 | comm_args="$tmp_in $tmp_in"
|
---|
97 | csplit_args="$tmp_in //"
|
---|
98 | cut_args='-f 1'
|
---|
99 | join_args="$tmp_in $tmp_in"
|
---|
100 | tr_args='a a'
|
---|
101 |
|
---|
102 | #chmod_args="a+x $tmp_in" # bird
|
---|
103 | chmod_args="a+x $tmp_in2" # bird - access denied
|
---|
104 | # Punt on these.
|
---|
105 | chgrp_args=--version
|
---|
106 | chown_args=--version
|
---|
107 | mkfifo_args=--version
|
---|
108 | mknod_args=--version
|
---|
109 | # Punt on uptime, since it fails (e.g., failing to get boot time)
|
---|
110 | # on some systems, and we shouldn't let that stop `make check'.
|
---|
111 | uptime_args=--version
|
---|
112 |
|
---|
113 | cmp_args="$tmp_in $tmp_in2"
|
---|
114 | diff_args="$tmp_in $tmp_in2"
|
---|
115 | sdiff_args="$tmp_in $tmp_in2"
|
---|
116 | diff3_args="$tmp_in $tmp_in2 $tmp_in2"
|
---|
117 | cp_args="$tmp_in $tmp_in2"
|
---|
118 | #ln_args="$tmp_in ln-target" # bird
|
---|
119 | if $srcdir/is-hardlink-supported; then # bird
|
---|
120 | ln_args="$tmp_in ln-target" # bird
|
---|
121 | else # bird
|
---|
122 | ln_args="-s $tmp_in ln-target" # bird
|
---|
123 | fi # bird
|
---|
124 | ginstall_args="$tmp_in $tmp_in2"
|
---|
125 | #mv_args="$tmp_in $tmp_in2" # bird
|
---|
126 | mv_args="$tmp_in2 $tmp_in3" # bird - access denied
|
---|
127 | mkdir_args=$tmp_dir/subdir
|
---|
128 | rmdir_args=$tmp_dir
|
---|
129 | #rm_args=$tmp_in # bird
|
---|
130 | rm_args=$tmp_in2 # bird - access denied
|
---|
131 | #shred_args=$tmp_in # bird
|
---|
132 | shred_args=$tmp_in2 # bird - access denied
|
---|
133 | touch_args=$tmp_in2
|
---|
134 |
|
---|
135 | basename_args=$tmp_in
|
---|
136 | dirname_args=$tmp_in
|
---|
137 | expr_args=foo
|
---|
138 |
|
---|
139 | # Punt, in case GNU `id' hasn't been installed yet.
|
---|
140 | groups_args=--version
|
---|
141 |
|
---|
142 | pathchk_args=$tmp_in
|
---|
143 | yes_args=--version
|
---|
144 | logname_args=--version
|
---|
145 | nohup_args=--version
|
---|
146 | printf_args=foo
|
---|
147 | seq_args=10
|
---|
148 | sleep_args=0
|
---|
149 | su_args=--version
|
---|
150 | test_args=foo
|
---|
151 |
|
---|
152 | # This is necessary in the unusual event that there is
|
---|
153 | # no valid entry in /etc/mtab.
|
---|
154 | df_args=/
|
---|
155 |
|
---|
156 | # This is necessary in the unusual event that getpwuid (getuid ()) fails.
|
---|
157 | id_args=-u
|
---|
158 |
|
---|
159 | sleep 10m &
|
---|
160 | kill_args=$!
|
---|
161 |
|
---|
162 | link_args="$tmp_in link-target"
|
---|
163 | unlink_args=$tmp_in
|
---|
164 |
|
---|
165 | ln -s . slink
|
---|
166 | readlink_args=slink
|
---|
167 |
|
---|
168 | stat_args=$tmp_in
|
---|
169 | #unlink_args=$tmp_in # bird
|
---|
170 | unlink_args=$tmp_in2 # bird - access denied
|
---|
171 | lbracket_args=": ]"
|
---|
172 |
|
---|
173 | for i in $all_programs; do
|
---|
174 | # Skip these.
|
---|
175 | case $i in chroot|stty|tty|false) continue;; esac
|
---|
176 |
|
---|
177 | rm -rf $tmp_in $tmp_in2 $tmp_dir $tmp_out
|
---|
178 | echo > $tmp_in
|
---|
179 | echo > $tmp_in2
|
---|
180 | mkdir $tmp_dir
|
---|
181 | # echo ================== $i
|
---|
182 | test $i = [ && prog=lbracket || prog=$i
|
---|
183 | eval "args=\$${prog}_args"
|
---|
184 | if ../../src/$i $args < $tmp_in > $tmp_out; then
|
---|
185 | : # ok
|
---|
186 | else
|
---|
187 | case $i in # bird
|
---|
188 | link|pinky|whoami|who|users) # bird
|
---|
189 | echo "IGNORED: $i";; # bird
|
---|
190 | *) # bird
|
---|
191 | echo "FAIL: $i" # bird
|
---|
192 | fail=1;; # bird
|
---|
193 | esac # bird
|
---|
194 |
|
---|
195 | fi
|
---|
196 | rm -rf $tmp_in $tmp_in2 $tmp_out $tmp_dir $tmp_in3 # bird (in3)
|
---|
197 | done
|
---|
198 |
|
---|
199 | # FIXME: trap
|
---|
200 | cd ..
|
---|
201 | rm -rf $tmp
|
---|
202 |
|
---|
203 | exit $fail
|
---|