• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2# Copyright (c) Huawei Technologies Co., Ltd. 2021. All rights reserved.
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#     http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14set -e
15DIR=$(dirname $(realpath ${BASH_SOURCE[0]}))
16TOP=$(realpath $DIR/../../..)
17
18HOST_OUT=$TOP/out/ohos-arm-release/
19PREFIX=$TOP/developtools/profiler
20TEST_OUT=$TOP
21mkdir -p $TEST_OUT
22
23# collect and convert all gcno and gcda to test.info
24lcov -c -d $HOST_OUT -o $TEST_OUT/profiler_ut_coverage.info --gcov-tool $DIR/gcov.sh
25if [ $? -ne 0 ]; then
26    echo "Install lcov: sudo apt install lcov"
27fi
28
29# filter out system headers
30lcov -r profiler_ut_coverage.info \
31    '/usr/include/*' \
32    '*/out/*' \
33    '*/third_party/*' \
34    '*/test/unittest/*' \
35    '*.pb.h' \
36    '*v1/*' \
37    -o profiler_ut_coverage.info
38
39# generate html report
40genhtml --demangle-cpp -o $TEST_OUT/html $TEST_OUT/profiler_ut_coverage.info --prefix $PREFIX