20 # suns can't echo -n, and Mac OS X can't echo "x\c"
21 # assume argument has no doublequotes
22 awk 'BEGIN { printf("'"$*"'"); }' </dev
/null
26 # Find the address of the kernel readline function,
27 # which the kernel monitor uses to read commands interactively.
28 brkaddr
=`grep 'readline$' obj/kern/kernel.sym | sed -e's/ .*$//g'`
29 #echo "brkaddr $brkaddr"
31 # Run Bochs, setting a breakpoint at readline(),
32 # and feeding in appropriate commands to run, then quit.
33 t0
=`date +%s.%N 2>/dev/null`
35 # The sleeps are necessary in some Bochs to
36 # make it parse each line separately. Sleeping
37 # here sure beats waiting for the timeout.
38 echo vbreak
0x8:0x
$brkaddr
41 # EOF will do just fine to quit.
45 bochs
-q 'display_library: nogui' \
46 'parport1: enabled=1, file="bochs.out"'
49 t1
=`date +%s.%N 2>/dev/null`
50 time=`echo "scale=1; ($t1-$t0)/1" | sed 's/.N/.0/g' | bc 2>/dev/null`
54 # Usage: runtest <tagname> <defs> <strings...>
56 perl
-e "print '$1: '"
57 rm -f obj
/kern
/init.o obj
/kern
/kernel obj
/kern
/bochs.img
58 [ "$preservefs" = y
] ||
rm -f obj
/fs
/fs.img
81 perl
-e "print '$1: '"
87 perl
-e "print qq|$1: OK $2\n|";
89 score
=`expr $pts + $score`
103 if egrep "^$i\$" bochs.out
>/dev
/null
105 echo "got unexpected line '$i'"
114 egrep "^$i\$" bochs.out
>/dev
/null
127 if [ "$okay" = "yes" ]
129 score
=`expr $pts + $score`
136 # Usage: runtest1 [-tag <tagname>] <progname> [-Ddef...] STRINGS...
151 while expr "x$1" : 'x-D.*' >/dev
/null
; do
152 runtest1_defs
="DEFS+='$1' $runtest1_defs"
155 runtest
"$tag" "DEFS='-DTEST=_binary_obj_user_${prog}_start' DEFS+='-DTESTSIZE=_binary_obj_user_${prog}_size' $runtest1_defs" "$@"
160 # 20 points - run-icode
162 runtest1
-tag 'updated file system switch [icode]' icode \
163 'icode: read /motd' \
164 'This is /motd, the message of the day.' \
165 'icode: spawn /init' \
167 'init: data seems okay' \
169 'init: bss seems okay' \
170 "init: args: 'init' 'initarg1' 'initarg2'" \
174 runtest1
-tag 'PTE_SHARE [testpteshare]' testpteshare \
175 'fork handles PTE_SHARE right' \
176 'spawn handles PTE_SHARE right' \
178 # 10 points - run-testfdsharing
180 runtest1
-tag 'fd sharing [testfdsharing]' testfdsharing \
181 'read in parent succeeded' \
182 'read in child succeeded'
184 # 10 points - run-testpipe
186 runtest1
-tag 'pipe [testpipe]' testpipe \
187 'pipe read closed properly' \
188 'pipe write closed properly' \
190 # 10 points - run-testpiperace
192 runtest1
-tag 'pipe race [testpiperace]' testpiperace \
193 ! 'child detected race' \
194 ! 'RACE: pipe appears closed' \
195 "race didn't happen" \
197 # 10 points - run-testpiperace2
199 runtest1
-tag 'pipe race 2 [testpiperace2]' testpiperace2 \
200 ! 'RACE: pipe appears closed' \
201 ! 'child detected race' \
202 "race didn't happen" \
204 # 10 points - run-primespipe
207 echo 'The primespipe test has up to 2 minutes to complete. Be patient.'
208 runtest1
-tag 'primespipe' primespipe \
209 ! 1 2 3 ! 4 5 ! 6 7 ! 8 ! 9 \
210 ! 10 11 ! 12 13 ! 14 ! 15 ! 16 17 ! 18 19 \
211 ! 20 ! 21 ! 22 23 ! 24 ! 25 ! 26 ! 27 ! 28 29 \
212 ! 30 31 ! 32 ! 33 ! 34 ! 35 ! 36 37 ! 38 ! 39 \
215 # 20 points - run-testshell
218 runtest1
-tag 'shell [testshell]' testshell \
219 'shell ran correctly' \
221 echo "Score: $score/100"
223 if [ $score -lt 100 ]; then