blob: b4c8164f584b716cc64123b4cb725d57b2115b2d (
plain) (
blame)
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
|
#!/bin/bash
snum="unknown"
case "$#" in
1)
case "$1" in
"-?"|"--help")
echo "Usage: $0 [serial]"
exit 0
;;
esac
snum="$1"
serial="--serial $1"
;;
0)
snum=`dmesg | grep 'on chaoskey' | tail -1 | sed 's/.*chaoskey \([0-9a-f][0-9a-f]*\) on chaoskey.*/\1/'`
case "$snum" in
"")
serial=""
;;
*)
serial="--serial $snum"
;;
esac
;;
*)
echo "Usage: $0 [serial]"
exit 1
;;
esac
echo -e '\e[34mTesting ChaosKey' $snum '\e[39m'
tests="0:100 1:100 2:100 3:100 12:10 13:100 15:10000 16:250 202:1000 203:100 204:500 206:20 207:1000:32 209:1000"
PASS=0
FAIL=0
WEAK=0
../ao-tools/ao-chaosread/ao-chaosread $serial --infinite --bytes | for test in $tests done; do
case $test in
*:*:*)
dnum=`echo $test | sed 's/:.*$//'`
tnum=`echo $test | sed 's/^[^:]*://'`
tnum=`echo $test | sed 's/^[^:]*://' | sed 's/:.*$//'`
nnum=`echo $test | sed 's/^.*://'`
opts="-d $dnum -t $tnum -n $nnum"
;;
*:*)
dnum=`echo $test | sed 's/:.*$//'`
tnum=`echo $test | sed 's/^.*://'`
opts="-d $dnum -t $tnum"
;;
*)
dnum=$test
opts="-d $dnum"
;;
esac
case $dnum in
done)
echo DONE
;;
*)
echo TEST $dnum
dieharder -g 200 $opts
;;
esac
done | while read result; do
case "$result" in
TEST*)
testnum=`echo $result | sed 's/TEST //'`
;;
*PASSED*)
PASS=`expr $PASS + 1`
;;
*WEAK*)
WEAK=`expr $WEAK + 1`
;;
*FAILED*)
echo test $testnum failed
FAIL=`expr $FAIL + 1`
;;
DONE)
echo pass $PASS weak $WEAK fail $FAIL
case $PASS:$FAIL in
[1-9]*:0)
echo -e '\e[32m'ChaosKey $snum is ready to ship'\e[39m'
exit 0
;;
*)
echo -e '\e[31m'ChaosKey $snum failed'\e[39m'
exit 1
;;
esac
;;
esac
done
|