From df45f41cf91e73eace85d571e5529a4e651096d4 Mon Sep 17 00:00:00 2001 From: Patrick Studer Date: Wed, 15 Jul 2026 09:26:15 +0200 Subject: [PATCH] Add check for existing coverage files to merge_coverage function (modelsim) If simulation is run with coverage enabled but no testcases were executed (because filtering), the merge_coverage procedure does end in an error. This pre-check checks, if there is anything to merge before performing the merge command. --- vunit/sim_if/modelsim.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/vunit/sim_if/modelsim.py b/vunit/sim_if/modelsim.py index d0ee6a13a..646ceca60 100644 --- a/vunit/sim_if/modelsim.py +++ b/vunit/sim_if/modelsim.py @@ -881,6 +881,11 @@ def merge_coverage(self, file_name, args=None): if args is None: args = [] + # Check if at least one valid coverage file exists. + if not any(file_exists(f) for f in self._coverage_files): + LOGGER.warning("No existing coverage files found. Skipping coverage database creation.") + return + coverage_files = str(Path(self._output_path) / "coverage_files.txt") vcover_cmd = [str(Path(self._prefix) / "vcover"), "merge", "-inputs"] + [coverage_files] + args + [file_name] with Path(coverage_files).open("w", encoding="utf-8") as fptr: