@@ -137,15 +137,18 @@ def __init__(self, target, notify=None, macros=None, build_profile=None,
137
137
self .use_distcc = (bool (getenv ("DISTCC_POTENTIAL_HOSTS" , False ))
138
138
and not getenv ("MBED_DISABLE_DISTCC" , False ))
139
139
140
+ # create copies of gcc/ld options as coverage build options, and injects extra coverage options
140
141
self .coverage_cc = self .cc + ["--coverage" , "-DENABLE_LIBGCOV_PORT" ]
141
142
self .coverage_cppc = self .cppc + ["--coverage" , "-DENABLE_LIBGCOV_PORT" ]
142
143
self .coverage_ld = self .ld + ['--coverage' , '-Wl,--wrap,GREENTEA_SETUP' , '-Wl,--wrap,_Z25GREENTEA_TESTSUITE_RESULTi' ]
143
144
145
+ # for gcc coverage options remove MBED_DEBUG macro (this is required by code coverage function)
144
146
for flag in ["-DMBED_DEBUG" ]:
145
147
if flag in self .coverage_cc :
146
148
self .coverage_cc .remove (flag )
147
149
if flag in self .coverage_cppc :
148
150
self .coverage_cppc .remove (flag )
151
+ # for lg coverage options remove exit wrapper (this is required by code coverage function)
149
152
for flag in ['-Wl,--wrap,exit' , '-Wl,--wrap,atexit' ]:
150
153
if flag in self .coverage_ld :
151
154
self .coverage_ld .remove (flag )
@@ -224,6 +227,7 @@ def get_compile_options(self, defines, includes, for_asm=False):
224
227
return opts
225
228
226
229
def match_coverage_patterns (self , source ):
230
+ """Check whether the give source file match with coverage patterns, if so return True. """
227
231
for pattern in self .coverage_patterns :
228
232
if fnmatch .fnmatch (source , pattern ):
229
233
return True
0 commit comments