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 # Reset the file system to its original, pristine state
163 gmake obj
/fs
/fs.img
>$out
169 runtest1
-tag 'fs i/o [testfsipc]' testfsipc \
171 ! 'idle loop can do I/O' \
173 quicktest
'read_block [testfsipc]' \
174 'superblock is good' \
176 quicktest
'write_block [testfsipc]' \
177 'write_block is good' \
179 quicktest
'read_bitmap [testfsipc]' \
180 'read_bitmap is good' \
182 quicktest
'alloc_block [testfsipc]' \
183 'alloc_block is good' \
185 quicktest
'file_open [testfsipc]' \
186 'file_open is good' \
188 quicktest
'file_get_block [testfsipc]' \
189 'file_get_block is good' \
191 quicktest
'file_truncate [testfsipc]' \
192 'file_truncate is good' \
194 quicktest
'file_flush [testfsipc]' \
195 'file_flush is good' \
197 quicktest
'file rewrite [testfsipc]' \
198 'file rewrite is good' \
200 quicktest
'serv_* [testfsipc]' \
201 'serve_open is good' \
202 'serve_map is good' \
203 'serve_close is good' \
204 'stale fileid is good' \
206 echo PART A SCORE
: $score/55
212 runtest1
-tag 'motd display [writemotd]' writemotd \
214 'This is /motd, the message of the day.' \
216 'This is the NEW message of the day!' \
219 runtest1
-tag 'motd change [writemotd]' writemotd \
221 'This is the NEW message of the day!' \
223 ! 'This is /motd, the message of the day.' \
227 runtest1
-tag 'spawn via icode [icode]' icode \
228 'icode: read /motd' \
229 'This is /motd, the message of the day.' \
230 'icode: spawn /init' \
232 'init: data seems okay' \
234 'init: bss seems okay' \
235 "init: args: 'init' 'initarg1' 'initarg2'" \
238 echo PART B SCORE
: $score/45
240 if [ $partascore -lt 55 -o $score -lt 45 ]; then