148f512ceSopenharmony_ci#!/bin/bash 248f512ceSopenharmony_ci# Copyright (c) 2021 Huawei Device Co., Ltd. 348f512ceSopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License"); 448f512ceSopenharmony_ci# you may not use this file except in compliance with the License. 548f512ceSopenharmony_ci# You may obtain a copy of the License at 648f512ceSopenharmony_ci# 748f512ceSopenharmony_ci# http://www.apache.org/licenses/LICENSE-2.0 848f512ceSopenharmony_ci# 948f512ceSopenharmony_ci# Unless required by applicable law or agreed to in writing, software 1048f512ceSopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS, 1148f512ceSopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1248f512ceSopenharmony_ci# See the License for the specific language governing permissions and 1348f512ceSopenharmony_ci# limitations under the License. 1448f512ceSopenharmony_ciset -e 1548f512ceSopenharmony_ciDIR=$(dirname $(realpath ${BASH_SOURCE[0]})) 1648f512ceSopenharmony_ciTOP=$(realpath $DIR/../../../../../..) 1748f512ceSopenharmony_ci 1848f512ceSopenharmony_ciHOST_OUT=$TOP/out/rk3568/ 1948f512ceSopenharmony_ciTEST_OUT=$HOST_OUT/tests/unittest/developtools/hiperf/coverage 2048f512ceSopenharmony_cimkdir -p $TEST_OUT 2148f512ceSopenharmony_ci 2248f512ceSopenharmony_ci# collect and convert all gcno and gcda to test.info 2348f512ceSopenharmony_cilcov -c -d $HOST_OUT -o $TEST_OUT/hiperf_ut_coverage.info --gcov-tool $DIR/gcov.sh 2448f512ceSopenharmony_ciif [ $? -ne 0 ]; then 2548f512ceSopenharmony_ci echo "Install lcov: sudo apt install lcov" 2648f512ceSopenharmony_cifi 2748f512ceSopenharmony_ci 2848f512ceSopenharmony_ci# filter out system headers 2948f512ceSopenharmony_cilcov -r $TEST_OUT/hiperf_ut_coverage.info \ 3048f512ceSopenharmony_ci '/usr/include/*' \ 3148f512ceSopenharmony_ci '*/third_party/*' \ 3248f512ceSopenharmony_ci '*/utils/native/base/*' \ 3348f512ceSopenharmony_ci '*/test/unittest/*' \ 3448f512ceSopenharmony_ci '*.pb.h' \ 3548f512ceSopenharmony_ci '*v1/*' \ 3648f512ceSopenharmony_ci '*/out/*' \ 3748f512ceSopenharmony_ci '*/commonlibrary/c_utils/base/include/*' \ 3848f512ceSopenharmony_ci '*/foundation/*' \ 3948f512ceSopenharmony_ci -o $TEST_OUT/hiperf_ut_coverage.info 4048f512ceSopenharmony_ci 4148f512ceSopenharmony_ci# generate html report 4248f512ceSopenharmony_cigenhtml --demangle-cpp -o $TEST_OUT/html $TEST_OUT/hiperf_ut_coverage.info 43