-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun-unit-tests.sh
executable file
·51 lines (37 loc) · 1.25 KB
/
run-unit-tests.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
#!/bin/bash
source tests/test_library.sh
# convert text version of unit test results to JUnit XML
function main()
{
make -s test_private | tee tests.log
cat tests.log | grep UnitTest > tests.log.1
count=$(cat tests.log.1 | wc -l)
total_failures=$(cat tests.log | grep FAILED | wc -l)
#echo "line $count"
# \see http://help.catchsoftware.com/display/ET/JUnit+Format
(
biosal_test_junit_open_xml_stream
biosal_test_junit_start_testsuite "unit-tests" $count $total_failures
for i in $(seq 1 $count)
do
line=$(head -n $i tests.log.1|tail -n1)
tests=$(echo $line | awk '{print $8}')
failures=$(echo $line | awk '{print $6}')
name=$(echo $line | awk '{print $2}')
error=""
time_value="-"
# \see http://nelsonwells.net/2012/09/how-jenkins-ci-parses-and-displays-junit-output/
if test $failures != "0"
then
error=$line
fi
biosal_test_junit_emit_testcase "biosal.UnitTest" "$name" "$time_value" "$error"
done
biosal_test_junit_end_testsuite
biosal_test_junit_close_xml_stream
) > unit-tests.junit.xml
tests/summarize-tests.sh tests.log
echo "see unit-tests.junit.xml"
return $total_failures
}
main