Release 0.1.66
[platform/core/security/key-manager.git] / unit-tests / key-manager-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@-@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 ckm-unit-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@/unit-tests/*" -o $REPORT
30 lcov -r $REPORT "@CMAKE_BINARY_DIR@/common/*" -o $REPORT
31
32 # check warnings
33 if [ -s $STDERR ]
34 then
35     echo "Warnings detected (see $STDERR). Aborting."
36     exit 1
37 fi
38
39 # html
40 genhtml $REPORT --output-directory $HTML_DIR/