aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/venti/srv/tester
blob: de04bfec15a256851276c0ab873e029a708f8ffb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/usr/local/plan9/bin/rc

vtmp=/home/tmp
venti=tcp!127.1!17034
url=127.1:8901

fn reformat {
	if(! test -f $vtmp/arena)
		dd bs'='1048576 count'='100 if'='/dev/zero of'='$vtmp/arena
	if(! test -f $vtmp/bloom)
		dd bs'='1048576 count'='128 if'='/dev/zero of'='$vtmp/bloom
	if(! test -f $vtmp/isect)
		dd bs'='1048576 count'='10 if'='/dev/zero of'='$vtmp/isect
	if(! test -f $vtmp/check)
		dd bs'='1048576 count'='20 if'='/dev/zero of'='$vtmp/check

	echo '
		index main
		isect '$vtmp'/isect
		arenas '$vtmp'/arena
		bloom '$vtmp'/bloom
		webroot '$PLAN9'/src/cmd/venti/srv/www
		mem 64M
		icmem 64M
		bcmem 64M
		queuewrites
		addr tcp!*!17034
		httpaddr tcp!*!8901
	' >$vtmp/vtmp.conf

	./o.fmtarenas -a 40M -b 8k arenas $vtmp/arena
	./o.fmtbloom $vtmp/bloom
	./o.fmtisect -b 8k isect $vtmp/isect
	./o.fmtindex $vtmp/vtmp.conf
}

fn venti {
	./o.venti -c $vtmp/vtmp.conf >$vtmp/venti.log >[2=1]
}

fn killventi {
	killall -9 o.venti
}

fn die {
	echo $*
	# no killventi - leave for debugging
	echo '(leaving venti running)'
	exit 1
}

fn testdcachesync {
	echo '>>>' testdcachesync...
	echo '*' reformat
	reformat
	echo '*' venti
	venti
	sleep 2
	echo '*' vac
	9 time vac $PLAN9/src/cmd/venti >$vtmp/a.vac
	echo '*' flushdcache
	hget http://$url/flushdcache
	echo '*' kill venti
	killventi
	echo '*' venti
	venti
	sleep 2
	echo '*' read
	if(venti/read `{cat $vtmp/a.vac} >/dev/null >[2=1])
		echo worked
	if not
		die 'could not find block!'
}

testdcachesync
killventi