10
10
import signal
11
11
12
12
import exts .fs
13
- import exts .func
14
13
import exts .archive
15
14
import devtools .ya .test .programs .test_tool .lib .coverage as lib_coverage
16
15
from devtools .common import libmagic
@@ -65,6 +64,11 @@ def merge_segments(s1, s2):
65
64
return lib_coverage .merge .merge_clang_segments ([s1 , s2 ])
66
65
67
66
67
+ @shared .timeit
68
+ def merge_branches (b1 , b2 ):
69
+ return lib_coverage .merge .merge_clang_branches ([b1 , b2 ])
70
+
71
+
68
72
@shared .timeit
69
73
def saturate_coverage (covtype , covdata , source_root , cache , mcdc = False , branches = False ):
70
74
if covtype == 'files' :
@@ -85,6 +89,9 @@ def saturate_coverage(covtype, covdata, source_root, cache, mcdc=False, branches
85
89
'segments' : [],
86
90
'functions' : {},
87
91
}
92
+ if branches :
93
+ cache [relfilename ]['branches' ] = []
94
+
88
95
cache_entry = cache [relfilename ]
89
96
90
97
if covtype == 'files' :
@@ -100,10 +107,11 @@ def saturate_coverage(covtype, covdata, source_root, cache, mcdc=False, branches
100
107
raise AssertionError ("Found MC/DC coverage duplicate" )
101
108
cache_entry ['mcdc' ] = covdata ['mcdc_records' ]
102
109
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' ])
107
115
108
116
if not cache_entry ['segments' ]:
109
117
cache_entry ['segments' ] = covdata ['segments' ]
0 commit comments