summaryrefslogtreecommitdiffstats
path: root/meta-agl-profile-core/recipes-test/gcovr
diff options
context:
space:
mode:
authorScott Murray <scott.murray@konsulko.com>2020-09-21 13:21:10 -0400
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>2020-09-30 12:58:08 +0000
commit222dd0de1fbd0b8c148d8380dde91e46f07a274c (patch)
treee88676e9a1e98fefb12c3d6445eff9042958a7cc /meta-agl-profile-core/recipes-test/gcovr
parentce4ba096621d87755e6d5e67b2aa6f4671707262 (diff)
meta-agl-profile-core: Add support for running gcovr on target
Changes: - Add recipe for gcovr gcov-based coverage report generating tool. - Add bbappend to apply patch to gcovr to add a new command-line option that allows working with the coverage information from the AGL widgets on target. The goal is to get this change upstream, hence not having it in the recipe (which also will be sent for inclusion in meta-oe). - Add a recipe to install an included wrapper script for gcovr (unsurprisingly named "gcovr-wrapper") that enables running it against bindings on target. The script supports installing the coverage version of a binding and running pyagl tests, afm-test test widget, or a user-supplied command before running gcovr in a carefully crafted environment that will allow it to work without impacting the root filesystem of the target. - Add gcov-symlinks, gcovr, and gcovr-wrapper to the packagegroup-agl-core-devel package group so they will be available in agl-devel images. The gcov-symlinks package adds /usr/bin/gcov, which simplifies picking it up for gcovr. Bug-AGL: SPEC-3589 Signed-off-by: Scott Murray <scott.murray@konsulko.com> Change-Id: Ia2fdc200e4e0683f93a6e2a863311cd2107c962b Reviewed-on: https://gerrit.automotivelinux.org/gerrit/c/AGL/meta-agl/+/25337 Tested-by: Jenkins Job builder account <agl-jobbuilder@automotivelinux.org> ci-image-build: Jenkins Job builder account <agl-jobbuilder@automotivelinux.org> ci-image-boot-test: Jenkins Job builder account <agl-jobbuilder@automotivelinux.org> Reviewed-by: Jan-Simon Moeller <jsmoeller@linuxfoundation.org> (cherry picked from commit 6ac60a0f98d9048fa7dd3cbcd95a9409cbe0c4fa) Reviewed-on: https://gerrit.automotivelinux.org/gerrit/c/AGL/meta-agl/+/25329
Diffstat (limited to 'meta-agl-profile-core/recipes-test/gcovr')
-rw-r--r--meta-agl-profile-core/recipes-test/gcovr/gcovr/0001-add-gcov-filter-source-errors-option.patch68
-rw-r--r--meta-agl-profile-core/recipes-test/gcovr/gcovr_%.bbappend2
-rw-r--r--meta-agl-profile-core/recipes-test/gcovr/gcovr_git.bb32
3 files changed, 102 insertions, 0 deletions
diff --git a/meta-agl-profile-core/recipes-test/gcovr/gcovr/0001-add-gcov-filter-source-errors-option.patch b/meta-agl-profile-core/recipes-test/gcovr/gcovr/0001-add-gcov-filter-source-errors-option.patch
new file mode 100644
index 000000000..be1dcf829
--- /dev/null
+++ b/meta-agl-profile-core/recipes-test/gcovr/gcovr/0001-add-gcov-filter-source-errors-option.patch
@@ -0,0 +1,68 @@
+Add option to filter gcov source errors
+
+Add "--gcov-filter-source-errors" to apply filters to the source
+files in the errors from gcov. If all source files in the errors
+are filtered, then the error is ignored so that the file will be
+processed. This enables the usecase of running on a target where
+only the source tree for a binary is available, but not all of the
+external source headers are.
+
+Upstream-Status: pending
+
+Signed-off-by: Scott Murray <scott.murray@konsulko.com>
+
+diff --git a/gcovr/configuration.py b/gcovr/configuration.py
+index 1356097..083532c 100644
+--- a/gcovr/configuration.py
++++ b/gcovr/configuration.py
+@@ -915,6 +915,14 @@ GCOVR_CONFIG_OPTIONS = [
+ "Default: {default!s}.",
+ action="store_true",
+ ),
++ GcovrConfigOption(
++ "gcov_filter_source_errors", ['--gcov-filter-source-errors'],
++ group="gcov_options",
++ help="Apply filters to missing source file errors in GCOV files "
++ "instead of exiting with an error. "
++ "Default: {default!s}.",
++ action="store_true",
++ ),
+ GcovrConfigOption(
+ "objdir", ['--object-directory'],
+ group="gcov_options",
+diff --git a/gcovr/gcov.py b/gcovr/gcov.py
+index de79215..171d68d 100644
+--- a/gcovr/gcov.py
++++ b/gcovr/gcov.py
+@@ -667,11 +667,27 @@ def run_gcov_and_process_files(
+ chdir=chdir,
+ tempdir=tempdir)
+
++ skip = False
+ if source_re.search(err):
+- # gcov tossed errors: try the next potential_wd
+- error(err)
+- done = False
+- else:
++ ignore = False
++ if options.gcov_filter_source_errors:
++ # Check if errors are all from source that is filtered
++ ignore = True
++ for line in err.splitlines():
++ src_fname = line.split()[-1]
++ filtered, excluded = apply_filter_include_exclude(
++ src_fname, options.filter, options.exclude)
++ if not (filtered or excluded):
++ ignore = False
++ break
++
++ if not ignore:
++ # gcov tossed errors: try the next potential_wd
++ error(err)
++ skip = True
++
++ done = False
++ if not skip:
+ # Process *.gcov files
+ for fname in active_gcov_files:
+ process_gcov_data(fname, covdata, abs_filename, options)
diff --git a/meta-agl-profile-core/recipes-test/gcovr/gcovr_%.bbappend b/meta-agl-profile-core/recipes-test/gcovr/gcovr_%.bbappend
new file mode 100644
index 000000000..699aea214
--- /dev/null
+++ b/meta-agl-profile-core/recipes-test/gcovr/gcovr_%.bbappend
@@ -0,0 +1,2 @@
+# Add not yet upstreamed patch that enables on target gcov usage
+SRC_URI += "file://0001-add-gcov-filter-source-errors-option.patch"
diff --git a/meta-agl-profile-core/recipes-test/gcovr/gcovr_git.bb b/meta-agl-profile-core/recipes-test/gcovr/gcovr_git.bb
new file mode 100644
index 000000000..6da04cc53
--- /dev/null
+++ b/meta-agl-profile-core/recipes-test/gcovr/gcovr_git.bb
@@ -0,0 +1,32 @@
+SUMMARY = "Generate GCC code coverage reports"
+DESCRIPTION = "Gcovr provides a utility for managing the use of the GNU gcov \
+utility and generating summarized code coverage results."
+HOMEPAGE = "https://gcovr.com"
+LICENSE = "BSD-3-Clause"
+LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=221e634a1ceafe02ef74462cbff2fb16"
+
+PV = "4.2+git${SRCPV}"
+SRC_URI = "git://github.com/gcovr/gcovr.git;protocol=https"
+SRCREV = "1bc72e3bb59b9296e962b350691732ddafbd3195"
+
+S = "${WORKDIR}/git"
+
+inherit setuptools3
+
+RDEPENDS_${PN} += " \
+ python3-compression \
+ python3-core \
+ python3-crypt \
+ python3-datetime \
+ python3-difflib \
+ python3-io \
+ python3-jinja2 \
+ python3-json \
+ python3-lxml \
+ python3-multiprocessing \
+ python3-pygments \
+ python3-pytest \
+ python3-shell \
+ python3-threading \
+ python3-typing \
+"