Skip to content

Commit 4825bb7

Browse files
committed
add branches merge in resolve_clang_coverage node
commit_hash:125778c1dd9196744f29e3906ceadfe73b22d9e1
1 parent 868ee1a commit 4825bb7

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

devtools/ya/test/programs/test_tool/resolve_clang_coverage/resolve_clang_coverage.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import signal
1111

1212
import exts.fs
13-
import exts.func
1413
import exts.archive
1514
import devtools.ya.test.programs.test_tool.lib.coverage as lib_coverage
1615
from devtools.common import libmagic
@@ -65,6 +64,11 @@ def merge_segments(s1, s2):
6564
return lib_coverage.merge.merge_clang_segments([s1, s2])
6665

6766

67+
@shared.timeit
68+
def merge_branches(b1, b2):
69+
return lib_coverage.merge.merge_clang_branches([b1, b2])
70+
71+
6872
@shared.timeit
6973
def saturate_coverage(covtype, covdata, source_root, cache, mcdc=False, branches=False):
7074
if covtype == 'files':
@@ -85,6 +89,9 @@ def saturate_coverage(covtype, covdata, source_root, cache, mcdc=False, branches
8589
'segments': [],
8690
'functions': {},
8791
}
92+
if branches:
93+
cache[relfilename]['branches'] = []
94+
8895
cache_entry = cache[relfilename]
8996

9097
if covtype == 'files':
@@ -100,10 +107,11 @@ def saturate_coverage(covtype, covdata, source_root, cache, mcdc=False, branches
100107
raise AssertionError("Found MC/DC coverage duplicate")
101108
cache_entry['mcdc'] = covdata['mcdc_records']
102109

103-
if branches and 'branches' in covdata:
104-
if 'branches' in cache_entry:
105-
raise AssertionError("Found branch coverage duplicate")
106-
cache_entry['branches'] = covdata['branches']
110+
if branches:
111+
if not cache_entry['branches']:
112+
cache_entry['branches'] = covdata['branches']
113+
else:
114+
cache_entry['branches'] = merge_branches(cache_entry['branches'], covdata['branches'])
107115

108116
if not cache_entry['segments']:
109117
cache_entry['segments'] = covdata['segments']

0 commit comments

Comments
 (0)