-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtitle_test.sh
More file actions
86 lines (73 loc) · 2.45 KB
/
title_test.sh
File metadata and controls
86 lines (73 loc) · 2.45 KB
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
#!/bin/bash
# settings to change
project="3b"
removelog=1
times=200
# title="TestConfChangeRemoveLeader3B"
# title="TestSplitRecoverManyClients3B"
# title="TestConfChangeRecoverManyClients3B"
# title="TestSplitConfChangeSnapshotUnreliableRecover3B"
# title="TestConfChangeRemoveLeader3B"
# title="TestConfChangeSnapshotUnreliableRecover3B"
# title="TestSplitConfChangeSnapshotUnreliableRecoverConcurrentPartition3B"
# title="TestConfChangeUnreliableRecover3B"
# title="TestSnapshotUnreliableRecoverConcurrentPartition2C"
# title="TestBasicConfChange3B"
# title="TestConfChange3B"
# title="TestConfChangeRecover3B"
# title="TestBasicConfRestart3B"
# title="TestConfChangeSnapshotUnreliableRecoverConcurrentPartition3B"
# title="TestConfChangeUnreliableRecover3B"
LOG_LEVEL=debug
# no change below this line
if [ ! -d "./test_output" ]; then
mkdir "./test_output"
fi
logdir="test_output/$project/$title"
if [ ! -d $logdir ]; then
mkdir $logdir
fi
lastdir="$logdir/`date +%Y%m%d%H%M%S`"
if [ ! -d $lastdir ]; then
mkdir $lastdir
fi
summary="$lastdir/summary.log"
echo "times. pass. fail. panic. error. runtime. panicinfo." >> $summary
statistics=0
totalpass=0
totalfail=0
totalpanic=0
totalruntime=0
for i in $(seq 1 $times)
do
logfile="${lastdir}/$i.log"
start=$(date +%s)
echo "start $i times"
(LOG_LEVEL=${LOG_LEVEL} GO111MODULE=on go test -v --count=1 --parallel=1 -p=1 ./kv/test_raftstore -run ^${title}$ || true) >> $logfile
end=$(date +%s)
pass_count=$(grep -i "PASS" $logfile | wc -l)
echo "pass count: $pass_count"
if [ $statistics -eq 1 ]; then
fail_count=$(grep -i "fail" $logfile | wc -l)
echo "fail count: $fail_count"
panic_count=$(grep -i "panic" $logfile | wc -l)
echo "panic count: $panic_count"
error_count=$(grep -i "error" $logfile | wc -l)
echo "error count: $error_count"
panic_info=$(grep -m 1 -i "panic" $logfile)
fi
runtime=$((end-start))
echo "$i. $pass_count. $fail_count. $panic_count. $error_count. $runtime. $panic_info." >> $summary
totalpass=$((totalpass+pass_count))
totalfail=$((totalfail+fail_count))
totalpanic=$((totalpanic+panic_count))
totalruntime=$((totalruntime+runtime))
# if pass, remove the log
if [ $removelog -eq 1 ]; then
if [ $pass_count -eq 2 ]; then
rm $logfile
fi
sleep 1
fi
done
echo "total $totalfail $totalpanic $totalruntime" >> $summary