Fix for x86_64 build fail
[platform/upstream/connectedhomeip.git] / third_party / nlfaultinjection / repo / third_party / nlbuild-autotools / repo / automake / pre / macros / coverage.am
1 #
2 #    Copyright (c) 2020 Project nlbuild-autotools Authors
3 #    Copyright (c) 2020 Google LLC
4 #    Copyright 2015-2016 Nest Labs Inc. All Rights Reserved.
5 #
6 #    Licensed under the Apache License, Version 2.0 (the "License");
7 #    you may not use this file except in compliance with the License.
8 #    You may obtain a copy of the License at
9 #
10 #    http://www.apache.org/licenses/LICENSE-2.0
11 #
12 #    Unless required by applicable law or agreed to in writing, software
13 #    distributed under the License is distributed on an "AS IS" BASIS,
14 #    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 #    See the License for the specific language governing permissions and
16 #    limitations under the License.
17 #
18
19 #
20 #    Description:
21 #      This file defines automake variables and macros common to all
22 #      other automake headers and files for code coverage.
23 #
24
25 # Suffixes
26
27 #
28 # Suffix for the code coverage report "bundle".
29 #
30 NL_COVERAGE_BUNDLE_SUFFIX = .lcov
31
32 #
33 # Suffix for the lcov "info" file inside the code coverage report bundle.
34 #
35 NL_COVERAGE_INFO_SUFFIX   = .info
36
37 #
38 # Verbosity macros and flags
39 #
40
41 NL_V_LCOV             = $(nl__v_LCOV_$(V))
42 nl__v_LCOV_           = $(nl__v_LCOV_$(AM_DEFAULT_VERBOSITY))
43 nl__v_LCOV_0          = @echo "  LCOV     $(@)";
44 nl__v_LCOV_1          = 
45
46 NL_V_LCOV_FLAGS       = $(nl__v_LCOV_FLAGS_$(V))
47 nl__v_LCOV_FLAGS_     = $(nl__v_LCOV_FLAGS_$(AM_DEFAULT_VERBOSITY))
48 nl__v_LCOV_FLAGS_0    = --quiet
49 nl__v_LCOV_FLAGS_1    =
50
51 NL_V_GENHTML          = $(nl__v_GENHTML_$(V))
52 nl__v_GENHTML_        = $(nl__v_GENHTML_$(AM_DEFAULT_VERBOSITY))
53 nl__v_GENHTML_0       = @echo "  GENHTML  $(@)";
54 nl__v_GENHTML_1       = 
55
56 NL_V_GENHTML_FLAGS    = $(nl__v_GENHTML_FLAGS_$(V))
57 nl__v_GENHTML_FLAGS_  = $(nl__v_GENHTML_FLAGS_$(AM_DEFAULT_VERBOSITY))
58 nl__v_GENHTML_FLAGS_0 = --quiet 
59 nl__v_GENHTML_FLAGS_1 =
60
61 # Ensure that coverage-recursive is included among the list of
62 # recursive targets known by autotools.
63
64 RECURSIVE_TARGETS    += coverage-recursive
65
66 #
67 # generate-coverage-report <directory> [remove_filters]
68 #
69 # Capture, using lcov, a coverage report from the specified directory 'directory' and a filter 'remove_filter'
70 # with an final output "info" file as specified by the target variable.
71 #
72 #   <directory>      - The directory from which lcov should search for coverage data (*.gcno & *.gcda)
73 #
74 #   [remove_filters] - Optional whitespace-separated list of shell wildcard patterns. (note that they may need to be escaped accordingly to prevent
75 #                      the shell from expanding them first). Every file entry in tracefile which matches at least one of those patterns will be removed.
76 #
77 #   - create baseline coverage data file (base.info) with '-i|--initial' option
78 #   - create test coverage data file (test.info)
79 #   - combine baseline and test coverage data to create the final "info" file
80 #   - remove particular coverage data specifiled by the remove_filter (no change if remove_filter is null)
81 #
82 # Then, on success, generate an HTML-based coverage report using genhtml.
83 #
84 define generate-coverage-report
85 $(NL_V_LCOV)$(LCOV) $(NL_V_LCOV_FLAGS) --config-file="$(abs_top_nlbuild_autotools_dir)/etc/lcov.config" --initial --capture --directory "$(1)" --output-file "base.info"
86 $(NL_V_LCOV)$(LCOV) $(NL_V_LCOV_FLAGS) --config-file="$(abs_top_nlbuild_autotools_dir)/etc/lcov.config" --capture --directory "$(1)" --output-file "test.info"
87 $(NL_V_LCOV)$(LCOV) $(NL_V_LCOV_FLAGS) --config-file="$(abs_top_nlbuild_autotools_dir)/etc/lcov.config" --add-tracefile "base.info" --add-tracefile "test.info" --output-file "$(@)"
88 $(NL_V_LCOV)$(LCOV) $(NL_V_LCOV_FLAGS) --config-file="$(abs_top_nlbuild_autotools_dir)/etc/lcov.config" --remove "$(@)" $(foreach pattern,$(2),"$(pattern)") --output-file "$(@)"
89 $(NL_V_GENHTML)$(GENHTML) $(NL_V_GENHTML_FLAGS) --config-file="$(abs_top_nlbuild_autotools_dir)/etc/lcov.config" "$(@)" --output-directory "$(@D)"
90 endef # generate-coverage-report
91
92