Debian Codegraph @

tests/test-recoverage.sh

raw
1 #!/bin/bash
2
3 # SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
4 #
5 # SPDX-License-Identifier: LGPL-3.0-or-later
6 set -ex
7
8 BUILD_DIR=`pwd`/../build/tests/
9 HTML_DIR=${BUILD_DIR}/html
10 XML_DIR=${BUILD_DIR}/report
11
12 export ASAN_OPTIONS="halt_on_error=0"
13
14 # back to project directroy
15 cd ..
16
17 cmake -Bbuild -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_EXAMPLES=OFF -DBUILD_DOCS=OFF -DEnableCov=ON -DDSYSINFO_PREFIX=/tmp
18
19 cmake --build build -j$(nproc)
20
21 cd $BUILD_DIR
22
23 ./ut-DtkCore --gtest_output=xml:${XML_DIR}/report_dtkcore.xml
24
25 # find *.gcda from build dir
26 lcov -d ../ -c -o coverage_all.info
27 lcov --remove coverage_all.info "*/tests/*" "*/usr/include*" "*build/src*" "*build-ut/src*" --output-file coverage.info
28 cd ..
29 genhtml -o $HTML_DIR $BUILD_DIR/coverage.info && mv ${BUILD_DIR}/html/index.html ${BUILD_DIR}/html/cov_dtkcore.html
30
31 test -e ${BUILD_DIR}/asan.log* && mv ${BUILD_DIR}/asan.log* ${BUILD_DIR}/asan_dtkcore.log || touch ${BUILD_DIR}/asan.log
32