Release version 0.0.9
[platform/core/security/privilege-info.git] / test / privilege-info-coverage.sh.in
1 #!/bin/bash
2
3 set -exuo pipefail
4
5 REPORT="@PROJECT_NAME@-coverage.info"
6 STDERR="@PROJECT_NAME@-coverage.stderr"
7 HTML_DIR="@PROJECT_NAME@-coverage"
8
9 SRCS_DIR="/usr/src/debug/@PROJECT_NAME@-@PROJECT_VERSION@"
10
11 # create dir for the report
12 mkdir $HTML_DIR
13
14 # remove old gcda files
15 find / -iname "*.gcda" -exec rm {} \;
16
17 # launch unit tests
18 privilege-info-tests
19
20 # copy source files
21 cp -rp $SRCS_DIR*/* "@CMAKE_BINARY_DIR@"
22
23 # copy gcda files
24 cp -r "@COVERAGE_BUILD_DIR@"/* "@COVERAGE_DIR@"
25
26 # prepare report
27 rm -f $STDERR
28 lcov --no-external -c -d "@COVERAGE_DIR@" -b "@CMAKE_BINARY_DIR@" -o $REPORT 2>$STDERR
29 lcov -r $REPORT "@CMAKE_BINARY_DIR@/test/*" -o $REPORT
30
31 # check warnings
32 if [ -s $STDERR ]
33 then
34         echo "Warnings detected (see $STDERR). Aborting."
35         exit 1
36 fi
37
38 # html
39 genhtml $REPORT --output-directory $HTML_DIR/