Skip to content

Commit 1440b19

Browse files
committed
twister: restore logic to determine which gcov we should use
We do not want to use gcov from the SDK for native posix and unit tests, instead we want the system gcov. Restore logic that determines that. Fixes #54226 Signed-off-by: Anas Nashif <[email protected]>
1 parent 70830b5 commit 1440b19

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

scripts/pylib/twister/twisterlib/coverage.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,10 @@ def _generate(self, outdir, coveragelog):
237237

238238

239239
def run_coverage(testplan, options):
240+
for plat in options.coverage_platform:
241+
_plat = testplan.get_platform(plat)
242+
if _plat and (_plat.type in {"native", "unit"}):
243+
use_system_gcov = True
240244
if not options.gcov_tool:
241245
zephyr_sdk_gcov_tool = os.path.join(
242246
os.environ.get("ZEPHYR_SDK_INSTALL_DIR", default=""),
@@ -253,10 +257,10 @@ def run_coverage(testplan, options):
253257
except OSError:
254258
shutil.copy(llvm_cov, gcov_lnk)
255259
options.gcov_tool = gcov_lnk
260+
elif use_system_gcov:
261+
options.gcov_tool = "gcov"
256262
elif os.path.exists(zephyr_sdk_gcov_tool):
257263
options.gcov_tool = zephyr_sdk_gcov_tool
258-
else:
259-
options.gcov_tool = "gcov"
260264

261265
logger.info("Generating coverage files...")
262266
coverage_tool = CoverageTool.factory(options.coverage_tool)

0 commit comments

Comments
 (0)