3 # Shell script used to test MINIX.
23 echo -n "Shell test 1 "
29 if test -r $f; then : ; else echo sh1 cannot
read $f; exit 1; fi
32 echo "abcdefghijklmnopqrstuvwxyz" >alpha
33 echo "ABCDEFGHIJKLMNOPQRSTUVWXYZ" >ALPHA
34 echo "0123456789" >num
35 echo "!@#$%^&*()_+=-{}[]:;<>?/.," >special
38 cat alpha ALPHA num rc passwd special
>tmp
44 cp /etc
/rc
/etc
/passwd foo
45 if cmp -s foo
/rc
/etc
/rc
; then : ; else bomb
"Error on cp test 1"; fi
46 if cmp -s foo
/passwd
/etc
/passwd
; then : ; else bomb
"Error on cp test 2"; fi
50 cat num num num num num
>y
53 if cmp -s x1 x2
; then : ; else bomb
"Error on cat test 1"; fi
55 if cmp -s y z
; then : ; else bomb
"Error on cat test 2"; fi
58 if test `basename /usr/ast/foo.c .c` != 'foo'
59 then bomb
"Error on basename test 1"
62 if test `basename a/b/c/d` != 'd'; then bomb
"Error on basename test 2"; fi
64 #Test cdiff, sed, and patch
65 cp $f x.c
# x.c is a copy $f
66 echo "/a/s//#####/g" >s
# create sed script
67 sed -f s
<x.c
>y.c
# y.c is new version of x.c
68 diff -c x.c y.c
>y
# y is cdiff listing
69 patch x.c y
2>/dev
/null
# z should be y.c
70 if cmp -s x.c y.c
; then : ; else bomb
"Error in cdiff test"; fi
74 ls /etc
>x
# x = list of /etc
75 grep -v "passwd" x
>y
# y = x except for /etc/passwd
76 comm -3 x y
>z
# should only be 1 line, /etc/passwd
78 if cmp -s w z
; then : else bomb
"Error on comm test 1"; fi
80 comm -13 x y
>z
# should be empty
81 if test -s z
; then bomb
"Error on comm test 2"; fi
85 compress -fc $f >x.c.Z
# compress the test file
86 compress -cd x.c.Z
>y
# uncompress it
87 if cmp -s $f y
; then : else bomb
"Error in compress test 1"; fi
91 cp $f x
# copy $f to x
99 ed
2>/dev
/null x
<y
>/dev
/null
107 ed
2>/dev
/null x
<y
>/dev
/null
108 if cmp -s x
$f; then : ; else bomb
"Error in ed test 1"; fi
112 if test `expr 1 + 1` != 2; then bomb
"Error on expr test 1"; fi
113 if test `expr 10000 - 1` != 9999; then bomb
"Error on expr test 2"; fi
114 if test `expr 100 '*' 50` != 5000; then bomb
"Error on expr test 3"; fi
115 if test `expr 120 / 5` != 24; then bomb
"Error on expr test 4"; fi
116 if test `expr 143 % 7` != 3; then bomb
"Error on expr test 5"; fi
119 if test $a != '101'; then bomb
"Error on expr test 6"; fi
123 if cmp -s alpha z
; then : else bomb
"Error on fgrep test 1"; fi
125 if test -s z
; then bomb
"Error on fgrep test 2"; fi
128 if cmp -s w num
; then : ; else bomb
"Error fgrep test 3"; fi
134 find .
-name Rabbit
-print >z
135 if cmp -s y z
; then : else bomb
"Error on find test 1"; fi
136 find .
-name Bunny
-print >z
137 if test -s z
; then bomb
"Error on find test 2"; fi
142 if cmp -s x alpha
; then : ; else bomb
"Error on grep test 1"; fi
144 if test -s x
; then bomb
"Error on grep test 2"; fi
146 if cmp -s x alpha
; then : ; else bomb
"Error on grep test 3"; fi
147 grep -s "a" XXX_nonexistent_file_XXX
>x
148 if test -s x
; then echo "Error on grep test 4"; fi
149 if grep -s "a" alpha
>x
; then : else bomb
"Error on grep test 5"; fi
150 if grep -s "a" ALPHA
>x
; then bomb
"Error on grep test 6"; fi
154 if cmp -s x alpha
; then : else bomb
"Error on head test 1"; fi
157 if cmp -s x y
; then : else bomb
"Error on head test 2"; fi
172 if cmp -s w w1
; then : ; else bomb
"Error on ls test 1"; fi
179 if test -d Foo
; then : ; else bomb
"Error on mkdir test 1"; fi
180 if test -d Bar
; then : ; else bomb
"Error on mkdir test 2"; fi
182 if test -d Foo
; then bomb
"Error on mkdir test 3"; fi
183 if test -d Foo
; then bomb
"Error on rmdir test 4"; fi
190 if cmp -s $f z
; then : ; else bomb
"Error on mv test 1"; fi
193 if cmp -s $f MVDIR
/y
; then : ; else bomb
"Error on mv test 2"; fi
196 rev <f1 |
head -1 >ahpla
197 echo "zyxwvutsrqponmlkjihgfedcba" >x
198 if cmp -s x ahpla
; then : ; else bomb
"Error on rev test 1"; fi
201 if cmp -s $f x
; then bomb
"Error on rev test 2"; fi
202 if cmp -s $f y
; then : ; else bomb
"Error on rev test 3"; fi
212 if cmp -s w
$f; then : ; else bomb
"Error on shar test 1"; fi
213 if cmp -s x alpha
; then : ; else bomb
"Error on shar test 2"; fi
214 if cmp -s y ALPHA
; then : ; else bomb
"Error on shar test 3"; fi
215 if cmp -s z num
; then : ; else bomb
"Error on shar test 4"; fi
221 if cmp -s x1 x2
; then : ; else bomb
"Error on sort test 1"; fi
244 if cmp -s y x1
; then : ; else bomb
"Error on sort test 2"; fi
246 if cmp -s x2 z
; then : ; else bomb
"Error on sort test 3"; fi
247 sort -k 2n
<x |
head -1 >y
249 if cmp -s y z
; then : ; else bomb
"Error on sort test 4"; fi
253 if cmp -s x special
; then : ; else bomb
"Error on tail test 1"; fi
283 if cmp -s y answer
; then : ; else bomb
"Error on tsort test 1"; fi
288 if test -s x.uue
; then : ; else bomb
"Error on uue/uud test 1"; fi
291 if cmp -s x
$f; then : ; else bomb
"Error on uue/uud test 2"; fi
293 compress -fc x
>x.Z
2>/dev
/null
298 if cmp -s x
$f; then : ; else bomb
"Error on uue/uud test 3"; fi