huangyu c658ccf319 Update runtime_core code
Issue: https://gitee.com/openharmony/arkcompiler_runtime_core/issues/I5G96F
Test: Test262 suit, ark unittest, rk3568 XTS, ark previewer demo

Signed-off-by: huangyu <huangyu76@huawei.com>
Change-Id: I3f63d129a07deaa27a390f556dcaa5651c098185
2022-07-17 10:20:32 +08:00

55 lines
2.1 KiB
CMake

# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
option(ENABLE_MM_COVERAGE "Enable coverage-calculation for libpandabase" false)
find_program(
LCOV
NAMES "lcov"
DOC "Path to lcov executable")
if(NOT LCOV)
set(ENABLE_MM_COVERAGE false)
endif()
find_program(
GENHTML
NAMES "genhtml"
DOC "Path to genhtml executable")
if(NOT GENHTML)
set(ENABLE_MM_COVERAGE false)
endif()
if(ENABLE_MM_COVERAGE)
# Set coverage options
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
add_custom_target(mm_coverage DEPENDS arkbase_tests arkbase_mem_range_tests)
set(ADD_COV_FLAGS --quiet --rc lcov_branch_coverage=1)
add_custom_command(TARGET mm_coverage POST_BUILD
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
# Update current coverage info
COMMAND find ${CMAKE_CURRENT_BINARY_DIR}/* -iname "*.gcda" -delete
# run tests
COMMAND arkbase_tests
COMMAND arkbase_mem_range_tests
# coverage
COMMAND lcov --no-external -b ${PANDA_ROOT}/libpandabase -d ${CMAKE_CURRENT_BINARY_DIR} -c -o mm_coverage.info ${ADD_COV_FLAGS}
# html-file generation
COMMAND genhtml -o mm_coverage_report mm_coverage.info --ignore-errors source ${ADD_COV_FLAGS}
COMMAND echo "Coverage report path: ${CMAKE_CURRENT_BINARY_DIR}/mm_coverage_report"
# Delete temporary files to collect statistics
COMMAND rm mm_coverage.info
)
else()
message(STATUS "Coverage will not be calculated (may be enabled by -DENABLE_MM_COVERAGE=true ).")
endif(ENABLE_MM_COVERAGE)