-
Notifications
You must be signed in to change notification settings - Fork 10
/
csmake.sh
executable file
·194 lines (171 loc) · 5.03 KB
/
csmake.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
#!/bin/bash
#**********************************************************************************************************************
#
# AUTHORS : Space Concordia 2014, Joseph
#
# FILE : cscomtest.sh
#
# PURPOSE : csmake template
# -g Group
# -q build for Q6
# -n TestName
# -s skip the tests
# -u usage
# -v verbose (to get all DEBUG output)
#
# ex. ./cscomtest.sh => run ALL the tests
# ./cscomtest.sh -g deletelog => run ALL deletelog tests
# ./cscomtest.sh -n nameOfTheTest
#
#**********************************************************************************************************************
ALLTESTS="./bin/AllTests"
ARGUMENTS=""
GROUP=""
TODEVNULL=1
MBCC=0
MULTIPLE_RUN=1
CLEAN=0
SKIP_TEST=0
GROUP_LIST=(getlog deletelog net2com commander settime) # insert the group of the test here.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#
# NAME : usage
#
#------------------------------------------------------------------------------
usage()
{
echo "usage : cscomtest.sh [-u] [-g testGroup] [-n testName] [-m numberOfRuns][-v][-s]"
echo " -c clean before build"
echo " -m numberOfRuns run the specified tests 'numberOfRuns' times and stop if error"
echo " -n TestName"
echo " -q build for Q6"
echo " -s skip the tests"
echo " -u usage"
echo " -v verbose : to get all DEBUG info (N.B. DEBUG info can be turned on/off in the makefile ... -DDEBUG)"
printf "%s" " -g group : one of those -> "
for gr in ${GROUP_LIST[@]}; do
printf "%s " $gr
done
echo
}
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#
# Parsing command line arguments
#
#------------------------------------------------------------------------------
argType=""
while getopts "cqg:n:uvm:s" opt; do
case "$opt" in
c) CLEAN=1
;;
g) GROUP=$OPTARG
;;
m) MULTIPLE_RUN=$OPTARG
;;
n) SINGLE_TEST="-n $OPTARG"
;;
q) MBCC=1
;;
s) SKIP_TEST=1
;;
u)
usage
exit 0;
;;
v) TODEVNULL=0 ;;
esac
done
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#
# Test groups
#
#------------------------------------------------------------------------------
if [ "$GROUP" != "" ]; then
case $GROUP in
'getlog') ARGUMENTS="-g GetLogTestGroup" ;;
'deletelog') ARGUMENTS="-g DeleteLogTestGroup" ;;
'net2com') ARGUMENTS="-g Net2ComTestGroup" ;;
'commander') ARGUMENTS="-g CommanderTestGroup";;
'settime') ARGUMENTS="-g SetTimeTestGroup";;
esac
fi
ARGUMENTS="$ARGUMENTS $SINGLE_TEST"
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#
# Clean
#
#------------------------------------------------------------------------------
if [ $CLEAN -eq 1 ]; then
echo ""
echo "=== Clean ==="
make clean || exit 1
fi
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#
# Build x86
#
#------------------------------------------------------------------------------
if [ $SKIP_TEST -eq 1 ]; then
echo ""
echo "=== Build x86 ==="
make buildBin
if [ $? -ne 0 ]; then
echo -e "\e[31m Build x86 failed\e[0m"
exit -1
else
echo -e "\e[32m Build x86 success!\e[0m"
fi
fi
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#
# Build mbcc
#
#------------------------------------------------------------------------------
if [ $MBCC -ne 0 ]; then
echo ""
echo "=== Build mbcc ==="
make buildQ6
if [ $? -ne 0 ]; then
echo -e "\e[31m Build mbcc failed\e[0m"
exit -1
else
echo -e "\e[32m Build mbcc success!\e[0m"
fi
fi
#
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#
# PURPOSE : run/build the tests
#
#-----------------------------------------------------------------------------
if [ $SKIP_TEST -eq 0 ]; then
echo ""
echo "=== Build tests ==="
make test
if [ $? -ne 0 ]; then
echo -e "\e[31m Build tests failed\e[0m"
exit -1
else
echo -e "\e[32m Build tests success!\e[0m"
fi
echo ""
echo "=== Run tests ==="
counter=0
while [ $counter -lt $MULTIPLE_RUN ]; do
if [ $TODEVNULL -ne 0 ]; then
echo $ALLTESTS $ARGUMENTS 2>/dev/null
$ALLTESTS $ARGUMENTS 2>/dev/null
else
echo $ALLTESTS $ARGUMENTS
$ALLTESTS $ARGUMENTS
fi
if [ $? -ne 0 ]; then
echo -e "\e[31m UTest Failure!\e[0m"
exit 1
else
echo -e "\e[32m UTest Success!\e[0m"
fi
sleep 1
counter=$(($counter+1))
done
fi