vm: fix potential null deref
[minix.git] / commands / swifi / run_swifi
blob1836e4af24a7f5e545c644e0cb1ec9c17673c0e1
1 #!/bin/sh
3 LABEL=e1000_0
4 NAME=e1000
5 EXEDIR=/usr/src/drivers/$NAME
6 EXE=$EXEDIR/$NAME
8 :>log
10 start_driver()
12 service up $EXE -label $LABEL -script /etc/rs.single -period 3HZ
15 do_one()
17 # $1 = test-nr, $2 = count, $3 = seed
18 pid=''
19 while [ X"$pid" = X ]
21 pid=`ps ax | grep $NAME | grep -v grep |
22 sed 's,^[ ]*,,;s,[ ].*,,`
23 if [ X"$pid" != X ]
24 then
25 break
27 sleep 10
28 done
29 echo pid = $pid
30 ./swifi -f $EXE $pid $1 $2 $3 >/tmp/out
31 sleep 1
32 kill -0 $pid &&
33 echo "driver survived, params: test $1, count $2, seed $3" ||
34 start_driver
37 one_round()
39 # $1 = count, $2 = seed
40 count=$1
41 seed=$2
42 echo "Seed: $seed" >> log
43 sync
44 do_one 6 $count $seed # Source fault
45 do_one 5 $count $seed # Destination fault
46 do_one 8 $count $seed # Pointer fault
47 do_one 14 $count $seed # Interface fault
48 do_one 12 $count $seed # Loop fault
49 do_one 0 $count $seed # Text fault
50 do_one 4 $count $seed # Nop fault
53 # Start our own driver.
54 service down $LABEL
55 sleep 10 # Allow driver to die
56 start_driver
58 i=0
59 i=4000
60 while [ $i -lt 10000 ]
62 echo "Seed: $i"
63 one_round 100 $i
64 i=`expr $i + 1`
65 done