diff options
author | Jeremy Bettis <jbettis@google.com> | 2021-03-17 16:48:56 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-03-18 21:39:05 +0000 |
commit | 965348c68ac1d2ae700b560c9c0118e96847b6ad (patch) | |
tree | 7c60322b5029989c6320c4ca423ebea6cc718eea /util | |
parent | 30235cdfc9fba58a0bf67caa19f06caeef79a4db (diff) | |
download | chrome-ec-965348c68ac1d2ae700b560c9c0118e96847b6ad.tar.gz |
zephyr: Add util to normalize symlinks from lcov
Building a zephyr ztest with zmake (say that 3 times fast) creates many
symlinks, and makes it hard to merge the coverage output. The
util/normalize_symlinks.py tool takes a lcov info file as input and
replaces symlinks with their actual paths in all SF: lines.
BUG=b:183007888
TEST=Ran the commands in the md file.
BRANCH=none
Signed-off-by: Jeremy Bettis <jbettis@google.com>
Change-Id: Ic8f9aedec30051d7474aa77ba2fb406e0746a719
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2770508
Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org>
Commit-Queue: Jeremy Bettis <jbettis@chromium.org>
Tested-by: Jeremy Bettis <jbettis@chromium.org>
Diffstat (limited to 'util')
-rwxr-xr-x | util/normalize_symlinks.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/util/normalize_symlinks.py b/util/normalize_symlinks.py new file mode 100755 index 0000000000..112202b39e --- /dev/null +++ b/util/normalize_symlinks.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python3 +# Copyright 2021 The Chromium OS Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Takes a lcov info file as input and normalizes symlinks from SF: lines.""" + +import fileinput +import os +import sys + +for line in fileinput.input(): + if line.startswith('SF:'): + path = line[3:].rstrip() + sys.stdout.write('SF:%s\n' % os.path.realpath(path)) + else: + sys.stdout.write(line) |