1#!/bin/bash 2# Copyright (c) 2021 Huawei Device Co., Ltd. 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/) 17HOST_OUT=$TOP/out/test 18PREFIX=$TOP/ 19# collect and convert all gcno and gcda to test.info 20lcov -c -d $HOST_OUT -o test.info --gcov-tool $DIR/gcov.sh 21if [ $? -ne 0 ]; then 22 echo "Install lcov: sudo apt install lcov" 23fi 24 25# filter out system headers 26lcov -r test.info \ 27 '/usr/include/*' \ 28 '*/out/*' \ 29 '*/src/base/*' \ 30 '*/third_party/*' \ 31 -o test.info 32 33# generate html report 34genhtml -o out/test/html test.info --prefix $PREFIX 35