Imported from ../bash-2.0.tar.gz.
This commit is contained in:
parent
726f63884d
commit
ccc6cda312
502 changed files with 91988 additions and 69123 deletions
279
tests/test-tests
Normal file
279
tests/test-tests
Normal file
|
|
@ -0,0 +1,279 @@
|
|||
t()
|
||||
{
|
||||
test "$@"
|
||||
echo $?
|
||||
}
|
||||
|
||||
echo 't -a noexist'
|
||||
t -a noexist
|
||||
echo 't -a run-all'
|
||||
t -a run-all
|
||||
|
||||
echo 't -b run-all'
|
||||
t -b run-all
|
||||
echo 't -b /dev/jb1a'
|
||||
t -b /dev/jb1a
|
||||
|
||||
echo 't -c run-all'
|
||||
t -c run-all
|
||||
echo 't -c /dev/tty'
|
||||
t -c /dev/tty
|
||||
|
||||
echo 't -d run-all'
|
||||
t -d run-all
|
||||
echo 't -d /etc'
|
||||
t -d /etc
|
||||
|
||||
echo 't -e noexist'
|
||||
t -e noexist
|
||||
echo 't -e run-all'
|
||||
t -e run-all
|
||||
|
||||
echo 't -f noexist'
|
||||
t -f noexist
|
||||
echo 't -f /dev/tty'
|
||||
t -f /dev/tty
|
||||
echo 't -f run-all'
|
||||
t -f run-all
|
||||
|
||||
echo 't -g run-all'
|
||||
t -g run-all
|
||||
|
||||
touch /tmp/test.setgid
|
||||
chmod ug+x /tmp/test.setgid
|
||||
chmod g+s /tmp/test.setgid
|
||||
echo 't -g /tmp/test.setgid'
|
||||
t -g /tmp/test.setgid
|
||||
rm -f /tmp/test.setgid
|
||||
|
||||
echo 't -k run-all'
|
||||
t -k run-all
|
||||
|
||||
echo 't -n ""'
|
||||
t -n ""
|
||||
echo 't -n "hello"'
|
||||
t -n "hello"
|
||||
|
||||
echo 't -p run-all'
|
||||
t -p run-all
|
||||
|
||||
echo 't -r noexist'
|
||||
t -r noexist
|
||||
|
||||
touch /tmp/test.noread
|
||||
chmod a-r /tmp/test.noread
|
||||
echo 't -r /tmp/test.noread'
|
||||
t -r /tmp/test.noread
|
||||
rm -f /tmp/test.noread
|
||||
|
||||
echo 't -r run-all'
|
||||
t -r run-all
|
||||
|
||||
echo 't -s noexist'
|
||||
t -s noexist
|
||||
echo 't -s /dev/null'
|
||||
t -s /dev/null
|
||||
echo 't -s run-all'
|
||||
t -s run-all
|
||||
|
||||
echo 't -t 20'
|
||||
t -t 20
|
||||
echo 't -t 0'
|
||||
t -t 0
|
||||
|
||||
echo 't -u noexist'
|
||||
t -u noexist
|
||||
|
||||
echo 't -u run-all'
|
||||
t -u run-all
|
||||
|
||||
touch /tmp/test.setuid
|
||||
chmod u+x /tmp/test.setuid # some systems require this to turn on setuid bit
|
||||
chmod u+s /tmp/test.setuid
|
||||
echo 't -u /tmp/test.setuid'
|
||||
t -u /tmp/test.setuid
|
||||
rm -f /tmp/test.setuid
|
||||
|
||||
echo 't -w noexist'
|
||||
t -w noexist
|
||||
|
||||
touch /tmp/test.nowrite
|
||||
chmod a-w /tmp/test.nowrite
|
||||
echo 't -w /tmp/test.nowrite'
|
||||
t -w /tmp/test.nowrite
|
||||
rm -f /tmp/test.nowrite
|
||||
|
||||
echo 't -w /dev/null'
|
||||
t -w /dev/null
|
||||
|
||||
echo 't -x noexist'
|
||||
t -x noexist
|
||||
|
||||
touch /tmp/test.exec
|
||||
chmod u+x /tmp/test.exec
|
||||
echo 't -x /tmp/test.exec'
|
||||
t -x /tmp/test.exec
|
||||
rm -f /tmp/test.exec
|
||||
|
||||
touch /tmp/test.noexec
|
||||
chmod u-x /tmp/test.noexec
|
||||
echo 't -x /tmp/test.noexec'
|
||||
t -x /tmp/test.noexec
|
||||
rm -f /tmp/test.noexec
|
||||
|
||||
echo 't -z ""'
|
||||
t -z ""
|
||||
echo 't -z "foo"'
|
||||
t -z "foo"
|
||||
|
||||
echo 't "foo"'
|
||||
t "foo"
|
||||
echo 't ""'
|
||||
t ""
|
||||
|
||||
touch /tmp/test.owner
|
||||
echo 't -O /tmp/test.owner'
|
||||
t -O /tmp/test.owner
|
||||
rm -f /tmp/test.owner
|
||||
|
||||
echo 't "hello" = "hello"'
|
||||
t "hello" = "hello"
|
||||
echo 't "hello" = "goodbye"'
|
||||
t "hello" = "goodbye"
|
||||
|
||||
echo 't "hello" == "hello"'
|
||||
t "hello" == "hello"
|
||||
echo 't "hello" == "goodbye"'
|
||||
t "hello" == "goodbye"
|
||||
|
||||
echo 't "hello" != "hello"'
|
||||
t "hello" != "hello"
|
||||
echo 't "hello" != "goodbye"'
|
||||
t "hello" != "goodbye"
|
||||
|
||||
echo 't "hello" < "goodbye"'
|
||||
t "hello" \< "goodbye"
|
||||
echo 't "hello" > "goodbye"'
|
||||
t "hello" \> "goodbye"
|
||||
|
||||
echo 't ! "hello" > "goodbye"'
|
||||
t "! hello" \> "goodbye"
|
||||
|
||||
echo 't 200 -eq 200'
|
||||
t 200 -eq 200
|
||||
echo 't 34 -eq 222'
|
||||
t 34 -eq 222
|
||||
|
||||
echo 't 200 -ne 200'
|
||||
t 200 -ne 200
|
||||
echo 't 34 -ne 222'
|
||||
t 34 -ne 222
|
||||
|
||||
echo 't 200 -gt 200'
|
||||
t 200 -gt 200
|
||||
echo 't 340 -gt 222'
|
||||
t 340 -gt 222
|
||||
|
||||
echo 't 200 -ge 200'
|
||||
t 200 -ge 200
|
||||
echo 't 34 -ge 222'
|
||||
t 34 -ge 222
|
||||
|
||||
echo 't 200 -lt 200'
|
||||
t 200 -lt 200
|
||||
echo 't 34 -lt 222'
|
||||
t 34 -lt 222
|
||||
|
||||
echo 't 200 -le 200'
|
||||
t 200 -le 200
|
||||
echo 't 340 -le 222'
|
||||
t 340 -le 222
|
||||
|
||||
echo 't 700 -le 1000 -a -n "1" -a "20" = "20"'
|
||||
t 700 -le 1000 -a -n "1" -a "20" = "20"
|
||||
echo 't ! \( 700 -le 1000 -a -n "1" -a "20" = "20" \)'
|
||||
t ! \( 700 -le 1000 -a -n "1" -a "20" = "20" \)
|
||||
|
||||
touch /tmp/abc
|
||||
sleep 2
|
||||
touch /tmp/def
|
||||
|
||||
echo 't /tmp/abc -nt /tmp/def'
|
||||
t /tmp/abc -nt /tmp/def
|
||||
echo 't /tmp/abc -ot /tmp/def'
|
||||
t /tmp/abc -ot /tmp/def
|
||||
echo 't /tmp/def -nt /tmp/abc'
|
||||
t /tmp/def -nt /tmp/abc
|
||||
echo 't /tmp/def -ot /tmp/abc'
|
||||
t /tmp/def -ot /tmp/abc
|
||||
|
||||
echo 't /tmp/abc -ef /tmp/def'
|
||||
t /tmp/abc -ef /tmp/def
|
||||
ln /tmp/abc /tmp/ghi
|
||||
echo 't /tmp/abc -ef /tmp/ghi'
|
||||
t /tmp/abc -ef /tmp/ghi
|
||||
|
||||
rm /tmp/abc /tmp/def /tmp/ghi
|
||||
|
||||
echo 't -r /dev/fd/0'
|
||||
t -r /dev/fd/0
|
||||
echo 't -w /dev/fd/1'
|
||||
t -w /dev/fd/1
|
||||
echo 't -w /dev/fd/2'
|
||||
t -w /dev/fd/2
|
||||
echo 't'
|
||||
t
|
||||
|
||||
echo 't 12 -eq 34'
|
||||
t 12 -eq 34
|
||||
echo 't ! 12 -eq 34'
|
||||
t ! 12 -eq 34
|
||||
|
||||
echo 't -n abcd -o aaa'
|
||||
t -n abcd -o aaa
|
||||
echo 't -n abcd -o -z aaa'
|
||||
t -n abcd -o -z aaa
|
||||
|
||||
echo 't -n abcd -a aaa'
|
||||
t -n abcd -a aaa
|
||||
echo 't -n abcd -a -z aaa'
|
||||
t -n abcd -a -z aaa
|
||||
|
||||
set +o allexport
|
||||
echo 't -o allexport'
|
||||
t -o allexport
|
||||
echo 't ! -o allexport'
|
||||
t ! -o allexport
|
||||
|
||||
echo 't xx -a yy'
|
||||
t xx -a yy
|
||||
echo 't xx -o ""'
|
||||
t xx -o ""
|
||||
echo 't xx -a ""'
|
||||
t xx -a ""
|
||||
|
||||
echo 't -X -a -X'
|
||||
t -X -a -X
|
||||
echo 't -X -o -X'
|
||||
t -X -o -X
|
||||
echo 't -X -o ""'
|
||||
t -X -o ""
|
||||
echo 't -X -a ""'
|
||||
t -X -a ""
|
||||
echo 't "" -a -X'
|
||||
t "" -a -X
|
||||
echo 't "" -o -X'
|
||||
t "" -o -X
|
||||
echo 't "" -a ""'
|
||||
t "" -a ""
|
||||
echo 't "" -o ""'
|
||||
t "" -o ""
|
||||
echo 't true -o -X'
|
||||
t true -o -X
|
||||
echo 't true -a -X'
|
||||
t true -a -X
|
||||
|
||||
echo 't ( -E )'
|
||||
t \( -E \)
|
||||
echo 't ( "" )'
|
||||
t \( "" \)
|
||||
Loading…
Add table
Add a link
Reference in a new issue