1*cf84ac9aSAndroid Build Coastguard Worker# =========================================================================== 2*cf84ac9aSAndroid Build Coastguard Worker# https://www.gnu.org/software/autoconf-archive/ax_code_coverage.html 3*cf84ac9aSAndroid Build Coastguard Worker# =========================================================================== 4*cf84ac9aSAndroid Build Coastguard Worker# 5*cf84ac9aSAndroid Build Coastguard Worker# SYNOPSIS 6*cf84ac9aSAndroid Build Coastguard Worker# 7*cf84ac9aSAndroid Build Coastguard Worker# AX_CODE_COVERAGE() 8*cf84ac9aSAndroid Build Coastguard Worker# 9*cf84ac9aSAndroid Build Coastguard Worker# DESCRIPTION 10*cf84ac9aSAndroid Build Coastguard Worker# 11*cf84ac9aSAndroid Build Coastguard Worker# Defines CODE_COVERAGE_CPPFLAGS, CODE_COVERAGE_CFLAGS, 12*cf84ac9aSAndroid Build Coastguard Worker# CODE_COVERAGE_CXXFLAGS and CODE_COVERAGE_LIBS which should be included 13*cf84ac9aSAndroid Build Coastguard Worker# in the CPPFLAGS, CFLAGS CXXFLAGS and LIBS/LIBADD variables of every 14*cf84ac9aSAndroid Build Coastguard Worker# build target (program or library) which should be built with code 15*cf84ac9aSAndroid Build Coastguard Worker# coverage support. Also defines CODE_COVERAGE_RULES which should be 16*cf84ac9aSAndroid Build Coastguard Worker# substituted in your Makefile; and $enable_code_coverage which can be 17*cf84ac9aSAndroid Build Coastguard Worker# used in subsequent configure output. CODE_COVERAGE_ENABLED is defined 18*cf84ac9aSAndroid Build Coastguard Worker# and substituted, and corresponds to the value of the 19*cf84ac9aSAndroid Build Coastguard Worker# --enable-code-coverage option, which defaults to being disabled. 20*cf84ac9aSAndroid Build Coastguard Worker# 21*cf84ac9aSAndroid Build Coastguard Worker# Test also for gcov program and create GCOV variable that could be 22*cf84ac9aSAndroid Build Coastguard Worker# substituted. 23*cf84ac9aSAndroid Build Coastguard Worker# 24*cf84ac9aSAndroid Build Coastguard Worker# Note that all optimization flags in CFLAGS must be disabled when code 25*cf84ac9aSAndroid Build Coastguard Worker# coverage is enabled. 26*cf84ac9aSAndroid Build Coastguard Worker# 27*cf84ac9aSAndroid Build Coastguard Worker# Usage example: 28*cf84ac9aSAndroid Build Coastguard Worker# 29*cf84ac9aSAndroid Build Coastguard Worker# configure.ac: 30*cf84ac9aSAndroid Build Coastguard Worker# 31*cf84ac9aSAndroid Build Coastguard Worker# AX_CODE_COVERAGE 32*cf84ac9aSAndroid Build Coastguard Worker# 33*cf84ac9aSAndroid Build Coastguard Worker# Makefile.am: 34*cf84ac9aSAndroid Build Coastguard Worker# 35*cf84ac9aSAndroid Build Coastguard Worker# @CODE_COVERAGE_RULES@ 36*cf84ac9aSAndroid Build Coastguard Worker# my_program_LIBS = ... $(CODE_COVERAGE_LIBS) ... 37*cf84ac9aSAndroid Build Coastguard Worker# my_program_CPPFLAGS = ... $(CODE_COVERAGE_CPPFLAGS) ... 38*cf84ac9aSAndroid Build Coastguard Worker# my_program_CFLAGS = ... $(CODE_COVERAGE_CFLAGS) ... 39*cf84ac9aSAndroid Build Coastguard Worker# my_program_CXXFLAGS = ... $(CODE_COVERAGE_CXXFLAGS) ... 40*cf84ac9aSAndroid Build Coastguard Worker# 41*cf84ac9aSAndroid Build Coastguard Worker# This results in a "check-code-coverage" rule being added to any 42*cf84ac9aSAndroid Build Coastguard Worker# Makefile.am which includes "@CODE_COVERAGE_RULES@" (assuming the module 43*cf84ac9aSAndroid Build Coastguard Worker# has been configured with --enable-code-coverage). Running `make 44*cf84ac9aSAndroid Build Coastguard Worker# check-code-coverage` in that directory will run the module's test suite 45*cf84ac9aSAndroid Build Coastguard Worker# (`make check`) and build a code coverage report detailing the code which 46*cf84ac9aSAndroid Build Coastguard Worker# was touched, then print the URI for the report. 47*cf84ac9aSAndroid Build Coastguard Worker# 48*cf84ac9aSAndroid Build Coastguard Worker# In earlier versions of this macro, CODE_COVERAGE_LDFLAGS was defined 49*cf84ac9aSAndroid Build Coastguard Worker# instead of CODE_COVERAGE_LIBS. They are both still defined, but use of 50*cf84ac9aSAndroid Build Coastguard Worker# CODE_COVERAGE_LIBS is preferred for clarity; CODE_COVERAGE_LDFLAGS is 51*cf84ac9aSAndroid Build Coastguard Worker# deprecated. They have the same value. 52*cf84ac9aSAndroid Build Coastguard Worker# 53*cf84ac9aSAndroid Build Coastguard Worker# This code was derived from Makefile.decl in GLib, originally licenced 54*cf84ac9aSAndroid Build Coastguard Worker# under LGPLv2.1+. 55*cf84ac9aSAndroid Build Coastguard Worker# 56*cf84ac9aSAndroid Build Coastguard Worker# LICENSE 57*cf84ac9aSAndroid Build Coastguard Worker# 58*cf84ac9aSAndroid Build Coastguard Worker# Copyright (c) 2012, 2016 Philip Withnall 59*cf84ac9aSAndroid Build Coastguard Worker# Copyright (c) 2012 Xan Lopez 60*cf84ac9aSAndroid Build Coastguard Worker# Copyright (c) 2012 Christian Persch 61*cf84ac9aSAndroid Build Coastguard Worker# Copyright (c) 2012 Paolo Borelli 62*cf84ac9aSAndroid Build Coastguard Worker# Copyright (c) 2012 Dan Winship 63*cf84ac9aSAndroid Build Coastguard Worker# Copyright (c) 2015 Bastien ROUCARIES 64*cf84ac9aSAndroid Build Coastguard Worker# Copyright (c) 2016-2017 The strace developers. 65*cf84ac9aSAndroid Build Coastguard Worker# 66*cf84ac9aSAndroid Build Coastguard Worker# This library is free software; you can redistribute it and/or modify it 67*cf84ac9aSAndroid Build Coastguard Worker# under the terms of the GNU Lesser General Public License as published by 68*cf84ac9aSAndroid Build Coastguard Worker# the Free Software Foundation; either version 2.1 of the License, or (at 69*cf84ac9aSAndroid Build Coastguard Worker# your option) any later version. 70*cf84ac9aSAndroid Build Coastguard Worker# 71*cf84ac9aSAndroid Build Coastguard Worker# This library is distributed in the hope that it will be useful, but 72*cf84ac9aSAndroid Build Coastguard Worker# WITHOUT ANY WARRANTY; without even the implied warranty of 73*cf84ac9aSAndroid Build Coastguard Worker# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 74*cf84ac9aSAndroid Build Coastguard Worker# General Public License for more details. 75*cf84ac9aSAndroid Build Coastguard Worker# 76*cf84ac9aSAndroid Build Coastguard Worker# You should have received a copy of the GNU Lesser General Public License 77*cf84ac9aSAndroid Build Coastguard Worker# along with this program. If not, see <https://www.gnu.org/licenses/>. 78*cf84ac9aSAndroid Build Coastguard Worker 79*cf84ac9aSAndroid Build Coastguard Worker#serial 24 80*cf84ac9aSAndroid Build Coastguard Worker##modified for strace project 81*cf84ac9aSAndroid Build Coastguard Worker 82*cf84ac9aSAndroid Build Coastguard WorkerAC_DEFUN([AX_CODE_COVERAGE],[ 83*cf84ac9aSAndroid Build Coastguard Worker dnl Check for --enable-code-coverage 84*cf84ac9aSAndroid Build Coastguard Worker AC_REQUIRE([AC_PROG_SED]) 85*cf84ac9aSAndroid Build Coastguard Worker 86*cf84ac9aSAndroid Build Coastguard Worker # allow to override gcov location 87*cf84ac9aSAndroid Build Coastguard Worker AC_ARG_WITH([gcov], 88*cf84ac9aSAndroid Build Coastguard Worker [AS_HELP_STRING([--with-gcov[=GCOV]], [use given GCOV for coverage (GCOV=gcov).])], 89*cf84ac9aSAndroid Build Coastguard Worker [_AX_CODE_COVERAGE_GCOV_PROG_WITH=$with_gcov], 90*cf84ac9aSAndroid Build Coastguard Worker [_AX_CODE_COVERAGE_GCOV_PROG_WITH=gcov]) 91*cf84ac9aSAndroid Build Coastguard Worker 92*cf84ac9aSAndroid Build Coastguard Worker AC_MSG_CHECKING([whether to build with code coverage support]) 93*cf84ac9aSAndroid Build Coastguard Worker AC_ARG_ENABLE([code-coverage], 94*cf84ac9aSAndroid Build Coastguard Worker AS_HELP_STRING([--enable-code-coverage], 95*cf84ac9aSAndroid Build Coastguard Worker [Whether to enable code coverage support]),, 96*cf84ac9aSAndroid Build Coastguard Worker enable_code_coverage=no) 97*cf84ac9aSAndroid Build Coastguard Worker 98*cf84ac9aSAndroid Build Coastguard Worker AM_CONDITIONAL([CODE_COVERAGE_ENABLED], [test x$enable_code_coverage = xyes]) 99*cf84ac9aSAndroid Build Coastguard Worker AC_SUBST([CODE_COVERAGE_ENABLED], [$enable_code_coverage]) 100*cf84ac9aSAndroid Build Coastguard Worker AC_MSG_RESULT($enable_code_coverage) 101*cf84ac9aSAndroid Build Coastguard Worker 102*cf84ac9aSAndroid Build Coastguard Worker AS_IF([ test "$enable_code_coverage" = "yes" ], [ 103*cf84ac9aSAndroid Build Coastguard Worker # check for gcov 104*cf84ac9aSAndroid Build Coastguard Worker AC_CHECK_TOOL([GCOV], 105*cf84ac9aSAndroid Build Coastguard Worker [$_AX_CODE_COVERAGE_GCOV_PROG_WITH], 106*cf84ac9aSAndroid Build Coastguard Worker [:]) 107*cf84ac9aSAndroid Build Coastguard Worker AS_IF([test "X$GCOV" = "X:"], 108*cf84ac9aSAndroid Build Coastguard Worker [AC_MSG_ERROR([gcov is needed to do coverage])]) 109*cf84ac9aSAndroid Build Coastguard Worker AC_SUBST([GCOV]) 110*cf84ac9aSAndroid Build Coastguard Worker 111*cf84ac9aSAndroid Build Coastguard Worker dnl Check if gcc is being used 112*cf84ac9aSAndroid Build Coastguard Worker AS_IF([ test "$GCC" = "no" ], [ 113*cf84ac9aSAndroid Build Coastguard Worker AC_MSG_ERROR([not compiling with gcc, which is required for gcov code coverage]) 114*cf84ac9aSAndroid Build Coastguard Worker ]) 115*cf84ac9aSAndroid Build Coastguard Worker 116*cf84ac9aSAndroid Build Coastguard Worker AC_CHECK_PROG([LCOV], [lcov], [lcov]) 117*cf84ac9aSAndroid Build Coastguard Worker AC_CHECK_PROG([GENHTML], [genhtml], [genhtml]) 118*cf84ac9aSAndroid Build Coastguard Worker 119*cf84ac9aSAndroid Build Coastguard Worker AS_IF([ test -z "$LCOV" ], [ 120*cf84ac9aSAndroid Build Coastguard Worker AC_MSG_ERROR([To enable code coverage reporting you must have lcov installed]) 121*cf84ac9aSAndroid Build Coastguard Worker ]) 122*cf84ac9aSAndroid Build Coastguard Worker 123*cf84ac9aSAndroid Build Coastguard Worker AS_IF([ test -z "$GENHTML" ], [ 124*cf84ac9aSAndroid Build Coastguard Worker AC_MSG_ERROR([Could not find genhtml from the lcov package]) 125*cf84ac9aSAndroid Build Coastguard Worker ]) 126*cf84ac9aSAndroid Build Coastguard Worker 127*cf84ac9aSAndroid Build Coastguard Worker dnl Build the code coverage flags 128*cf84ac9aSAndroid Build Coastguard Worker dnl Define CODE_COVERAGE_LDFLAGS for backwards compatibility 129*cf84ac9aSAndroid Build Coastguard Worker CODE_COVERAGE_CPPFLAGS="-DENABLE_COVERAGE_GCOV -DNDEBUG" 130*cf84ac9aSAndroid Build Coastguard Worker CODE_COVERAGE_CFLAGS="-O0 -g -fprofile-arcs -ftest-coverage" 131*cf84ac9aSAndroid Build Coastguard Worker CODE_COVERAGE_CXXFLAGS="-O0 -g -fprofile-arcs -ftest-coverage" 132*cf84ac9aSAndroid Build Coastguard Worker CODE_COVERAGE_LIBS="-lgcov" 133*cf84ac9aSAndroid Build Coastguard Worker CODE_COVERAGE_LDFLAGS="$CODE_COVERAGE_LIBS" 134*cf84ac9aSAndroid Build Coastguard Worker 135*cf84ac9aSAndroid Build Coastguard Worker AC_SUBST([CODE_COVERAGE_CPPFLAGS]) 136*cf84ac9aSAndroid Build Coastguard Worker AC_SUBST([CODE_COVERAGE_CFLAGS]) 137*cf84ac9aSAndroid Build Coastguard Worker AC_SUBST([CODE_COVERAGE_CXXFLAGS]) 138*cf84ac9aSAndroid Build Coastguard Worker AC_SUBST([CODE_COVERAGE_LIBS]) 139*cf84ac9aSAndroid Build Coastguard Worker AC_SUBST([CODE_COVERAGE_LDFLAGS]) 140*cf84ac9aSAndroid Build Coastguard Worker 141*cf84ac9aSAndroid Build Coastguard Worker [CODE_COVERAGE_RULES_CHECK=' 142*cf84ac9aSAndroid Build Coastguard Worker -$(A''M_V_at)$(MAKE) $(AM_MAKEFLAGS) -k check 143*cf84ac9aSAndroid Build Coastguard Worker $(A''M_V_at)$(MAKE) $(AM_MAKEFLAGS) code-coverage-capture 144*cf84ac9aSAndroid Build Coastguard Worker'] 145*cf84ac9aSAndroid Build Coastguard Worker [CODE_COVERAGE_RULES_CAPTURE=' 146*cf84ac9aSAndroid Build Coastguard Worker $(code_coverage_v_lcov_cap)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --capture --output-file "$(CODE_COVERAGE_OUTPUT_FILE).tmp" --test-name "$(call code_coverage_sanitize,$(PACKAGE_NAME)-$(PACKAGE_VERSION))" --no-checksum --compat-libtool $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_OPTIONS) 147*cf84ac9aSAndroid Build Coastguard Worker $(code_coverage_v_lcov_ign)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --remove "$(CODE_COVERAGE_OUTPUT_FILE).tmp" "/tmp/*" $(CODE_COVERAGE_IGNORE_PATTERN) --output-file "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_RMOPTS) 148*cf84ac9aSAndroid Build Coastguard Worker -@rm -f $(CODE_COVERAGE_OUTPUT_FILE).tmp 149*cf84ac9aSAndroid Build Coastguard Worker $(code_coverage_v_genhtml)LANG=C $(GENHTML) $(code_coverage_quiet) $(addprefix --prefix ,$(CODE_COVERAGE_DIRECTORY)) --output-directory "$(CODE_COVERAGE_OUTPUT_DIRECTORY)" --title "$(PACKAGE_NAME)-$(PACKAGE_VERSION) Code Coverage" --legend --show-details "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_GENHTML_OPTIONS) 150*cf84ac9aSAndroid Build Coastguard Worker @echo "file://$(abs_builddir)/$(CODE_COVERAGE_OUTPUT_DIRECTORY)/index.html" 151*cf84ac9aSAndroid Build Coastguard Worker'] 152*cf84ac9aSAndroid Build Coastguard Worker [CODE_COVERAGE_RULES_CLEAN=' 153*cf84ac9aSAndroid Build Coastguard Workerclean: code-coverage-clean 154*cf84ac9aSAndroid Build Coastguard Workerdistclean: code-coverage-clean 155*cf84ac9aSAndroid Build Coastguard Workercode-coverage-clean: 156*cf84ac9aSAndroid Build Coastguard Worker -$(LCOV) --directory $(top_builddir) -z 157*cf84ac9aSAndroid Build Coastguard Worker -rm -rf $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_FILE).tmp $(CODE_COVERAGE_OUTPUT_DIRECTORY) 158*cf84ac9aSAndroid Build Coastguard Worker -find . \( -name "*.gcda" -o -name "*.gcno" -o -name "*.gcov" \) -delete 159*cf84ac9aSAndroid Build Coastguard Worker'] 160*cf84ac9aSAndroid Build Coastguard Worker ], [ 161*cf84ac9aSAndroid Build Coastguard Worker [CODE_COVERAGE_RULES_CHECK=' 162*cf84ac9aSAndroid Build Coastguard Worker @echo "Need to reconfigure with --enable-code-coverage" 163*cf84ac9aSAndroid Build Coastguard Worker'] 164*cf84ac9aSAndroid Build Coastguard Worker CODE_COVERAGE_RULES_CAPTURE="$CODE_COVERAGE_RULES_CHECK" 165*cf84ac9aSAndroid Build Coastguard Worker CODE_COVERAGE_RULES_CLEAN='' 166*cf84ac9aSAndroid Build Coastguard Worker ]) 167*cf84ac9aSAndroid Build Coastguard Worker 168*cf84ac9aSAndroid Build Coastguard Worker[CODE_COVERAGE_RULES=' 169*cf84ac9aSAndroid Build Coastguard Worker# Code coverage 170*cf84ac9aSAndroid Build Coastguard Worker# 171*cf84ac9aSAndroid Build Coastguard Worker# Optional: 172*cf84ac9aSAndroid Build Coastguard Worker# - CODE_COVERAGE_DIRECTORY: Top-level directory for code coverage reporting. 173*cf84ac9aSAndroid Build Coastguard Worker# Multiple directories may be specified, separated by whitespace. 174*cf84ac9aSAndroid Build Coastguard Worker# (Default: $(top_builddir)) 175*cf84ac9aSAndroid Build Coastguard Worker# - CODE_COVERAGE_OUTPUT_FILE: Filename and path for the .info file generated 176*cf84ac9aSAndroid Build Coastguard Worker# by lcov for code coverage. (Default: 177*cf84ac9aSAndroid Build Coastguard Worker# $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage.info) 178*cf84ac9aSAndroid Build Coastguard Worker# - CODE_COVERAGE_OUTPUT_DIRECTORY: Directory for generated code coverage 179*cf84ac9aSAndroid Build Coastguard Worker# reports to be created. (Default: 180*cf84ac9aSAndroid Build Coastguard Worker# $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage) 181*cf84ac9aSAndroid Build Coastguard Worker# - CODE_COVERAGE_BRANCH_COVERAGE: Set to 1 to enforce branch coverage, 182*cf84ac9aSAndroid Build Coastguard Worker# set to 0 to disable it and leave empty to stay with the default. 183*cf84ac9aSAndroid Build Coastguard Worker# (Default: empty) 184*cf84ac9aSAndroid Build Coastguard Worker# - CODE_COVERAGE_LCOV_SHOPTS_DEFAULT: Extra options shared between both lcov 185*cf84ac9aSAndroid Build Coastguard Worker# instances. (Default: based on $CODE_COVERAGE_BRANCH_COVERAGE) 186*cf84ac9aSAndroid Build Coastguard Worker# - CODE_COVERAGE_LCOV_SHOPTS: Extra options to shared between both lcov 187*cf84ac9aSAndroid Build Coastguard Worker# instances. (Default: $CODE_COVERAGE_LCOV_SHOPTS_DEFAULT) 188*cf84ac9aSAndroid Build Coastguard Worker# - CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH: --gcov-tool pathtogcov 189*cf84ac9aSAndroid Build Coastguard Worker# - CODE_COVERAGE_LCOV_OPTIONS_DEFAULT: Extra options to pass to the 190*cf84ac9aSAndroid Build Coastguard Worker# collecting lcov instance. (Default: $CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH) 191*cf84ac9aSAndroid Build Coastguard Worker# - CODE_COVERAGE_LCOV_OPTIONS: Extra options to pass to the collecting lcov 192*cf84ac9aSAndroid Build Coastguard Worker# instance. (Default: $CODE_COVERAGE_LCOV_OPTIONS_DEFAULT) 193*cf84ac9aSAndroid Build Coastguard Worker# - CODE_COVERAGE_LCOV_RMOPTS_DEFAULT: Extra options to pass to the filtering 194*cf84ac9aSAndroid Build Coastguard Worker# lcov instance. (Default: empty) 195*cf84ac9aSAndroid Build Coastguard Worker# - CODE_COVERAGE_LCOV_RMOPTS: Extra options to pass to the filtering lcov 196*cf84ac9aSAndroid Build Coastguard Worker# instance. (Default: $CODE_COVERAGE_LCOV_RMOPTS_DEFAULT) 197*cf84ac9aSAndroid Build Coastguard Worker# - CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT: Extra options to pass to the 198*cf84ac9aSAndroid Build Coastguard Worker# genhtml instance. (Default: based on $CODE_COVERAGE_BRANCH_COVERAGE) 199*cf84ac9aSAndroid Build Coastguard Worker# - CODE_COVERAGE_GENHTML_OPTIONS: Extra options to pass to the genhtml 200*cf84ac9aSAndroid Build Coastguard Worker# instance. (Default: $CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT) 201*cf84ac9aSAndroid Build Coastguard Worker# - CODE_COVERAGE_IGNORE_PATTERN: Extra glob pattern of files to ignore 202*cf84ac9aSAndroid Build Coastguard Worker# 203*cf84ac9aSAndroid Build Coastguard Worker# The generated report will be titled using the $(PACKAGE_NAME) and 204*cf84ac9aSAndroid Build Coastguard Worker# $(PACKAGE_VERSION). In order to add the current git hash to the title, 205*cf84ac9aSAndroid Build Coastguard Worker# use the git-version-gen script, available online. 206*cf84ac9aSAndroid Build Coastguard Worker 207*cf84ac9aSAndroid Build Coastguard Worker# Optional variables 208*cf84ac9aSAndroid Build Coastguard WorkerCODE_COVERAGE_DIRECTORY ?= $(top_builddir) 209*cf84ac9aSAndroid Build Coastguard WorkerCODE_COVERAGE_OUTPUT_FILE ?= $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage.info 210*cf84ac9aSAndroid Build Coastguard WorkerCODE_COVERAGE_OUTPUT_DIRECTORY ?= $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage 211*cf84ac9aSAndroid Build Coastguard WorkerCODE_COVERAGE_BRANCH_COVERAGE ?= 212*cf84ac9aSAndroid Build Coastguard WorkerCODE_COVERAGE_LCOV_SHOPTS_DEFAULT ?= $(if $(CODE_COVERAGE_BRANCH_COVERAGE),\ 213*cf84ac9aSAndroid Build Coastguard Worker--rc lcov_branch_coverage=$(CODE_COVERAGE_BRANCH_COVERAGE)) 214*cf84ac9aSAndroid Build Coastguard WorkerCODE_COVERAGE_LCOV_SHOPTS ?= $(CODE_COVERAGE_LCOV_SHOPTS_DEFAULT) 215*cf84ac9aSAndroid Build Coastguard WorkerCODE_COVERAGE_LCOV_OPTIONS_GCOVPATH ?= --gcov-tool "$(GCOV)" 216*cf84ac9aSAndroid Build Coastguard WorkerCODE_COVERAGE_LCOV_OPTIONS_DEFAULT ?= $(CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH) 217*cf84ac9aSAndroid Build Coastguard WorkerCODE_COVERAGE_LCOV_OPTIONS ?= $(CODE_COVERAGE_LCOV_OPTIONS_DEFAULT) 218*cf84ac9aSAndroid Build Coastguard WorkerCODE_COVERAGE_LCOV_RMOPTS_DEFAULT ?= 219*cf84ac9aSAndroid Build Coastguard WorkerCODE_COVERAGE_LCOV_RMOPTS ?= $(CODE_COVERAGE_LCOV_RMOPTS_DEFAULT) 220*cf84ac9aSAndroid Build Coastguard WorkerCODE_COVERAGE_GENHTML_OPTIONS_DEFAULT ?=\ 221*cf84ac9aSAndroid Build Coastguard Worker$(if $(CODE_COVERAGE_BRANCH_COVERAGE),\ 222*cf84ac9aSAndroid Build Coastguard Worker--rc genhtml_branch_coverage=$(CODE_COVERAGE_BRANCH_COVERAGE)) 223*cf84ac9aSAndroid Build Coastguard WorkerCODE_COVERAGE_GENHTML_OPTIONS ?= $(CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT) 224*cf84ac9aSAndroid Build Coastguard WorkerCODE_COVERAGE_IGNORE_PATTERN ?= 225*cf84ac9aSAndroid Build Coastguard Worker 226*cf84ac9aSAndroid Build Coastguard Workercode_coverage_v_lcov_cap = $(code_coverage_v_lcov_cap_$(V)) 227*cf84ac9aSAndroid Build Coastguard Workercode_coverage_v_lcov_cap_ = $(code_coverage_v_lcov_cap_$(AM_DEFAULT_VERBOSITY)) 228*cf84ac9aSAndroid Build Coastguard Workercode_coverage_v_lcov_cap_0 = @echo " LCOV --capture"\ 229*cf84ac9aSAndroid Build Coastguard Worker $(CODE_COVERAGE_OUTPUT_FILE); 230*cf84ac9aSAndroid Build Coastguard Workercode_coverage_v_lcov_ign = $(code_coverage_v_lcov_ign_$(V)) 231*cf84ac9aSAndroid Build Coastguard Workercode_coverage_v_lcov_ign_ = $(code_coverage_v_lcov_ign_$(AM_DEFAULT_VERBOSITY)) 232*cf84ac9aSAndroid Build Coastguard Workercode_coverage_v_lcov_ign_0 = @echo " LCOV --remove /tmp/*"\ 233*cf84ac9aSAndroid Build Coastguard Worker $(CODE_COVERAGE_IGNORE_PATTERN); 234*cf84ac9aSAndroid Build Coastguard Workercode_coverage_v_genhtml = $(code_coverage_v_genhtml_$(V)) 235*cf84ac9aSAndroid Build Coastguard Workercode_coverage_v_genhtml_ = $(code_coverage_v_genhtml_$(AM_DEFAULT_VERBOSITY)) 236*cf84ac9aSAndroid Build Coastguard Workercode_coverage_v_genhtml_0 = @echo " GEN " $(CODE_COVERAGE_OUTPUT_DIRECTORY); 237*cf84ac9aSAndroid Build Coastguard Workercode_coverage_quiet = $(code_coverage_quiet_$(V)) 238*cf84ac9aSAndroid Build Coastguard Workercode_coverage_quiet_ = $(code_coverage_quiet_$(AM_DEFAULT_VERBOSITY)) 239*cf84ac9aSAndroid Build Coastguard Workercode_coverage_quiet_0 = --quiet 240*cf84ac9aSAndroid Build Coastguard Worker 241*cf84ac9aSAndroid Build Coastguard Worker# sanitizes the test-name: replaces with underscores: dashes and dots 242*cf84ac9aSAndroid Build Coastguard Workercode_coverage_sanitize = $(subst -,_,$(subst .,_,$(1))) 243*cf84ac9aSAndroid Build Coastguard Worker 244*cf84ac9aSAndroid Build Coastguard Worker# Use recursive makes in order to ignore errors during check 245*cf84ac9aSAndroid Build Coastguard Workercheck-code-coverage:'"$CODE_COVERAGE_RULES_CHECK"' 246*cf84ac9aSAndroid Build Coastguard Worker 247*cf84ac9aSAndroid Build Coastguard Worker# Capture code coverage data 248*cf84ac9aSAndroid Build Coastguard Workercode-coverage-capture: code-coverage-capture-hook'"$CODE_COVERAGE_RULES_CAPTURE"' 249*cf84ac9aSAndroid Build Coastguard Worker 250*cf84ac9aSAndroid Build Coastguard Worker# Hook rule executed before code-coverage-capture, overridable by the user 251*cf84ac9aSAndroid Build Coastguard Workercode-coverage-capture-hook: 252*cf84ac9aSAndroid Build Coastguard Worker 253*cf84ac9aSAndroid Build Coastguard Worker'"$CODE_COVERAGE_RULES_CLEAN"' 254*cf84ac9aSAndroid Build Coastguard Worker 255*cf84ac9aSAndroid Build Coastguard WorkerGITIGNOREFILES ?= 256*cf84ac9aSAndroid Build Coastguard WorkerGITIGNOREFILES += $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_DIRECTORY) 257*cf84ac9aSAndroid Build Coastguard Worker 258*cf84ac9aSAndroid Build Coastguard WorkerA''M_DISTCHECK_CONFIGURE_FLAGS ?= 259*cf84ac9aSAndroid Build Coastguard WorkerA''M_DISTCHECK_CONFIGURE_FLAGS += --disable-code-coverage 260*cf84ac9aSAndroid Build Coastguard Worker 261*cf84ac9aSAndroid Build Coastguard Worker.PHONY: check-code-coverage code-coverage-capture code-coverage-capture-hook code-coverage-clean 262*cf84ac9aSAndroid Build Coastguard Worker'] 263*cf84ac9aSAndroid Build Coastguard Worker 264*cf84ac9aSAndroid Build Coastguard Worker AC_SUBST([CODE_COVERAGE_RULES]) 265*cf84ac9aSAndroid Build Coastguard Worker m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([CODE_COVERAGE_RULES])]) 266*cf84ac9aSAndroid Build Coastguard Worker]) 267