-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtest.sh
110 lines (97 loc) · 2.17 KB
/
test.sh
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#!/bin/bash
set -e
make clean all >/dev/null
function newsecret()
{
secret=`head -c 100 </dev/urandom | md5sum | awk '{ print $1 }'`
if [ `echo -n $secret | wc -c` != 32 ]
then
echo Expected secret to be 32 bytes.
exit 1
fi
echo "Generated secret: $secret" >&2
echo $secret >/dev/wom
}
# THRESHOLD and N can be exported from the parent shell
if [ "$THRESHOLD" = "" ]
then THRESHOLD=100
fi
if [ "$N" = "" ]
then N=100
fi
if [ "$VUNETID" = "" ]
then
echo "Please export your vu-net-id using:"
echo ' $ export VUNETID=bgs137'
exit 0
fi
MELTDOWN=${VUNETID}-meltdown
SPECTRE=${VUNETID}-spectre
if [ "$1" = "batch" ]
then
for q in 1 2
do
for bin in $MELTDOWN $SPECTRE
do
if [ ! -e $bin ]
then echo "No $bin found"
continue
fi
if [ "$THRESHOLD" = "" ]
then
echo "Reliability of $N $bin with autotuned threshold.."
else
if [ $bin = "$SPECTRE" ]
then
continue
fi
echo "Reliability of $N $bin with given threshold of $THRESHOLD.."
fi
newsecret
rm -f log
for x in `seq 1 $N`
do
rm -f out
if [ "$THRESHOLD" = "" ]
then
./$bin >out 2>>errlog
else
./$bin $THRESHOLD >out 2>>errlog
fi
grep -q $secret out && echo -n "." || echo -n "?"
cat out >>log
done
echo ''
echo -n 'Success rate: '
grep -c $secret log || true
echo ''
done
unset THRESHOLD
done
exit 0
fi
# Single mode
for q in 1 2
do
for bin in $MELTDOWN $SPECTRE
do
if [ "$THRESHOLD" = "" ]
then
echo " * $bin - autotuned threshold"
newsecret
./$bin >out
else
if [ $bin = "$SPECTRE" ]
then
continue
fi
echo " * $bin - given threshold of $THRESHOLD"
newsecret
./$bin $THRESHOLD >out
fi
cat out
grep -q $secret out && echo pass || echo fail
echo ''
done
unset THRESHOLD
done