-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.sh
executable file
·81 lines (66 loc) · 1.46 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
#!/bin/bash
if [[ $# != 3 && $# != 4 ]]; then
echo "Usage: run.sh <cmd> <impl> <nthr> [ntimes]"
exit 1
fi
cmd=$1
impl=$2
nthr=$3
if [[ $# == 4 ]]; then
ntimes=$4
else
ntimes=10
fi
if [ $cmd = "addcnt" ]; then
nobj=10
elif [ $cmd = "racey" ]; then
nobj=64
fi
COLOR='\e[1;32m'
function cecho() {
echo -e "$COLOR$*\e[0m"
}
function process_memorder_log() {
local maxid
local i
let maxid=$nthr-1
for i in `seq 0 $maxid`; do
./reorder-memop $nobj $i
done
./merge-memop $nobj $nthr
}
function process_log() {
if [[ $impl == "rtmcommit" ]]; then
./merge-commit $nthr
else
process_memorder_log $1
fi
}
for i in `seq 1 $ntimes`; do
rm -f replay-log/{memop*,version*,sorted-*,commit*}
cecho "$i Record with $nthr threads"
if ! ./$cmd-$impl-rec $nthr 2>debug-record > result-record; then
cat debug-record result-record
exit 1
fi
cecho "Processing log ..."
process_log $nobj || exit 1
cecho "$i Replay with $nthr threads"
replaycmd=$cmd-play
if [[ $impl == "rtmcommit" ]]; then
replaycmd=$cmd-rtmcommit-play
fi
if ! ./$replaycmd $nthr 2>debug-play > result-play; then
cat debug-play result-play
exit 1
fi
diff result-record result-play
if [ $? == 0 ]; then
if [ ${i} != $ntimes ]; then
echo
fi
else
echo -e "\e[1;31mReplay result wrong\e[0m"
exit 1
fi
done