1 # This program is free software: you can redistribute it and/or modify
2 # it under the terms of the GNU General Public License as published by
3 # the Free Software Foundation, either version 3 of the License, or
4 # (at your option) any later version.
6 # This program is distributed in the hope that it will be useful,
7 # but WITHOUT ANY WARRANTY; without even the implied warranty of
8 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 # GNU General Public License for more details.
11 # You should have received a copy of the GNU General Public License
12 # along with this program. If not, see <http://www.gnu.org/licenses/>.
14 if (( $UID == 0 )); then
15 echo "test-tests: the test suite should not be run as root" >&2
69 touch /tmp/test.setgid
70 chgrp ${GROUPS[0]} /tmp/test.setgid
71 chmod ug+x /tmp/test.setgid
72 chmod g+s /tmp/test.setgid
73 echo 't -g /tmp/test.setgid'
75 rm -f /tmp/test.setgid
91 if (( $UID != 0 )); then
92 touch /tmp/test.noread
93 chmod a-r /tmp/test.noread
94 echo 't -r /tmp/test.noread'
96 rm -f /tmp/test.noread
98 echo 't -r /tmp/test.noread'
107 echo 't -s /dev/null'
123 touch /tmp/test.setuid
124 chmod u+x /tmp/test.setuid # some systems require this to turn on setuid bit
125 chmod u+s /tmp/test.setuid
126 echo 't -u /tmp/test.setuid'
127 t -u /tmp/test.setuid
128 rm -f /tmp/test.setuid
133 if (( $UID != 0 )); then
134 touch /tmp/test.nowrite
135 chmod a-w /tmp/test.nowrite
136 echo 't -w /tmp/test.nowrite'
137 t -w /tmp/test.nowrite
138 rm -f /tmp/test.nowrite
140 echo 't -w /tmp/test.nowrite'
144 echo 't -w /dev/null'
151 chmod u+x /tmp/test.exec
152 echo 't -x /tmp/test.exec'
156 touch /tmp/test.noexec
157 chmod u-x /tmp/test.noexec
158 echo 't -x /tmp/test.noexec'
159 t -x /tmp/test.noexec
160 rm -f /tmp/test.noexec
172 touch /tmp/test.owner
173 echo 't -O /tmp/test.owner'
175 rm -f /tmp/test.owner
177 touch /tmp/test.socket
178 echo 't -S /tmp/test.socket'
179 t -S /tmp/test.socket # false
180 rm -f /tmp/test.socket
182 touch /tmp/test.newer ; sleep 1; echo "hello" > /tmp/test.newer
183 echo 't -N /tmp/test.newer'
185 rm -f /tmp/test.newer
187 echo 't "hello" = "hello"'
189 echo 't "hello" = "goodbye"'
190 t "hello" = "goodbye"
192 echo 't "hello" == "hello"'
194 echo 't "hello" == "goodbye"'
195 t "hello" == "goodbye"
197 echo 't "hello" != "hello"'
199 echo 't "hello" != "goodbye"'
200 t "hello" != "goodbye"
202 echo 't "hello" < "goodbye"'
203 t "hello" \< "goodbye"
204 echo 't "hello" > "goodbye"'
205 t "hello" \> "goodbye"
207 echo 't ! "hello" > "goodbye"'
208 t "! hello" \> "goodbye"
242 echo 't 700 -le 1000 -a -n "1" -a "20" = "20"'
243 t 700 -le 1000 -a -n "1" -a "20" = "20"
244 echo 't ! \( 700 -le 1000 -a -n "1" -a "20" = "20" \)'
245 t ! \( 700 -le 1000 -a -n "1" -a "20" = "20" \)
251 echo 't /tmp/abc -nt /tmp/def'
252 t /tmp/abc -nt /tmp/def
253 echo 't /tmp/abc -ot /tmp/def'
254 t /tmp/abc -ot /tmp/def
255 echo 't /tmp/def -nt /tmp/abc'
256 t /tmp/def -nt /tmp/abc
257 echo 't /tmp/def -ot /tmp/abc'
258 t /tmp/def -ot /tmp/abc
260 echo 't /tmp/abc -ef /tmp/def'
261 t /tmp/abc -ef /tmp/def
263 echo 't /tmp/abc -ef /tmp/ghi'
264 t /tmp/abc -ef /tmp/ghi
266 rm /tmp/abc /tmp/def /tmp/ghi
268 echo 't -r /dev/fd/0'
270 echo 't -w /dev/fd/1'
272 echo 't -w /dev/fd/2'
275 echo 't -r /dev/stdin'
277 echo 't -w /dev/stdout'
279 echo 't -w /dev/stderr'
292 echo 't -n abcd -o aaa'
294 echo 't -n abcd -o -z aaa'
297 echo 't -n abcd -a aaa'
299 echo 't -n abcd -a -z aaa'
302 # test set or unset shell options
304 echo 't -o allexport'
306 echo 't ! -o allexport'
309 #test set or unset shell variables
371 touch /tmp/test.group
372 chgrp ${GROUPS[0]} /tmp/test.group
373 echo 't -G /tmp/test.group'
378 /*) SHNAME=${THIS_SH} ;;
379 *) SHNAME=${PWD}/${THIS_SH} ;;
382 if ln -s ${SHNAME} /tmp/test.symlink 2>/dev/null; then
383 chgrp ${GROUPS[0]} /tmp/test.symlink 2>/dev/null
384 echo 't -h /tmp/test.symlink'
385 t -h /tmp/test.symlink
386 # some systems don't let you remove this
387 rm -f /tmp/test.symlink 2>/dev/null
389 echo 't -h /tmp/test.symlink'
393 # arithmetic constant errors
416 # badly formed expressions
426 # too many arguments -- argument expected is also reasonable
427 t 4 -eq 4 -a 2 -ne 5 -a 4 -ne
436 # non-numeric arguments to `test -t' should return failure -- fix in 2.05
445 echo 't -t /dev/tty4'
447 echo 't -t /dev/tty4444444...'
448 t -t /dev/tty4444444...
450 # fixed in bush-4.0-beta
453 ${THIS_SH} ./test1.sub