forked from paulQuei/gtest-and-coverage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
make_all.sh
executable file
·43 lines (34 loc) · 867 Bytes
/
make_all.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
rm -rf build
GTEST=googletest-release-1.8.1
if [ -e ${GTEST} ]
then
echo "${GTEST} has already been unzipped, skip."
else
echo "Begin to unzip ${GTEST}.zip"
unzip ${GTEST}.zip
echo "Unzip google test finish"
fi
mkdir build
cd build
# Make Google Test in './build/gtest/' folder
mkdir gtest
cd gtest
cmake ../../${GTEST}
make
cd ..
cmake ../
make
# Run Test
./unit_test
cd ../
COVERAGE_FILE=coverage.info
REPORT_FOLDER=coverage_report
lcov --rc lcov_branch_coverage=1 -c -d build -o ${COVERAGE_FILE}_tmp
lcov --rc lcov_branch_coverage=1 -e ${COVERAGE_FILE}_tmp "*src*" -o ${COVERAGE_FILE}
genhtml --rc genhtml_branch_coverage=1 ${COVERAGE_FILE} -o ${REPORT_FOLDER}
cp -a ${COVERAGE_FILE} build/${COVERAGE_FILE}
rm -rf ${COVERAGE_FILE}_tmp
rm -rf ${COVERAGE_FILE}
if [[ "$OSTYPE" == "darwin"* ]]; then
open ./${REPORT_FOLDER}/index.html
fi