summaryrefslogtreecommitdiff
path: root/sys/src/cmd/test
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2023-02-19 20:44:56 -0500
committerOri Bernstein <ori@eigenstate.org>2023-02-19 20:44:56 -0500
commit31913a8524edf97ad79f9f895d6ac5761b9b2fd7 (patch)
treecc695a76c4a41527eb510c7c9462f059af652636 /sys/src/cmd/test
parentc3ba64f6935322f09b6de5c2285544fd471c605d (diff)
mkfiles: add 'mk test' support
9front has several tests scattered throughout the source, as well as more tests in an external 'regress' repository. Many of these tests are broken, because there is no easy way to build and track all of them. This pulls in several tests from different sources, deletes the broken tests, tests with missing data, and adds a single command that can be run from the root of the src directory to test our system. The hope is that as we develop new code, we add more tests, and eventually start running the tests on every commit. Please enter the commit message for your changes. Lines starting
Diffstat (limited to 'sys/src/cmd/test')
-rwxr-xr-xsys/src/cmd/test/date.rc91
-rw-r--r--sys/src/cmd/test/mkfile9
-rw-r--r--sys/src/cmd/test/patch/basic.expected100
-rw-r--r--sys/src/cmd/test/patch/basic.in93
-rw-r--r--sys/src/cmd/test/patch/basic.patch42
-rw-r--r--sys/src/cmd/test/patch/create.expected12
-rw-r--r--sys/src/cmd/test/patch/create.patch15
-rw-r--r--sys/src/cmd/test/patch/delete.expected10
-rw-r--r--sys/src/cmd/test/patch/delete.patch15
-rw-r--r--sys/src/cmd/test/patch/header.expected100
-rw-r--r--sys/src/cmd/test/patch/header.in93
-rw-r--r--sys/src/cmd/test/patch/header.patch54
-rw-r--r--sys/src/cmd/test/patch/mkfile5
-rw-r--r--sys/src/cmd/test/patch/multifile.patch89
-rw-r--r--sys/src/cmd/test/patch/multifile1.expected69
-rw-r--r--sys/src/cmd/test/patch/multifile1.in93
-rw-r--r--sys/src/cmd/test/patch/multifile2.expected19
-rw-r--r--sys/src/cmd/test/patch/multifile2.in21
-rw-r--r--sys/src/cmd/test/patch/nop.expected10
-rwxr-xr-xsys/src/cmd/test/patch/patch.rc39
-rwxr-xr-xsys/src/cmd/test/ramfs.rc40
-rwxr-xr-xsys/src/cmd/test/test.rc135
-rwxr-xr-xsys/src/cmd/test/zones.rc19
23 files changed, 1173 insertions, 0 deletions
diff --git a/sys/src/cmd/test/date.rc b/sys/src/cmd/test/date.rc
new file mode 100755
index 000000000..5499e3f2b
--- /dev/null
+++ b/sys/src/cmd/test/date.rc
@@ -0,0 +1,91 @@
+#!/bin/rc
+
+rfork en
+cat /adm/timezone/GMT > /env/timezone
+
+nl='
+'
+
+fn check {
+ r=`$nl{../$O.seconds $1}
+ if(! ~ $r $2){
+ echo "$"r"
+ echo "$"2"
+ echo $status
+ >[1=2] echo fail: $1: got $r expected $2
+ exit 'fail'
+ }
+}
+
+# examples from manpage, and shuffles
+rfork ne
+check '23 may 2011' 1306108800
+check 'may 23 2011' 1306108800
+check 'may 2011 23' 1306108800
+check '23 2011 may' 1306108800
+check '2011 may 23' 1306108800
+check '2011 23 may' 1306108800
+
+# now with timezones
+check '23 may 2011 edt' 1306123200
+check '23 may 2011 gmt' 1306108800
+
+# If the tz is present, the results should stay
+# the same if we change zones.
+@{
+ rfork en
+ cat /adm/timezone/US_Pacific >/env/timezone
+ check '23 may 2011 edt' 1306123200
+ check '23 may 2011 gmt' 1306108800
+}
+
+# now with all variations on times.
+check 'may 23 2011 0' 1306108800
+check 'may 23 2011 0:1' 1306108860
+check 'may 23 2011 0:1:2' 1306108862
+
+# now with times and timezones
+check '23 may 2011 edt' 1306123200
+check '23 may 2011 gmt' 1306108800
+
+# formats from ../$O.date(1)
+check 'Sun, 14 Jun 2020 22:08:48 -0700' 1592197728
+check 'Sun, 14 Jun 2020 -0700' 1592118000
+check '2020-06-14' 1592092800
+check '2020-06-14T22:14:17-07:00' 1592198057
+
+# colloquial american format (eww)
+check '06/14/2020' 1592092800
+check '06/01/2020' 1590969600
+
+
+# Arizona has no DST
+@{
+ rfork en
+ cat /adm/timezone/US_Arizona >/env/timezone
+ check 'Mon, Jun 21 17:38:02 MST 2020' 1592786282
+}
+
+# CET is a timezone with no hard-coded
+# timezone name -- it should round trip
+@{
+ rfork en
+ cat /adm/timezone/CET >/env/timezone
+ tm=1592782682
+ ds=`{../$O.date $tm}
+ r=`{../$O.seconds $"ds}
+ if(! ~ $tm $r)
+ >[1=2] echo fail: CET: got $r expected $tm
+}
+
+# The other EST should also round trip.
+@{
+ rfork en
+ cat /adm/timezone/Australia_ACT >/env/timezone
+ tm=1592782682
+ ds=`$nl{../$O.date $tm}
+ r=`$nl{../$O.seconds $ds}
+ if(! ~ $tm $r)
+ >[1=2] echo fail: Austraila_ACT: got $r expected $tm
+}
+exit ''
diff --git a/sys/src/cmd/test/mkfile b/sys/src/cmd/test/mkfile
new file mode 100644
index 000000000..17719e706
--- /dev/null
+++ b/sys/src/cmd/test/mkfile
@@ -0,0 +1,9 @@
+</$objtype/mkfile
+
+TEST=\
+ date\
+ patch\
+ ramfs\
+ test\
+
+</sys/src/cmd/mktest
diff --git a/sys/src/cmd/test/patch/basic.expected b/sys/src/cmd/test/patch/basic.expected
new file mode 100644
index 000000000..190423f88
--- /dev/null
+++ b/sys/src/cmd/test/patch/basic.expected
@@ -0,0 +1,100 @@
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
diff --git a/sys/src/cmd/test/patch/basic.in b/sys/src/cmd/test/patch/basic.in
new file mode 100644
index 000000000..1f5a7255c
--- /dev/null
+++ b/sys/src/cmd/test/patch/basic.in
@@ -0,0 +1,93 @@
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+13
+12
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
diff --git a/sys/src/cmd/test/patch/basic.patch b/sys/src/cmd/test/patch/basic.patch
new file mode 100644
index 000000000..326d4cfd0
--- /dev/null
+++ b/sys/src/cmd/test/patch/basic.patch
@@ -0,0 +1,42 @@
+--- basic.in
++++ basic.out
+@@ -1,3 +1,5 @@
++1
++2
+ 3
+ 4
+ 5
+@@ -10,8 +12,8 @@
+ 12
+ 13
+ 14
+-13
+-12
++15
++16
+ 17
+ 18
+ 19
+@@ -35,6 +37,8 @@
+ 37
+ 38
+ 39
++40
++41
+ 42
+ 43
+ 44
+@@ -80,6 +84,7 @@
+ 84
+ 85
+ 86
++87
+ 88
+ 89
+ 90
+@@ -91,3 +96,5 @@
+ 96
+ 97
+ 98
++99
++100
diff --git a/sys/src/cmd/test/patch/create.expected b/sys/src/cmd/test/patch/create.expected
new file mode 100644
index 000000000..08fe19ca4
--- /dev/null
+++ b/sys/src/cmd/test/patch/create.expected
@@ -0,0 +1,12 @@
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
diff --git a/sys/src/cmd/test/patch/create.patch b/sys/src/cmd/test/patch/create.patch
new file mode 100644
index 000000000..021c9d7f3
--- /dev/null
+++ b/sys/src/cmd/test/patch/create.patch
@@ -0,0 +1,15 @@
+--- /dev/null
++++ create.out
+@@ -1,0 +1,12 @@
++1
++2
++3
++4
++5
++6
++7
++8
++9
++10
++11
++12
diff --git a/sys/src/cmd/test/patch/delete.expected b/sys/src/cmd/test/patch/delete.expected
new file mode 100644
index 000000000..f00c965d8
--- /dev/null
+++ b/sys/src/cmd/test/patch/delete.expected
@@ -0,0 +1,10 @@
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
diff --git a/sys/src/cmd/test/patch/delete.patch b/sys/src/cmd/test/patch/delete.patch
new file mode 100644
index 000000000..2b6c1b5aa
--- /dev/null
+++ b/sys/src/cmd/test/patch/delete.patch
@@ -0,0 +1,15 @@
+--- delete.out
++++ /dev/null
+@@ -1,12 +1,0 @@
+-1
+-2
+-3
+-4
+-5
+-6
+-7
+-8
+-9
+-10
+-11
+-12
diff --git a/sys/src/cmd/test/patch/header.expected b/sys/src/cmd/test/patch/header.expected
new file mode 100644
index 000000000..190423f88
--- /dev/null
+++ b/sys/src/cmd/test/patch/header.expected
@@ -0,0 +1,100 @@
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
diff --git a/sys/src/cmd/test/patch/header.in b/sys/src/cmd/test/patch/header.in
new file mode 100644
index 000000000..1f5a7255c
--- /dev/null
+++ b/sys/src/cmd/test/patch/header.in
@@ -0,0 +1,93 @@
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+13
+12
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
diff --git a/sys/src/cmd/test/patch/header.patch b/sys/src/cmd/test/patch/header.patch
new file mode 100644
index 000000000..b8ac887aa
--- /dev/null
+++ b/sys/src/cmd/test/patch/header.patch
@@ -0,0 +1,54 @@
+diff should handle headers just fine, so
+this file contains a few lines of header
+and footer, with a couple of false starts,
+consisting of lines starting with
+--- some words
+but no immediately following
++++ words
+lines
+
+--- header.in
++++ header.out
+@@ -1,3 +1,5 @@
++1
++2
+ 3
+ 4
+ 5
+@@ -10,8 +12,8 @@
+ 12
+ 13
+ 14
+-13
+-12
++15
++16
+ 17
+ 18
+ 19
+@@ -35,6 +37,8 @@
+ 37
+ 38
+ 39
++40
++41
+ 42
+ 43
+ 44
+@@ -80,6 +84,7 @@
+ 84
+ 85
+ 86
++87
+ 88
+ 89
+ 90
+@@ -91,3 +96,5 @@
+ 96
+ 97
+ 98
++99
++100
+-- signature footer: should not get picked up
+and here is the footer that should
+also be ignored.
diff --git a/sys/src/cmd/test/patch/mkfile b/sys/src/cmd/test/patch/mkfile
new file mode 100644
index 000000000..959f8becb
--- /dev/null
+++ b/sys/src/cmd/test/patch/mkfile
@@ -0,0 +1,5 @@
+</$objtype/mkfile
+
+TEST=patch
+
+</sys/src/cmd/mktest
diff --git a/sys/src/cmd/test/patch/multifile.patch b/sys/src/cmd/test/patch/multifile.patch
new file mode 100644
index 000000000..15abb859c
--- /dev/null
+++ b/sys/src/cmd/test/patch/multifile.patch
@@ -0,0 +1,89 @@
+--- multifile2.in
++++ multifile2.out
+@@ -1,21 +1,19 @@
+-77777
+ 77778
+ 77779
+ 77780
+ 77781
+ 77782
+-77783
+-77784
+-77785
+-77786
+-77787
+-77788
+ 77789
++77788
++77787
++77786
++77785
++77784
++77783
+ 77790
+ 77791
+ 77792
+ 77793
+ 77794
+-77795
+ 77796
+ 77797
+
+of course, each patch can have its own comment
+lines mixed in, so we should handle these.
+--- multifile1.in
++++ multifile1.out
+@@ -14,16 +14,6 @@
+ 12
+ 17
+ 18
+-19
+-20
+-21
+-22
+-23
+-24
+-25
+-26
+-27
+-28
+ 29
+ 30
+ 31
+@@ -32,20 +22,6 @@
+ 34
+ 35
+ 36
+-37
+-38
+-39
+-42
+-43
+-44
+-45
+-46
+-47
+-48
+-49
+-50
+-51
+-52
+ 53
+ 54
+ 55
+@@ -73,11 +49,11 @@
+ 77
+ 78
+ 79
+-80
+-81
+-82
+-83
+ 84
++83
++82
++81
++80
+ 85
+ 86
+ 88
diff --git a/sys/src/cmd/test/patch/multifile1.expected b/sys/src/cmd/test/patch/multifile1.expected
new file mode 100644
index 000000000..36218e8fd
--- /dev/null
+++ b/sys/src/cmd/test/patch/multifile1.expected
@@ -0,0 +1,69 @@
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+13
+12
+17
+18
+29
+30
+31
+32
+33
+34
+35
+36
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+84
+83
+82
+81
+80
+85
+86
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
diff --git a/sys/src/cmd/test/patch/multifile1.in b/sys/src/cmd/test/patch/multifile1.in
new file mode 100644
index 000000000..1f5a7255c
--- /dev/null
+++ b/sys/src/cmd/test/patch/multifile1.in
@@ -0,0 +1,93 @@
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+13
+12
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
diff --git a/sys/src/cmd/test/patch/multifile2.expected b/sys/src/cmd/test/patch/multifile2.expected
new file mode 100644
index 000000000..d8c0a5bde
--- /dev/null
+++ b/sys/src/cmd/test/patch/multifile2.expected
@@ -0,0 +1,19 @@
+77778
+77779
+77780
+77781
+77782
+77789
+77788
+77787
+77786
+77785
+77784
+77783
+77790
+77791
+77792
+77793
+77794
+77796
+77797
diff --git a/sys/src/cmd/test/patch/multifile2.in b/sys/src/cmd/test/patch/multifile2.in
new file mode 100644
index 000000000..649b7dc6a
--- /dev/null
+++ b/sys/src/cmd/test/patch/multifile2.in
@@ -0,0 +1,21 @@
+77777
+77778
+77779
+77780
+77781
+77782
+77783
+77784
+77785
+77786
+77787
+77788
+77789
+77790
+77791
+77792
+77793
+77794
+77795
+77796
+77797
diff --git a/sys/src/cmd/test/patch/nop.expected b/sys/src/cmd/test/patch/nop.expected
new file mode 100644
index 000000000..f00c965d8
--- /dev/null
+++ b/sys/src/cmd/test/patch/nop.expected
@@ -0,0 +1,10 @@
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
diff --git a/sys/src/cmd/test/patch/patch.rc b/sys/src/cmd/test/patch/patch.rc
new file mode 100755
index 000000000..28c222939
--- /dev/null
+++ b/sys/src/cmd/test/patch/patch.rc
@@ -0,0 +1,39 @@
+#!/bin/rc -e
+
+fn check{
+ if(! cmp $1 $2){
+ >[2=1] echo fail: $1 $2
+ >[2=1] diff -u $1 $2
+ exit mismatch
+ }
+ status=()
+}
+
+fn checkpatch{
+ rm -f $1.out
+ ../../$O.patch $1.patch
+ check $1.out $1.expected
+}
+
+checkpatch basic
+checkpatch header
+checkpatch create
+
+seq 12 > delete.out
+../../$O.patch delete.patch
+test ! -f delete.out
+
+rm -f multifile^(1 2)^.out
+chmod 640 multifile1.in
+chmod 400 multifile2.in
+../../$O.patch multifile.patch
+check multifile1.out multifile1.expected
+check multifile2.out multifile2.expected
+
+if(! ~ `{walk -ex multifile1.out} --rw-r-----)
+ exit misperm1
+if(! ~ `{walk -ex multifile2.out} --rw-------)
+ exit misperm2
+
+
+status=()
diff --git a/sys/src/cmd/test/ramfs.rc b/sys/src/cmd/test/ramfs.rc
new file mode 100755
index 000000000..9ec516ce2
--- /dev/null
+++ b/sys/src/cmd/test/ramfs.rc
@@ -0,0 +1,40 @@
+#!/bin/rc
+rfork e
+
+attach='
+Tversion 8192 9P2000
+Rversion 8192 9P2000
+Tattach 1 -1 '^$user^' ''''
+Rattach {0,0,d}
+Twalk 1 2
+Rwalk
+'
+
+fn assert{
+ aux/9pcon -ac '../6.ramfs -i' >/dev/null || exit $status
+}
+
+
+# attach
+assert <<.
+$attach
+.
+
+# create/write/read
+assert <<.
+$attach
+Tcreate 2 testfile 777 2
+Rcreate {1,0,0} 0
+Twrite 2 0 hello
+Rwrite 5
+Tclunk 2
+Rclunk
+Twalk 1 2 testfile
+Rwalk {1,2,0}
+Topen 2 0
+Ropen {1,2,0} 0
+Tread 2 0 5
+Rread hello
+Tclunk 2
+Rclunk
+.
diff --git a/sys/src/cmd/test/test.rc b/sys/src/cmd/test/test.rc
new file mode 100755
index 000000000..633581d56
--- /dev/null
+++ b/sys/src/cmd/test/test.rc
@@ -0,0 +1,135 @@
+#!/bin/rc
+
+rfork e
+
+ERROR=0
+FAILED=0
+
+fn t{
+ # $1 -> exit code
+ # $2 -> $test expression
+
+ expect=$1
+ shift
+
+ # check for syntax errors
+ syntax=`{../$O.test $* >[2=1]}
+ if(~ $"syntax ''){
+ switch($expect){
+ case 0
+ if(! ../$O.test $*) failed $expect $*
+ case 1
+ if(../$O.test $*) failed $expect $*
+ }
+ }
+ if not
+ error
+}
+
+fn error{
+ echo
+ echo ' '^$"syntax
+ ERROR=`{echo $ERROR 1 + p | dc}
+}
+
+fn failed{
+ echo -n $1^': test' $*(2-)^'^: failed'
+ echo ' failed'
+ FAILED=`{echo $FAILED 1 + p | dc}
+}
+
+
+t 0 b '=' b
+t 1 b '!=' b
+t 0 '(' b '=' b ')'
+t 1 ! '(' b '=' b ')'
+t 1 ! -f /bin/rc
+
+t 0 -h '=' -h
+t 0 -o '=' -o
+#t 1 -f '=' h
+t 1 -h '=' f
+t 1 -o '=' f
+t 1 f '=' -o
+
+t 0 '(' -h '=' -h ')'
+t 1 '(' a '=' -h ')'
+#t 1 '(' -f '=' h ')'
+t 0 -h '=' -h -o a
+t 0 '(' -h '=' -h ')' -o 1
+t 0 -h '=' -h -o -h '=' -h
+t 0 '(' -h '=' -h ')' -o '(' -h '=' -h ')'
+t 0 roedelheim '=' roedelheim
+t 1 potsdam '=' berlin-dahlem
+
+t 0 -d /
+t 0 -d / -a a '!=' b
+t 1 -z -z
+t 0 -n -n
+
+t 0 0
+t 0 '(' 0 ')'
+t 0 '-E'
+t 0 -X -a -X
+t 0 -XXX
+t 0 '(' -E ')'
+t 0 true -o X
+t 0 true -o -X
+t 0 '(' '(' '(' a '=' a ')' -o 1 ')' -a 1 ')'
+#t 1 -h /
+t 0 -r /
+t 1 -w /dev/zero
+t 0 -w /dev/null
+t 1 -x /dev/null
+t 0 -x /bin/rc
+#t 0 -c /dev/null
+#t 0 -b /dev/fd0a -o -b /dev/rfd0a -o true
+t 0 -f /adm/users
+t 0 -s /adm/users
+
+t 1 ! '(' 700 -le 1000 -a -n 1 -a 20 '=' 20 ')'
+t 0 100 -eq 100
+t 0 100 -lt 200
+t 1 1000 -lt 200
+t 0 1000 -gt 200
+t 0 1000 -ge 200
+t 0 1000 -ge 1000
+
+t 1 2 -ne 2
+t 0 0 -eq 0
+t 1 -5 -eq 5
+t 0 '(' 0 -eq 0 ')'
+t 1 1 -eq 0 -o a '=' a -a 1 -eq 0 -o a '=' aa
+#t 0 '" +123 " -eq 123'
+#t 1 '"-123 " -gt " -1"'
+t 0 123 -gt -123
+t 0 -0 -eq +0
+t 1 +0 -gt 0
+t 0 0 -eq 0
+t 0 0000 -eq -0
+t 0 -1 -gt -2
+t 1 1 -gt 2
+t 1 4294967296 -eq 0
+t 0 12345678901234567890 -eq +12345678901234567890
+
+t 1 '' -o ''
+t 1 '' -a ''
+t 1 a -a ''
+t 0 a -a ! ''
+t 1 ''
+t 0 ! ''
+
+t 0 1 -eq 1
+t 1 ! 1 -eq 1
+t 0 ! ! 1 -eq 1
+t 1 ! ! ! 1 -eq 1
+t 1 ! '(' XXX -o XXX ')'
+t 0 ! '(' ! '(' XXX -o XXX ')' ')'
+
+if(! ~ $ERROR 0 || ! ~ $FAILED 0){
+ echo
+ echo 'Syntax errors:' $ERROR 'Failed:' $FAILED
+}
+if(! ~ $ERROR 0 || ! ~ $FAILED 0)
+ exit 'failures'
+exit ''
diff --git a/sys/src/cmd/test/zones.rc b/sys/src/cmd/test/zones.rc
new file mode 100755
index 000000000..065399d39
--- /dev/null
+++ b/sys/src/cmd/test/zones.rc
@@ -0,0 +1,19 @@
+#!/bin/rc
+
+rfork en
+
+msg=()
+for(f in /adm/timezone/*){
+ if(! ~ $f /adm/timezone/README){
+ cat $f >/env/timezone
+ tm=`{../6.date -f'WW, DD MMM YYYY hh:mm:ss Z'}
+ x=`{../6.date -n}
+ y=`{../6.seconds $"tm}
+ if(! ~ $x $y){
+ echo $f $tm $x $y are not equal
+ msg=($msg $f)
+ }
+ }
+}
+
+exit $"msg