diff options
Diffstat (limited to 'tools/regression/bin')
-rw-r--r-- | tools/regression/bin/sh/builtins/eval6.0 | 5 | ||||
-rw-r--r-- | tools/regression/bin/sh/builtins/read6.0 | 5 | ||||
-rw-r--r-- | tools/regression/bin/sh/builtins/trap12.0 | 10 | ||||
-rw-r--r-- | tools/regression/bin/sh/builtins/wait4.0 | 12 | ||||
-rw-r--r-- | tools/regression/bin/sh/builtins/wait5.0 | 12 | ||||
-rw-r--r-- | tools/regression/bin/sh/builtins/wait6.0 | 3 | ||||
-rw-r--r-- | tools/regression/bin/sh/builtins/wait7.0 | 4 | ||||
-rw-r--r-- | tools/regression/bin/sh/execution/not1.0 | 4 | ||||
-rw-r--r-- | tools/regression/bin/sh/execution/not2.0 | 6 | ||||
-rw-r--r-- | tools/regression/bin/test/regress.sh | 65 |
10 files changed, 125 insertions, 1 deletions
diff --git a/tools/regression/bin/sh/builtins/eval6.0 b/tools/regression/bin/sh/builtins/eval6.0 new file mode 100644 index 0000000..6752bb6 --- /dev/null +++ b/tools/regression/bin/sh/builtins/eval6.0 @@ -0,0 +1,5 @@ +# $FreeBSD$ + +# eval should preserve $? from command substitutions when starting +# the parsed command. +[ $(false; eval 'echo $?' $(:)) = 0 ] diff --git a/tools/regression/bin/sh/builtins/read6.0 b/tools/regression/bin/sh/builtins/read6.0 new file mode 100644 index 0000000..2168e10 --- /dev/null +++ b/tools/regression/bin/sh/builtins/read6.0 @@ -0,0 +1,5 @@ +# $FreeBSD$ + +: | read x +r=$? +[ "$r" = 1 ] diff --git a/tools/regression/bin/sh/builtins/trap12.0 b/tools/regression/bin/sh/builtins/trap12.0 new file mode 100644 index 0000000..8c62ffd --- /dev/null +++ b/tools/regression/bin/sh/builtins/trap12.0 @@ -0,0 +1,10 @@ +# $FreeBSD$ + +f() { + trap 'return 42' USR1 + kill -USR1 $$ + return 3 +} +f +r=$? +[ "$r" = 42 ] diff --git a/tools/regression/bin/sh/builtins/wait4.0 b/tools/regression/bin/sh/builtins/wait4.0 new file mode 100644 index 0000000..7935131 --- /dev/null +++ b/tools/regression/bin/sh/builtins/wait4.0 @@ -0,0 +1,12 @@ +# $FreeBSD$ + +T=`mktemp -d ${TMPDIR:-/tmp}/sh-test.XXXXXX` +trap 'rm -rf $T' 0 +cd $T || exit 3 +mkfifo fifo1 +trapped= +trap trapped=1 QUIT +{ kill -QUIT $$; sleep 1; exit 4; } >fifo1 & +wait $! <fifo1 +r=$? +[ "$r" -gt 128 ] && [ -n "$trapped" ] diff --git a/tools/regression/bin/sh/builtins/wait5.0 b/tools/regression/bin/sh/builtins/wait5.0 new file mode 100644 index 0000000..6874bf6 --- /dev/null +++ b/tools/regression/bin/sh/builtins/wait5.0 @@ -0,0 +1,12 @@ +# $FreeBSD$ + +T=`mktemp -d ${TMPDIR:-/tmp}/sh-test.XXXXXX` +trap 'rm -rf $T' 0 +cd $T || exit 3 +mkfifo fifo1 +trapped= +trap trapped=1 QUIT +{ kill -QUIT $$; sleep 1; exit 4; } >fifo1 & +wait <fifo1 +r=$? +[ "$r" -gt 128 ] && [ -n "$trapped" ] diff --git a/tools/regression/bin/sh/builtins/wait6.0 b/tools/regression/bin/sh/builtins/wait6.0 new file mode 100644 index 0000000..20e3c68 --- /dev/null +++ b/tools/regression/bin/sh/builtins/wait6.0 @@ -0,0 +1,3 @@ +# $FreeBSD$ + +wait -- diff --git a/tools/regression/bin/sh/builtins/wait7.0 b/tools/regression/bin/sh/builtins/wait7.0 new file mode 100644 index 0000000..0fb092f --- /dev/null +++ b/tools/regression/bin/sh/builtins/wait7.0 @@ -0,0 +1,4 @@ +# $FreeBSD$ + +: & +wait -- $! diff --git a/tools/regression/bin/sh/execution/not1.0 b/tools/regression/bin/sh/execution/not1.0 new file mode 100644 index 0000000..12c6265 --- /dev/null +++ b/tools/regression/bin/sh/execution/not1.0 @@ -0,0 +1,4 @@ +# $FreeBSD$ + +f() { ! return $1; } +f 0 && ! f 1 diff --git a/tools/regression/bin/sh/execution/not2.0 b/tools/regression/bin/sh/execution/not2.0 new file mode 100644 index 0000000..1b128d0 --- /dev/null +++ b/tools/regression/bin/sh/execution/not2.0 @@ -0,0 +1,6 @@ +# $FreeBSD$ + +while :; do + ! break + exit 3 +done diff --git a/tools/regression/bin/test/regress.sh b/tools/regression/bin/test/regress.sh index 9229551..117a7e2 100644 --- a/tools/regression/bin/test/regress.sh +++ b/tools/regression/bin/test/regress.sh @@ -52,7 +52,7 @@ t () } count=0 -echo "1..130" +echo "1..266" t 0 'b = b' t 0 'b == b' @@ -194,3 +194,66 @@ t 1 '\( ! -a \)' t 0 '\( -n -o \)' t 1 '\( -z -o \)' t 1 '\( ! -o \)' + +# Test all file timestamp comparison operators +s() { + t ${1} "${35} -nt ${36}" + t ${2} "${35} -ntaa ${36}" + t ${3} "${35} -ntab ${36}" + t ${4} "${35} -ntac ${36}" + t ${5} "${35} -ntam ${36}" + t ${6} "${35} -ntba ${36}" + t ${7} "${35} -ntbb ${36}" + t ${8} "${35} -ntbc ${36}" + t ${9} "${35} -ntbm ${36}" + t ${10} "${35} -ntca ${36}" + t ${11} "${35} -ntcb ${36}" + t ${12} "${35} -ntcc ${36}" + t ${13} "${35} -ntcm ${36}" + t ${14} "${35} -ntma ${36}" + t ${15} "${35} -ntmb ${36}" + t ${16} "${35} -ntmc ${36}" + t ${17} "${35} -ntmm ${36}" + t ${18} "${35} -ot ${36}" + t ${19} "${35} -otaa ${36}" + t ${20} "${35} -otab ${36}" + t ${21} "${35} -otac ${36}" + t ${22} "${35} -otam ${36}" + t ${23} "${35} -otba ${36}" + t ${24} "${35} -otbb ${36}" + t ${25} "${35} -otbc ${36}" + t ${26} "${35} -otbm ${36}" + t ${27} "${35} -otca ${36}" + t ${28} "${35} -otcb ${36}" + t ${29} "${35} -otcc ${36}" + t ${30} "${35} -otcm ${36}" + t ${31} "${35} -otma ${36}" + t ${32} "${35} -otmb ${36}" + t ${33} "${35} -otmc ${36}" + t ${34} "${35} -otmm ${36}" +} + +a=/tmp/test$$.1 +b=/tmp/test$$.2 +trap "rm -f $a $b" EXIT + +# Tests 131-164 +s 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 $a $b + +touch $a +# Tests 165-198 +s 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 $a $b + +sleep 2 # Ensure $b is newer than $a +touch $b +# Tests 199-232 +s 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 $a $b + +sleep 2 +echo >$b # Updates mtime & ctime +sleep 2 +touch -A 01 -a $b + +# $b now has ctime > mtime > atime > btime +# Tests 233-266 +s 1 1 0 1 1 1 1 1 1 0 0 1 0 0 0 1 1 1 1 1 0 0 0 1 0 0 1 1 1 1 1 1 0 1 $b $b |