-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathrun_tests.sh
More file actions
268 lines (226 loc) · 7.14 KB
/
run_tests.sh
File metadata and controls
268 lines (226 loc) · 7.14 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
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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
#!/usr/bin/env bash
# Script for automated test running.
#
# The results of each test can be found on log files that generate after execution.
#
# These logs will generate inside each test's directory.
#
# Authors: Tamara Gutierrez R.
# Diego Ortego P.
# Carlos Gonzalez C.
test_build_enabled=1
test_unit_enabled=1
test_cmd_enabled=1
test_bug_delay_enabled=0
test_load_enabled=1
test_sgp4_enabled=1
test_tm_io_enabled=1
test_file_enabled=0
while getopts ":b:u:c:d:l:s:t:f:h" opt; do
case ${opt} in
b )
test_build_enabled=$OPTARG
;;
u )
test_unit_enabled=$OPTARG
;;
c )
test_cmd_enabled=$OPTARG
;;
d )
test_bug_delay_enabled=$OPTARG
;;
l )
test_load_enabled=$OPTARG
;;
s )
test_sgp4_enabled=$OPTARG
;;
t )
test_tm_io_enabled=$OPTARG
;;
f )
test_file_enabled=$OPTARG
;;
\? )
echo "Invalid option: $OPTARG" 1>&2
;;
: )
echo "Invalid option: $OPTARG requires an argument" 1>&2
;;
esac
done
shift $((OPTIND -1))
# Gets the current execution directory (the absolute path to this script)
SCRIPT_PATH="$( cd "$(dirname "$0")" ; pwd -P )"
WORKSPACE=${SCRIPT_PATH}
# Prints the current workspace path, for debugging purposes
echo ${WORKSPACE}
# ---------------- --TEST BUILD ------------------
# The test log is called test_unit_log.txt
# Tests for all storage modes
if [ $test_build_enabled -eq 1 ]
then
TEST_NAME="test_build"
for ARCH in "X86" "RPI"
do
for ST_MODE in "RAM" "SQLITE" "FLASH"
do
echo ""
echo "**** Testing ${TEST_NAME} for arch ${ARCH}, storage ${ST_MODE} ****"
rm -rf build_test
# Just build the simple app with the test's parameters
cmake -B build_test -G Ninja -DSCH_OS=LINUX -DSCH_ARCH=${ARCH} -DAPP=simple -DTEST=0 -DSCH_ST_MODE=${ST_MODE} -DSCH_STORAGE_TRIPLE_WR=1 && cmake --build build_test -j4
status=$?
[ $status -eq 0 ] || exit 1
done
done
cd ${WORKSPACE}
fi
# ---------------- --TEST_UNIT ------------------
# The test log is called test_unit_log.txt
# Tests for all storage modes
if [ $test_unit_enabled -eq 1 ]
then
TEST_NAME="test_unit"
for ST_MODE in "RAM" "SQLITE" "FLASH"
do
echo ""
echo "**** Testing ${TEST_NAME} for storage ${ST_MODE} ****"
rm -rf build_test
# build the unitest with the test's parameters
cmake -B build_test -G Ninja -DSCH_OS=LINUX -DSCH_ARCH=X86 -DAPP=${TEST_NAME} -DTEST=1 -DSCH_ST_MODE=${ST_MODE} -DSCH_STORAGE_TRIPLE_WR=1 && cmake --build build_test -j4
[ $? -eq 0 ] || exit $?
# Runs the test, saving a log file
cd build_test/test/${TEST_NAME}
rm -f ${TEST_NAME}_${ST_MODE}_log.txt
./suchai-test #| cat >> ${TEST_NAME}_${ST_MODE}_log.txt
[ $? -eq 0 ] || exit $?
echo ""
cd -
done
cd ${WORKSPACE}
fi
## ---------------- --TEST_INT_CMD ------------------
#
## The main test log is called test_int_cmd_log.txt
## That log is compares with test_int_cmd_log_base.txt
## The result of the comparison is in test_int_cmd_comparator_log.txt
#
if [ $test_cmd_enabled -eq 1 ]
then
TEST_NAME="test_int_cmd"
rm -rf build_test
# build the cmdtest with the test's parameters
cmake -B build_test -G Ninja -DSCH_OS=LINUX -DSCH_ARCH=X86 -DAPP=${TEST_NAME} -DTEST=1 -DSCH_ST_MODE=RAM && cmake --build build_test -j4
[ $? -eq 0 ] || exit $?
# Runs the test, saving a log file
rm -f /test/${TEST_NAME}/${TEST_NAME}_log.txt
./build_test/test/${TEST_NAME}/suchai-test > test/${TEST_NAME}/${TEST_NAME}_log.txt
[ $? -eq 0 ] || exit $?
echo ""
cd -
cd ${WORKSPACE}
#
## Makes result comparison
cd test/${TEST_NAME}
rm -f ${TEST_NAME}_comparator_log.txt
python logs_comparator.py | cat >> ${TEST_NAME}_comparator_log.txt
echo ""
cd ${WORKSPACE}
#
fi
## ---------------- --TEST_LOAD ------------------
#
## The test log is called test_int_load_log.txt
#
if [ $test_load_enabled -eq 1 ]
then
TEST_NAME="test_int_load"
echo ""
echo "**** Testing ${TEST_NAME} ****"
rm -rf build_test
# build the test with the test's parameters
cmake -B build_test -G Ninja -DSCH_OS=LINUX -DSCH_ARCH=X86 -DAPP=${TEST_NAME} -DTEST=1 -DSCH_ST_MODE=RAM && cmake --build build_test -j4
[ $? -eq 0 ] || exit $?
./build_test/test/${TEST_NAME}/suchai-test > test/${TEST_NAME}/${TEST_NAME}_log.txt
[ $? -eq 0 ] || exit $?
echo ""
cd -
cd ${WORKSPACE}
fi
## ---------------- --TEST_INT_BUG_DELAY ------------------
#
## The test log is called test_int_bug_delay_log.txt
if [ $test_bug_delay_enabled -eq 1 ]
then
TEST_NAME="test_int_bug_delay"
echo ""
echo "**** Testing ${TEST_NAME} ****"
rm -rf build_test
# build the test with the test's parameters
cmake -B build_test -G Ninja -DSCH_OS=LINUX -DSCH_ARCH=X86 -DAPP=${TEST_NAME} -DTEST=1 -DSCH_ST_MODE=RAM && cmake --build build_test -j4
[ $? -eq 0 ] || exit $?
./build_test/test/${TEST_NAME}/suchai-test > test/${TEST_NAME}/${TEST_NAME}_log.txt
[ $? -eq 0 ] || exit $?
echo ""
cd -
cd ${WORKSPACE}
fi
## ---------------- --TEST_INT_SGP4 ------------------
#
## The test log is called test_int_sgp4_log.txt
if [ $test_sgp4_enabled -eq 1 ]
then
TEST_NAME="test_int_sgp4"
echo ""
echo "**** Testing ${TEST_NAME} ****"
rm -rf build_test
# build the test with the test's parameters
cmake -B build_test -G Ninja -DSCH_OS=LINUX -DSCH_ARCH=X86 -DAPP=${TEST_NAME} -DTEST=1 -DSCH_ST_MODE=RAM && cmake --build build_test -j4
[ $? -eq 0 ] || exit $?
./build_test/test/${TEST_NAME}/suchai-test > test/${TEST_NAME}/${TEST_NAME}_log.txt
[ $? -eq 0 ] || exit $?
echo ""
cd -
cd ${WORKSPACE}
fi
## ---------------- --TEST_INT_TM_IO ------------------
#
## The test log is called test_int_tm_io_log.txt
if [ $test_tm_io_enabled -eq 1 ]
then
TEST_NAME="test_int_tm_io"
echo ""
echo "**** Testing ${TEST_NAME} ****"
rm -rf build_test
# build the test with the test's parameters
cmake -B build_test -G Ninja -DSCH_OS=LINUX -DSCH_ARCH=X86 -DAPP=${TEST_NAME} -DTEST=1 -DSCH_ST_MODE=RAM -DSCH_COMM_NODE=3 && cmake --build build_test -j4
[ $? -eq 0 ] || exit $?
./build_test/test/${TEST_NAME}/suchai-test > test/${TEST_NAME}/${TEST_NAME}_log.txt
[ $? -eq 0 ] || exit $?
echo ""
cd -
cd ${WORKSPACE}
fi
## ---------------- --TEST_INT_FILE-- ------------------
#
## The test log is called test_int_file_log.txt
if [ $test_file_enabled -eq 1 ]
then
TEST_NAME="test_int_file"
echo ""
echo "**** Testing ${TEST_NAME} ****"
rm -rf build_test
# build the test with the test's parameters
cmake -B build_test -G Ninja -DSCH_OS=LINUX -DSCH_ARCH=X86 -DAPP=${TEST_NAME} -DTEST=1 -DSCH_COMM_NODE=3 && cmake --build build_test -j4
[ $? -eq 0 ] || exit $?
./build_test/test/${TEST_NAME}/suchai-test > test/${TEST_NAME}/${TEST_NAME}_log.txt
[ $? -eq 0 ] || exit $?
echo ""
cd -
cd ${WORKSPACE}
fi
#TODO: DELETE THIS EXIT AFTER FIXING THE REST OF THE TESTS!
exit 0
#TODO: REMEMBER TO DELETE THIS EXIT!