-
Notifications
You must be signed in to change notification settings - Fork 51
/
run_tests.sh
executable file
·49 lines (41 loc) · 978 Bytes
/
run_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
#!/bin/bash
set -xe
basepath=`pwd`
scriptName=${0}
function printUsage {
echo "Usage:"
echo " ${scriptName} <builddir> [artifactdir]"
exit 1
}
while getopts ":b:a:h" opt; do
case ${opt} in
b ) builddir=$OPTARG
;;
a ) artifactdir=$OPTARG
;;
h|\? ) printUsage
;;
esac
done
if [ -z "${builddir}" ]
then
builddir=build
echo "Use default build director ${builddir}"
fi
mkdir -p ${builddir}
echo "Go to build directory ${builddir}"
cd ${builddir}
cmake -DCMAKE_BUILD_TYPE=Coverage -DBUILD_UNIT_TEST=ON -DCTEST_RESULT_CODE=no ..
make -j8
rm -rf test/unit-test/results.xml
rm -rf coverage.xml
ctest --output-on-failure
gcovr -r .. --branches -e ../test/ -e ../3rd-party-libs/ --xml -o coverage.xml
echo "archive artifacts under ${artifactdir}"
cd ${basepath}
if [ ! -d "${artifactdir}" ]
then
mkdir -p ${artifactdir}
fi
cp ${builddir}/test/unit-test/results.xml ${artifactdir}/
cp ${builddir}/coverage.xml ${artifactdir}/