forked from raden/KTAB
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathKTAB_Test_Apps.sh
executable file
·194 lines (179 loc) · 6.67 KB
/
KTAB_Test_Apps.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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# Copyright KAPSARC. MIT Open Source License.
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#!/bin/bash
#
# usage: KTAB_Test_Apps
# -------------------------------------------
rm *LOG.out
# initialize
difOK=0; errOK=0; endOK=0; allOK=0; testcnt=0
# demoutils
echo "Running demoutils"
testcnt=$[testcnt+1]
cd ./KTAB/kutils
./demoutils --vimcp 2 --vhc 3
mv ./kutils*_log.txt ../../demoutilsLOG.out
egrep "Start time|Finish time|Elapsed time|Scenario" -v ./20170530_ref-demoutils.txt > ../../ref.out
egrep "Start time|Finish time|Elapsed time|Scenario" -v ../../demoutilsLOG.out > ../../run.out
DUdif=$(diff -U 0 ../../ref.out ../../run.out | grep -v ^@ | wc -l)
DUerr=$(egrep -c "assert|fail|error|except|abort|dump|segment" ../../demoutilsLOG.out)
DUend=$(grep -c "Finish time" ../../demoutilsLOG.out)
# demomodel
echo "Running demomodel"
testcnt=$[testcnt+1]
cd ../kmodel
./demomodel --emod --sql --pce
mv ./kmodel*_log.txt ../../demomodelLOG.out
egrep "Start time|Finish time|Elapsed time|Scenario" -v ./20170530_ref-demomodel.txt > ../../ref.out
egrep "Start time|Finish time|Elapsed time|Scenario" -v ../../demomodelLOG.out > ../../run.out
DMdif=$(diff -U 0 ../../ref.out ../../run.out | grep -v ^@ | wc -l)
DMerr=$(egrep -c "assert|fail|error|except|abort|dump|segment" ../../demomodelLOG.out)
DMend=$(grep -c "Finish time" ../../demomodelLOG.out)
# leonapp
echo "Running leonApp"
testcnt=$[testcnt+1]
./leonApp --euEcon
mv ./leon*_log.txt ../../leonAppLOG.out
egrep "Start time|Finish time|Elapsed time|Scenario" -v ./20170530_ref-leonApp.txt > ../../ref.out
egrep "Start time|Finish time|Elapsed time|Scenario" -v ../../leonAppLOG.out > ../../run.out
LAdif=$(diff -U 0 ../../ref.out ../../run.out | grep -v ^@ | wc -l)
LAerr=$(egrep -c "assert|fail|error|except|abort|dump|segment" ../../leonAppLOG.out)
LAend=$(grep -c "Finish time" ../../leonAppLOG.out)
# mtchApp
echo "Running mtchApp"
testcnt=$[testcnt+1]
./mtchApp --mtchSUSN --maxSup
mv ./mtch*_log.txt ../../mtchAppLOG.out
grep "at this matching: " ./20170530_ref-mtchApp.txt > ../../ref.out
grep "at this matching: " ../../mtchAppLOG.out > ../../run.out
MAdif=$(diff -U 0 ../../ref.out ../../run.out | grep -v ^@ | wc -l)
MAerr=$(egrep -c "assert|fail|error|except|abort|dump|segment" ../../mtchAppLOG.out)
MAend=$(grep -c "Finish time" ../../mtchAppLOG.out)
# agdemo
echo "Running agdemo"
testcnt=$[testcnt+1]
cd ../../examples/agenda
./agdemo
mv ./agenda*_log.txt ../../agdemoLOG.out
egrep "Start time|Finish time|Elapsed time|Scenario" -v ./20170530_ref-agdemo.txt > ../../ref.out
egrep "Start time|Finish time|Elapsed time|Scenario" -v ../../agdemoLOG.out > ../../run.out
ADdif=$(diff -U 0 ../../ref.out ../../run.out | grep -v ^@ | wc -l)
ADerr=$(egrep -c "assert|fail|error|except|abort|dump|segment" ../../agdemoLOG.out)
ADend=$(grep -c "Finish time" ../../agdemoLOG.out)
# rpdemo
echo "Running rpdemo"
testcnt=$[testcnt+1]
cd ../reformpri
./rpdemo --si
mv ./rpdemo*_log.txt ../../rpdemoLOG.out
egrep "Start time|Finish time|Elapsed time|Scenario" -v ./20170530_ref-rpdemo.txt > ../../ref.out
egrep "Start time|Finish time|Elapsed time|Scenario" -v ../../rpdemoLOG.out > ../../run.out
RDdif=$(diff -U 0 ../../ref.out ../../run.out | grep -v ^@ | wc -l)
RDerr=$(egrep -c "assert|fail|error|except|abort|dump|segment" ../../rpdemoLOG.out)
RDend=$(grep -c "Finish time" ../../rpdemoLOG.out)
# minwater
echo "Running minwater"
testcnt=$[testcnt+1]
cd ../minwater
./mwdemo --waterMin
mv ./minwater*_log.txt ../../mwdemoLOG.out
grep "Best current value: " ./20170530_ref-mwdemo.txt > ../../ref.out
grep "Best current value: " ../../mwdemoLOG.out > ../../run.out
MWdif=$(diff -U 0 ../../ref.out ../../run.out | grep -v ^@ | wc -l)
MWerr=$(egrep -c "assert|fail|error|except|abort|dump|segment" ../../mwdemoLOG.out)
MWend=$(grep -c "Finish time" ../../mwdemoLOG.out)
# comsel
echo "Running csg"
testcnt=$[testcnt+1]
cd ../comsel
./csg --si
mv ./comsel*_log.txt ../../csgLOG.out
egrep "Start time|Finish time|Elapsed time|Scenario" -v ./20170530_ref-csg.txt > ../../ref.out
egrep "Start time|Finish time|Elapsed time|Scenario" -v ../../csgLOG.out > ../../run.out
CSdif=$(diff -U 0 ../../ref.out ../../run.out | grep -v ^@ | wc -l)
CSerr=$(egrep -c "assert|fail|error|except|abort|dump|segment" ../../csgLOG.out)
CSend=$(grep -c "Finish time" ../../csgLOG.out)
# pmatrix
echo "Running pmdemo"
testcnt=$[testcnt+1]
cd ../pmatrix
./pmdemo --pmm
mv ./pmatrix*_log.txt ../../pmdemoLOG.out
egrep "Start time|Finish time|Elapsed time|Scenario" -v ./20170530_ref-pmdemo.txt > ../../ref.out
egrep "Start time|Finish time|Elapsed time|Scenario" -v ../../pmdemoLOG.out > ../../run.out
PDdif=$(diff -U 0 ../../ref.out ../../run.out | grep -v ^@ | wc -l)
PDerr=$(egrep -c "assert|fail|error|except|abort|dump|segment" ../../pmdemoLOG.out)
PDend=$(grep -c "Finish time" ../../pmdemoLOG.out)
# talk
echo "========================="
echo "demoutils"
echo "------------"
echo "# Differences ${DUdif}"
echo "# Error Words ${DUerr}"
echo "# Finish lines ${DUend}"
echo "------------"
echo "demomodel"
echo "------------"
echo "# Differences ${DMdif}"
echo "# Error Words ${DMerr}"
echo "# Finish lines ${DMend}"
echo "------------"
echo "leonApp"
echo "------------"
echo "# Differences ${LAdif}"
echo "# Error Words ${LAerr}"
echo "# Finish lines ${LAend}"
echo "------------"
echo "mtchApp"
echo "------------"
echo "# Differences ${MAdif}"
echo "# Error Words ${MAerr}"
echo "# Finish lines ${MAend}"
echo "------------"
echo "agdemo"
echo "------------"
echo "# Differences ${ADdif}"
echo "# Error Words ${ADerr}"
echo "# Finish lines ${ADend}"
echo "------------"
echo "rpdemo"
echo "------------"
echo "# Differences ${RDdif}"
echo "# Error Words ${RDerr}"
echo "# Finish lines ${RDend}"
echo "------------"
echo "minwater"
echo "------------"
echo "# Differences ${MWdif}"
echo "# Error Words ${MWerr}"
echo "# Finish lines ${MWend}"
echo "------------"
echo "csg"
echo "------------"
echo "# Differences ${CSdif}"
echo "# Error Words ${CSerr}"
echo "# Finish lines ${CSend}"
echo "------------"
echo "pmdemo"
echo "------------"
echo "# Differences ${PDdif}"
echo "# Error Words ${PDerr}"
echo "# Finish lines ${PDend}"
echo "------------"
# summary
difOK=$[DUdif+DMdif+LAdif+MAdif+ADdif+RDdif+MWdif+CSdif+PDdif==0]
errOK=$[DUerr+DMerr+LAerr+MAerr+ADerr+RDerr+MWerr+CSerr+PDerr==0]
endOK=$[DUend+DMend+LAend+MAend+ADend+RDend+MWend+CSend+PDend==testcnt]
allOK=$[difOK==errOK==endOK==1]
echo "------------"
if [ $allOK -eq 0 ]; then
echo "At least one test condition failed!"
exit 42
else
echo "All test conditions passed!"
fi
echo "========================="
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# Copyright KAPSARC. MIT Open Source License.
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=