xref: /minix/minix/commands/swifi/tests/run_swifi (revision 0a6a1f1d)
1#!/bin/sh
2
3LABEL=e1000_0
4NAME=e1000
5EXEDIR=/service
6EXE=$EXEDIR/$NAME
7
8:>log
9
10start_driver()
11{
12	service up $EXE -label $LABEL -script /etc/rs.single -period 3HZ
13}
14
15do_one()
16{
17	# $1 = test-nr, $2 = count, $3 = seed
18	pid=''
19	while [ X"$pid" = X ]
20	do
21		pid=`ps ax | grep $NAME | grep -v grep |
22			sed 's,^[ 	]*,,;s,[ 	].*,,'`
23		if [ X"$pid" != X ]
24		then
25			break
26		fi
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
35}
36
37one_round()
38{
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
51}
52
53# Start our own driver.
54service down $LABEL
55sleep 10	# Allow driver to die
56start_driver
57
58i=0
59i=4000
60while [ $i -lt 10000 ]
61do
62	echo "Seed: $i"
63	one_round 100 $i
64	i=`expr $i + 1`
65done
66