-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.sh
executable file
·103 lines (85 loc) · 2.06 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
#!/bin/bash
TMPFILE=$(pwd)'/tmp.txt'
CLASSPATH=$(pwd)'/src/examples/'
# delete old results
if [ -f result.txt ]
then
rm result.txt
fi
# replace $1 by $2 in file $3
replace()
{
searchterm=$1
replaceterm=$2
sed -e "s/$searchterm/$replaceterm/ig" $3 > $TMPFILE
mv $TMPFILE $3
}
runJPF()
{
conf=$1
step=$2
# UNIX timestamp concatenated with nanoseconds
T="$(date +%s%N)"
jpf $conf
T="$(($(date +%s%N)-T))"
# Milliseconds
M="$((T/1000000))"
case $step in
"1")
echo "SPF time in miliseconds: ${M}" >> result.txt
;;
"2")
echo "JSBMC time in miliseconds: ${M}" >> result.txt
;;
"3")
echo "JCBMC (D = 10) time in miliseconds: ${M}" >> result.txt
;;
"4")
echo "JCBMC (D = 200) time in miliseconds: ${M}" >> result.txt
;;
esac
}
# test a single .jpf file with SPF, JSBMC, JCBMC
testJPF()
{
# This should be the .jpf file
conf=$1
echo $conf >> result.txt
testSPF $conf
replace 'symbolic.dp.*' 'symbolic.dp = no_solver' $conf
replace 'search.multiple_errors.*' 'search.multiple_errors = true' $conf
#Third step: test with JCBMC, bmc.batch=10
replace '.*listener.*' 'listener = uk.ac.qmul.bmc.concur.BmcConcurListenerUsingSmtlib2' $conf
replace 'bmc.batch.*' 'bmc.batch = 10' $conf
runJPF $conf 3
#Fourth step: test with JCBMC, bmc.batch=200
replace 'bmc.batch.*' 'bmc.batch = 200' $conf
runJPF $conf 4
#Second step: test with JSBMC
replace 'listener.*' 'listener = uk.ac.qmul.bmc.BmcListenerUsingSmtlib2' $conf
runJPF $conf 2
echo '' >> result.txt
}
testSPF()
{
# This should be the .jpf file
conf=$1
#echo $conf >> result.txt
# First step: test SPF with z3
replace 'listener.*' '#listener' $conf
replace 'symbolic.dp.*' 'symbolic.dp = z3' $conf
replace 'search.multiple_errors.*' 'search.multiple_errors = false' $conf
runJPF $conf 1
}
testAll()
{
FILES=$CLASSPATH'*.jpf'
for f in $FILES
do
testJPF $f
done
}
#testJPF $CLASSPATH'RedBlackTree.jpf'
#testJPF $CLASSPATH'classic/BubbleSortAssertionNegated.jpf'
testAll
#testJPF $CLASSPATH'ArrayFalse.jpf'