summaryrefslogtreecommitdiff
path: root/zephyr/zmake/zmake/zmake.py
diff options
context:
space:
mode:
authorJeremy Bettis <jbettis@google.com>2021-04-06 17:29:52 -0600
committerCommit Bot <commit-bot@chromium.org>2021-04-07 23:58:49 +0000
commit93c2031f3d887e8b221a3b303a73390771793e97 (patch)
treef6388dcde1e0ff8ec7c0efefc22be0179bc4507f /zephyr/zmake/zmake/zmake.py
parent0940ca52bde3bbcffd5cc671547fc635026f1f68 (diff)
downloadchrome-ec-93c2031f3d887e8b221a3b303a73390771793e97.tar.gz
zephyr: Bundle a summary code coverage file
Fix zmake coverage, it was still using the removed claim_job flag. Change zmake coverage to output a summary lcov.info file as well. Implement zephyr/firmware_builder.py --code-coverage test. Implement zephyr/firmware_builder.py --code-coverage bundle. BRANCH=none BUG=b:183007888 TEST=cros workon --host start chromeos-base/zephyr-build-tools sudo emerge chromeos-base/zephyr-build-tools zephyr/firmware_builder.py --metrics=/tmp/m --code-coverage test zephyr/firmware_builder.py --metrics=/tmp/m --code-coverage bundle tar tvf /tmp/artifact_bundles/coverage.tbz2 cat /tmp/artifact_bundle_metadata Signed-off-by: Jeremy Bettis <jbettis@google.com> Change-Id: I3fbdc4e57029d23a4d24b7ad6e003ee624c75f37 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2809354 Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Kevin Shelton <kmshelton@chromium.org> Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Tested-by: Jeremy Bettis <jbettis@chromium.org>
Diffstat (limited to 'zephyr/zmake/zmake/zmake.py')
-rw-r--r--zephyr/zmake/zmake/zmake.py21
1 files changed, 17 insertions, 4 deletions
diff --git a/zephyr/zmake/zmake/zmake.py b/zephyr/zmake/zmake/zmake.py
index 0b1a57866c..f341de3030 100644
--- a/zephyr/zmake/zmake/zmake.py
+++ b/zephyr/zmake/zmake/zmake.py
@@ -461,7 +461,6 @@ class Zmake:
if initial:
cmd += ['-i']
proc = self.jobserver.popen(cmd,
- claim_job=False,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
encoding='utf-8',
@@ -506,7 +505,6 @@ class Zmake:
['/usr/bin/ninja', '-C', dirs[build_name], 'all.libraries'],
# Ninja will connect as a job client instead and claim
# many jobs.
- claim_job=False,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
encoding='utf-8',
@@ -574,7 +572,6 @@ class Zmake:
proc = self.jobserver.popen(
[self.module_paths['ec'] /
'util/getversion.sh'],
- claim_job=False,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
encoding='utf-8',
@@ -588,6 +585,23 @@ class Zmake:
if proc.wait():
raise OSError(get_process_failure_msg(proc))
+ # Merge info files into a single lcov.info
+ self.logger.info("Merging coverage data into %s.",
+ build_dir / 'lcov.info')
+ cmd = ['/usr/bin/lcov', '-o', build_dir / 'lcov.info']
+ for info in all_lcov_files:
+ cmd += ['-a', info]
+ proc = self.jobserver.popen(
+ cmd,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE,
+ encoding='utf-8',
+ errors='replace')
+ zmake.multiproc.log_output(self.logger, logging.ERROR, proc.stderr)
+ zmake.multiproc.log_output(self.logger, logging.DEBUG, proc.stdout)
+ if proc.wait():
+ raise OSError(get_process_failure_msg(proc))
+
# Merge into a nice html report
self.logger.info("Creating coverage report %s.",
build_dir / 'coverage_rpt')
@@ -596,7 +610,6 @@ class Zmake:
build_dir / 'coverage_rpt', '-t',
"Zephyr EC Unittest {}".format(version), '-p',
self.checkout / 'src', '-s'] + all_lcov_files,
- claim_job=False,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
encoding='utf-8',