]>
Commit | Line | Data |
---|---|---|
75b07eca FG |
1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 |
2 | From: Prakash Surya <prakash.surya@delphix.com> | |
3 | Date: Fri, 22 Sep 2017 18:49:57 -0700 | |
4 | Subject: [PATCH] Add support for "--enable-code-coverage" option | |
5 | MIME-Version: 1.0 | |
6 | Content-Type: text/plain; charset=UTF-8 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ||
9 | This change adds support for a new option that can be passed to the | |
10 | configure script: "--enable-code-coverage". Further, the "--enable-gcov" | |
11 | option has been removed, as this new option provides the same | |
12 | functionality (plus more). | |
13 | ||
14 | When using this new option the following make targets are available: | |
15 | ||
16 | * check-code-coverage | |
17 | * code-coverage-capture | |
18 | * code-coverage-clean | |
19 | ||
20 | Note: these make targets can only be run from the root of the project. | |
21 | ||
22 | Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> | |
23 | Signed-off-by: Prakash Surya <prakash.surya@delphix.com> | |
24 | Closes #6670 | |
25 | (cherry picked from commit 6b278f3223c0322527836da2e11e33978e54a234) | |
26 | Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com> | |
27 | --- | |
28 | configure.ac | 2 +- | |
29 | Makefile.am | 2 + | |
30 | config/Rules.am | 2 + | |
31 | config/ax_code_coverage.m4 | 264 +++++++++++++++++++++++++++++++++++++++++++++ | |
32 | config/zfs-build.m4 | 31 ------ | |
33 | 5 files changed, 269 insertions(+), 32 deletions(-) | |
34 | create mode 100644 config/ax_code_coverage.m4 | |
35 | ||
36 | diff --git a/configure.ac b/configure.ac | |
37 | index ee754fd38..d71712e4c 100644 | |
38 | --- a/configure.ac | |
39 | +++ b/configure.ac | |
40 | @@ -50,13 +50,13 @@ AC_PROG_CC | |
41 | AC_PROG_LIBTOOL | |
42 | AM_PROG_AS | |
43 | AM_PROG_CC_C_O | |
44 | +AX_CODE_COVERAGE | |
45 | ||
46 | ZFS_AC_LICENSE | |
47 | ZFS_AC_PACKAGE | |
48 | ZFS_AC_CONFIG | |
49 | ZFS_AC_DEBUG | |
50 | ZFS_AC_DEBUGINFO | |
51 | -ZFS_AC_GCOV | |
52 | ||
53 | AC_CONFIG_FILES([ | |
54 | Makefile | |
55 | diff --git a/Makefile.am b/Makefile.am | |
56 | index 732a373bd..b539ff30f 100644 | |
57 | --- a/Makefile.am | |
58 | +++ b/Makefile.am | |
59 | @@ -23,6 +23,8 @@ EXTRA_DIST = autogen.sh copy-builtin | |
60 | EXTRA_DIST += config/config.awk config/rpm.am config/deb.am config/tgz.am | |
61 | EXTRA_DIST += META DISCLAIMER COPYRIGHT README.markdown OPENSOLARIS.LICENSE | |
62 | ||
63 | +@CODE_COVERAGE_RULES@ | |
64 | + | |
65 | distclean-local:: | |
66 | -$(RM) -R autom4te*.cache | |
67 | -find . \( -name SCCS -o -name BitKeeper -o -name .svn -o -name CVS \ | |
68 | diff --git a/config/Rules.am b/config/Rules.am | |
69 | index 1d39e7779..215f09c34 100644 | |
70 | --- a/config/Rules.am | |
71 | +++ b/config/Rules.am | |
72 | @@ -6,6 +6,7 @@ AM_CFLAGS += ${NO_UNUSED_BUT_SET_VARIABLE} | |
73 | AM_CFLAGS += ${NO_BOOL_COMPARE} | |
74 | AM_CFLAGS += -fno-strict-aliasing | |
75 | AM_CFLAGS += -std=gnu99 | |
76 | +AM_CFLAGS += $(CODE_COVERAGE_CFLAGS) | |
77 | AM_CPPFLAGS = -D_GNU_SOURCE -D__EXTENSIONS__ -D_REENTRANT | |
78 | AM_CPPFLAGS += -D_POSIX_PTHREAD_SEMANTICS -D_FILE_OFFSET_BITS=64 | |
79 | AM_CPPFLAGS += -D_LARGEFILE64_SOURCE -DHAVE_LARGE_STACKS=1 | |
80 | @@ -14,3 +15,4 @@ AM_CPPFLAGS += -DLIBEXECDIR=\"$(libexecdir)\" | |
81 | AM_CPPFLAGS += -DRUNSTATEDIR=\"$(runstatedir)\" | |
82 | AM_CPPFLAGS += -DSBINDIR=\"$(sbindir)\" | |
83 | AM_CPPFLAGS += -DSYSCONFDIR=\"$(sysconfdir)\" | |
84 | +AM_CPPFLAGS += $(CODE_COVERAGE_CPPFLAGS) | |
85 | diff --git a/config/ax_code_coverage.m4 b/config/ax_code_coverage.m4 | |
86 | new file mode 100644 | |
87 | index 000000000..6484f0332 | |
88 | --- /dev/null | |
89 | +++ b/config/ax_code_coverage.m4 | |
90 | @@ -0,0 +1,264 @@ | |
91 | +# =========================================================================== | |
92 | +# https://www.gnu.org/software/autoconf-archive/ax_code_coverage.html | |
93 | +# =========================================================================== | |
94 | +# | |
95 | +# SYNOPSIS | |
96 | +# | |
97 | +# AX_CODE_COVERAGE() | |
98 | +# | |
99 | +# DESCRIPTION | |
100 | +# | |
101 | +# Defines CODE_COVERAGE_CPPFLAGS, CODE_COVERAGE_CFLAGS, | |
102 | +# CODE_COVERAGE_CXXFLAGS and CODE_COVERAGE_LIBS which should be included | |
103 | +# in the CPPFLAGS, CFLAGS CXXFLAGS and LIBS/LIBADD variables of every | |
104 | +# build target (program or library) which should be built with code | |
105 | +# coverage support. Also defines CODE_COVERAGE_RULES which should be | |
106 | +# substituted in your Makefile; and $enable_code_coverage which can be | |
107 | +# used in subsequent configure output. CODE_COVERAGE_ENABLED is defined | |
108 | +# and substituted, and corresponds to the value of the | |
109 | +# --enable-code-coverage option, which defaults to being disabled. | |
110 | +# | |
111 | +# Test also for gcov program and create GCOV variable that could be | |
112 | +# substituted. | |
113 | +# | |
114 | +# Note that all optimization flags in CFLAGS must be disabled when code | |
115 | +# coverage is enabled. | |
116 | +# | |
117 | +# Usage example: | |
118 | +# | |
119 | +# configure.ac: | |
120 | +# | |
121 | +# AX_CODE_COVERAGE | |
122 | +# | |
123 | +# Makefile.am: | |
124 | +# | |
125 | +# @CODE_COVERAGE_RULES@ | |
126 | +# my_program_LIBS = ... $(CODE_COVERAGE_LIBS) ... | |
127 | +# my_program_CPPFLAGS = ... $(CODE_COVERAGE_CPPFLAGS) ... | |
128 | +# my_program_CFLAGS = ... $(CODE_COVERAGE_CFLAGS) ... | |
129 | +# my_program_CXXFLAGS = ... $(CODE_COVERAGE_CXXFLAGS) ... | |
130 | +# | |
131 | +# This results in a "check-code-coverage" rule being added to any | |
132 | +# Makefile.am which includes "@CODE_COVERAGE_RULES@" (assuming the module | |
133 | +# has been configured with --enable-code-coverage). Running `make | |
134 | +# check-code-coverage` in that directory will run the module's test suite | |
135 | +# (`make check`) and build a code coverage report detailing the code which | |
136 | +# was touched, then print the URI for the report. | |
137 | +# | |
138 | +# In earlier versions of this macro, CODE_COVERAGE_LDFLAGS was defined | |
139 | +# instead of CODE_COVERAGE_LIBS. They are both still defined, but use of | |
140 | +# CODE_COVERAGE_LIBS is preferred for clarity; CODE_COVERAGE_LDFLAGS is | |
141 | +# deprecated. They have the same value. | |
142 | +# | |
143 | +# This code was derived from Makefile.decl in GLib, originally licenced | |
144 | +# under LGPLv2.1+. | |
145 | +# | |
146 | +# LICENSE | |
147 | +# | |
148 | +# Copyright (c) 2012, 2016 Philip Withnall | |
149 | +# Copyright (c) 2012 Xan Lopez | |
150 | +# Copyright (c) 2012 Christian Persch | |
151 | +# Copyright (c) 2012 Paolo Borelli | |
152 | +# Copyright (c) 2012 Dan Winship | |
153 | +# Copyright (c) 2015 Bastien ROUCARIES | |
154 | +# | |
155 | +# This library is free software; you can redistribute it and/or modify it | |
156 | +# under the terms of the GNU Lesser General Public License as published by | |
157 | +# the Free Software Foundation; either version 2.1 of the License, or (at | |
158 | +# your option) any later version. | |
159 | +# | |
160 | +# This library is distributed in the hope that it will be useful, but | |
161 | +# WITHOUT ANY WARRANTY; without even the implied warranty of | |
162 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser | |
163 | +# General Public License for more details. | |
164 | +# | |
165 | +# You should have received a copy of the GNU Lesser General Public License | |
166 | +# along with this program. If not, see <https://www.gnu.org/licenses/>. | |
167 | + | |
168 | +#serial 25 | |
169 | + | |
170 | +AC_DEFUN([AX_CODE_COVERAGE],[ | |
171 | + dnl Check for --enable-code-coverage | |
172 | + AC_REQUIRE([AC_PROG_SED]) | |
173 | + | |
174 | + # allow to override gcov location | |
175 | + AC_ARG_WITH([gcov], | |
176 | + [AS_HELP_STRING([--with-gcov[=GCOV]], [use given GCOV for coverage (GCOV=gcov).])], | |
177 | + [_AX_CODE_COVERAGE_GCOV_PROG_WITH=$with_gcov], | |
178 | + [_AX_CODE_COVERAGE_GCOV_PROG_WITH=gcov]) | |
179 | + | |
180 | + AC_MSG_CHECKING([whether to build with code coverage support]) | |
181 | + AC_ARG_ENABLE([code-coverage], | |
182 | + AS_HELP_STRING([--enable-code-coverage], | |
183 | + [Whether to enable code coverage support]),, | |
184 | + enable_code_coverage=no) | |
185 | + | |
186 | + AM_CONDITIONAL([CODE_COVERAGE_ENABLED], [test x$enable_code_coverage = xyes]) | |
187 | + AC_SUBST([CODE_COVERAGE_ENABLED], [$enable_code_coverage]) | |
188 | + AC_MSG_RESULT($enable_code_coverage) | |
189 | + | |
190 | + AS_IF([ test "$enable_code_coverage" = "yes" ], [ | |
191 | + # check for gcov | |
192 | + AC_CHECK_TOOL([GCOV], | |
193 | + [$_AX_CODE_COVERAGE_GCOV_PROG_WITH], | |
194 | + [:]) | |
195 | + AS_IF([test "X$GCOV" = "X:"], | |
196 | + [AC_MSG_ERROR([gcov is needed to do coverage])]) | |
197 | + AC_SUBST([GCOV]) | |
198 | + | |
199 | + dnl Check if gcc is being used | |
200 | + AS_IF([ test "$GCC" = "no" ], [ | |
201 | + AC_MSG_ERROR([not compiling with gcc, which is required for gcov code coverage]) | |
202 | + ]) | |
203 | + | |
204 | + AC_CHECK_PROG([LCOV], [lcov], [lcov]) | |
205 | + AC_CHECK_PROG([GENHTML], [genhtml], [genhtml]) | |
206 | + | |
207 | + AS_IF([ test -z "$LCOV" ], [ | |
208 | + AC_MSG_ERROR([To enable code coverage reporting you must have lcov installed]) | |
209 | + ]) | |
210 | + | |
211 | + AS_IF([ test -z "$GENHTML" ], [ | |
212 | + AC_MSG_ERROR([Could not find genhtml from the lcov package]) | |
213 | + ]) | |
214 | + | |
215 | + dnl Build the code coverage flags | |
216 | + dnl Define CODE_COVERAGE_LDFLAGS for backwards compatibility | |
217 | + CODE_COVERAGE_CPPFLAGS="-DNDEBUG" | |
218 | + CODE_COVERAGE_CFLAGS="-O0 -g -fprofile-arcs -ftest-coverage" | |
219 | + CODE_COVERAGE_CXXFLAGS="-O0 -g -fprofile-arcs -ftest-coverage" | |
220 | + CODE_COVERAGE_LIBS="-lgcov" | |
221 | + CODE_COVERAGE_LDFLAGS="$CODE_COVERAGE_LIBS" | |
222 | + | |
223 | + AC_SUBST([CODE_COVERAGE_CPPFLAGS]) | |
224 | + AC_SUBST([CODE_COVERAGE_CFLAGS]) | |
225 | + AC_SUBST([CODE_COVERAGE_CXXFLAGS]) | |
226 | + AC_SUBST([CODE_COVERAGE_LIBS]) | |
227 | + AC_SUBST([CODE_COVERAGE_LDFLAGS]) | |
228 | + | |
229 | + [CODE_COVERAGE_RULES_CHECK=' | |
230 | + -$(A''M_V_at)$(MAKE) $(AM_MAKEFLAGS) -k check | |
231 | + $(A''M_V_at)$(MAKE) $(AM_MAKEFLAGS) code-coverage-capture | |
232 | +'] | |
233 | + [CODE_COVERAGE_RULES_CAPTURE=' | |
234 | + $(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) | |
235 | + $(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) | |
236 | + -@rm -f $(CODE_COVERAGE_OUTPUT_FILE).tmp | |
237 | + $(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) | |
238 | + @echo "file://$(abs_builddir)/$(CODE_COVERAGE_OUTPUT_DIRECTORY)/index.html" | |
239 | +'] | |
240 | + [CODE_COVERAGE_RULES_CLEAN=' | |
241 | +clean: code-coverage-clean | |
242 | +distclean: code-coverage-clean | |
243 | +code-coverage-clean: | |
244 | + -$(LCOV) --directory $(top_builddir) -z | |
245 | + -rm -rf $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_FILE).tmp $(CODE_COVERAGE_OUTPUT_DIRECTORY) | |
246 | + -find . \( -name "*.gcda" -o -name "*.gcno" -o -name "*.gcov" \) -delete | |
247 | +'] | |
248 | + ], [ | |
249 | + [CODE_COVERAGE_RULES_CHECK=' | |
250 | + @echo "Need to reconfigure with --enable-code-coverage" | |
251 | +'] | |
252 | + CODE_COVERAGE_RULES_CAPTURE="$CODE_COVERAGE_RULES_CHECK" | |
253 | + CODE_COVERAGE_RULES_CLEAN='' | |
254 | + ]) | |
255 | + | |
256 | +[CODE_COVERAGE_RULES=' | |
257 | +# Code coverage | |
258 | +# | |
259 | +# Optional: | |
260 | +# - CODE_COVERAGE_DIRECTORY: Top-level directory for code coverage reporting. | |
261 | +# Multiple directories may be specified, separated by whitespace. | |
262 | +# (Default: $(top_builddir)) | |
263 | +# - CODE_COVERAGE_OUTPUT_FILE: Filename and path for the .info file generated | |
264 | +# by lcov for code coverage. (Default: | |
265 | +# $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage.info) | |
266 | +# - CODE_COVERAGE_OUTPUT_DIRECTORY: Directory for generated code coverage | |
267 | +# reports to be created. (Default: | |
268 | +# $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage) | |
269 | +# - CODE_COVERAGE_BRANCH_COVERAGE: Set to 1 to enforce branch coverage, | |
270 | +# set to 0 to disable it and leave empty to stay with the default. | |
271 | +# (Default: empty) | |
272 | +# - CODE_COVERAGE_LCOV_SHOPTS_DEFAULT: Extra options shared between both lcov | |
273 | +# instances. (Default: based on $CODE_COVERAGE_BRANCH_COVERAGE) | |
274 | +# - CODE_COVERAGE_LCOV_SHOPTS: Extra options to shared between both lcov | |
275 | +# instances. (Default: $CODE_COVERAGE_LCOV_SHOPTS_DEFAULT) | |
276 | +# - CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH: --gcov-tool pathtogcov | |
277 | +# - CODE_COVERAGE_LCOV_OPTIONS_DEFAULT: Extra options to pass to the | |
278 | +# collecting lcov instance. (Default: $CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH) | |
279 | +# - CODE_COVERAGE_LCOV_OPTIONS: Extra options to pass to the collecting lcov | |
280 | +# instance. (Default: $CODE_COVERAGE_LCOV_OPTIONS_DEFAULT) | |
281 | +# - CODE_COVERAGE_LCOV_RMOPTS_DEFAULT: Extra options to pass to the filtering | |
282 | +# lcov instance. (Default: empty) | |
283 | +# - CODE_COVERAGE_LCOV_RMOPTS: Extra options to pass to the filtering lcov | |
284 | +# instance. (Default: $CODE_COVERAGE_LCOV_RMOPTS_DEFAULT) | |
285 | +# - CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT: Extra options to pass to the | |
286 | +# genhtml instance. (Default: based on $CODE_COVERAGE_BRANCH_COVERAGE) | |
287 | +# - CODE_COVERAGE_GENHTML_OPTIONS: Extra options to pass to the genhtml | |
288 | +# instance. (Default: $CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT) | |
289 | +# - CODE_COVERAGE_IGNORE_PATTERN: Extra glob pattern of files to ignore | |
290 | +# | |
291 | +# The generated report will be titled using the $(PACKAGE_NAME) and | |
292 | +# $(PACKAGE_VERSION). In order to add the current git hash to the title, | |
293 | +# use the git-version-gen script, available online. | |
294 | + | |
295 | +# Optional variables | |
296 | +CODE_COVERAGE_DIRECTORY ?= $(top_builddir) | |
297 | +CODE_COVERAGE_OUTPUT_FILE ?= $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage.info | |
298 | +CODE_COVERAGE_OUTPUT_DIRECTORY ?= $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage | |
299 | +CODE_COVERAGE_BRANCH_COVERAGE ?= | |
300 | +CODE_COVERAGE_LCOV_SHOPTS_DEFAULT ?= $(if $(CODE_COVERAGE_BRANCH_COVERAGE),\ | |
301 | +--rc lcov_branch_coverage=$(CODE_COVERAGE_BRANCH_COVERAGE)) | |
302 | +CODE_COVERAGE_LCOV_SHOPTS ?= $(CODE_COVERAGE_LCOV_SHOPTS_DEFAULT) | |
303 | +CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH ?= --gcov-tool "$(GCOV)" | |
304 | +CODE_COVERAGE_LCOV_OPTIONS_DEFAULT ?= $(CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH) | |
305 | +CODE_COVERAGE_LCOV_OPTIONS ?= $(CODE_COVERAGE_LCOV_OPTIONS_DEFAULT) | |
306 | +CODE_COVERAGE_LCOV_RMOPTS_DEFAULT ?= | |
307 | +CODE_COVERAGE_LCOV_RMOPTS ?= $(CODE_COVERAGE_LCOV_RMOPTS_DEFAULT) | |
308 | +CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT ?=\ | |
309 | +$(if $(CODE_COVERAGE_BRANCH_COVERAGE),\ | |
310 | +--rc genhtml_branch_coverage=$(CODE_COVERAGE_BRANCH_COVERAGE)) | |
311 | +CODE_COVERAGE_GENHTML_OPTIONS ?= $(CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT) | |
312 | +CODE_COVERAGE_IGNORE_PATTERN ?= | |
313 | + | |
314 | +GITIGNOREFILES ?= | |
315 | +GITIGNOREFILES += $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_DIRECTORY) | |
316 | + | |
317 | +code_coverage_v_lcov_cap = $(code_coverage_v_lcov_cap_$(V)) | |
318 | +code_coverage_v_lcov_cap_ = $(code_coverage_v_lcov_cap_$(AM_DEFAULT_VERBOSITY)) | |
319 | +code_coverage_v_lcov_cap_0 = @echo " LCOV --capture"\ | |
320 | + $(CODE_COVERAGE_OUTPUT_FILE); | |
321 | +code_coverage_v_lcov_ign = $(code_coverage_v_lcov_ign_$(V)) | |
322 | +code_coverage_v_lcov_ign_ = $(code_coverage_v_lcov_ign_$(AM_DEFAULT_VERBOSITY)) | |
323 | +code_coverage_v_lcov_ign_0 = @echo " LCOV --remove /tmp/*"\ | |
324 | + $(CODE_COVERAGE_IGNORE_PATTERN); | |
325 | +code_coverage_v_genhtml = $(code_coverage_v_genhtml_$(V)) | |
326 | +code_coverage_v_genhtml_ = $(code_coverage_v_genhtml_$(AM_DEFAULT_VERBOSITY)) | |
327 | +code_coverage_v_genhtml_0 = @echo " GEN " $(CODE_COVERAGE_OUTPUT_DIRECTORY); | |
328 | +code_coverage_quiet = $(code_coverage_quiet_$(V)) | |
329 | +code_coverage_quiet_ = $(code_coverage_quiet_$(AM_DEFAULT_VERBOSITY)) | |
330 | +code_coverage_quiet_0 = --quiet | |
331 | + | |
332 | +# sanitizes the test-name: replaces with underscores: dashes and dots | |
333 | +code_coverage_sanitize = $(subst -,_,$(subst .,_,$(1))) | |
334 | + | |
335 | +# Use recursive makes in order to ignore errors during check | |
336 | +check-code-coverage:'"$CODE_COVERAGE_RULES_CHECK"' | |
337 | + | |
338 | +# Capture code coverage data | |
339 | +code-coverage-capture: code-coverage-capture-hook'"$CODE_COVERAGE_RULES_CAPTURE"' | |
340 | + | |
341 | +# Hook rule executed before code-coverage-capture, overridable by the user | |
342 | +code-coverage-capture-hook: | |
343 | + | |
344 | +'"$CODE_COVERAGE_RULES_CLEAN"' | |
345 | + | |
346 | +A''M_DISTCHECK_CONFIGURE_FLAGS ?= | |
347 | +A''M_DISTCHECK_CONFIGURE_FLAGS += --disable-code-coverage | |
348 | + | |
349 | +.PHONY: check-code-coverage code-coverage-capture code-coverage-capture-hook code-coverage-clean | |
350 | +'] | |
351 | + | |
352 | + AC_SUBST([CODE_COVERAGE_RULES]) | |
353 | + m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([CODE_COVERAGE_RULES])]) | |
354 | +]) | |
355 | diff --git a/config/zfs-build.m4 b/config/zfs-build.m4 | |
356 | index c695a882e..17cc80462 100644 | |
357 | --- a/config/zfs-build.m4 | |
358 | +++ b/config/zfs-build.m4 | |
359 | @@ -76,37 +76,6 @@ AC_DEFUN([ZFS_AC_DEBUGINFO], [ | |
360 | AC_MSG_RESULT([$enable_debuginfo]) | |
361 | ]) | |
362 | ||
363 | -AC_DEFUN([ZFS_AC_GCOV_KERNEL], [ | |
364 | -]) | |
365 | - | |
366 | -AC_DEFUN([ZFS_AC_GCOV_USER], [ | |
367 | - DEBUG_CFLAGS="$DEBUG_CFLAGS -fprofile-arcs -ftest-coverage" | |
368 | -]) | |
369 | - | |
370 | -AC_DEFUN([ZFS_AC_GCOV], [ | |
371 | - AC_MSG_CHECKING([whether gcov profiling will be enabled]) | |
372 | - AC_ARG_ENABLE([gcov], | |
373 | - [AS_HELP_STRING([--enable-gcov], | |
374 | - [Enable gcov profiling @<:@default=no@:>@])], | |
375 | - [], | |
376 | - [enable_gcov=no]) | |
377 | - | |
378 | - AS_CASE(["x$enable_gcov"], | |
379 | - ["xyes"], | |
380 | - [ZFS_AC_GCOV_KERNEL | |
381 | - ZFS_AC_GCOV_USER], | |
382 | - ["xkernel"], | |
383 | - [ZFS_AC_GCOV_KERNEL], | |
384 | - ["xuser"], | |
385 | - [ZFS_AC_GCOV_USER], | |
386 | - ["xno"], | |
387 | - [], | |
388 | - [AC_MSG_ERROR([Unknown option $enable_gcov])]) | |
389 | - | |
390 | - AC_SUBST(DEBUG_CFLAGS) | |
391 | - AC_MSG_RESULT([$enable_gcov]) | |
392 | -]) | |
393 | - | |
394 | AC_DEFUN([ZFS_AC_CONFIG_ALWAYS], [ | |
395 | ZFS_AC_CONFIG_ALWAYS_NO_UNUSED_BUT_SET_VARIABLE | |
396 | ZFS_AC_CONFIG_ALWAYS_NO_BOOL_COMPARE | |
397 | -- | |
398 | 2.14.2 | |
399 |