Commit 933f02b5 authored by Ille, Ondrej, Ing.'s avatar Ille, Ondrej, Ing.

test: Add PSL coverage to YML config. Avoid copying coverage data

parent 4133ac37
Pipeline #6191 failed with stages
in 1 minute and 56 seconds
......@@ -120,7 +120,7 @@ pages:
- cp test/tests_*.xml public/
- mv test/code_html public/coverage || true
- cp doc/core/Progdokum.pdf public/ || true
- cp -R test/functional_coverage/* public/functional_coverage/ || true
- cp -R test/build/functional_coverage/* public/functional_coverage/ || true
# only:
# - master
artifacts:
......
......@@ -19,9 +19,6 @@ coverage:
genhtml code_coverage.info --output-directory code_html
functional_coverage:
mkdir -p $(BUILD_DIR)/functional_coverage/coverage_data
mkdir -p $(BUILD_DIR)/functional_coverage/html
cp $(BUILD_DIR)/psl_cov_*.json $(BUILD_DIR)/functional_coverage/coverage_data
$(PYTHON) $(TESTFW_DIR)/test_parse_psl_coverage.py
clean:
......
......@@ -10,6 +10,7 @@ from os.path import abspath
from .log import MyLogRecord
d = Path(abspath(__file__)).parent
func_cov_dir = os.path.join(str(d.parent), "build/functional_coverage")
def setup_logging() -> None:
......@@ -125,6 +126,11 @@ def test(obj, config, strict, vunit_args):
if cfg_key in config:
tests.append(factory(ui, lib, config[cfg_key], build, base))
if not os.path.exists(func_cov_dir):
os.makedirs(func_cov_dir);
os.makedirs(os.path.join(func_cov_dir, "html"))
os.makedirs(os.path.join(func_cov_dir, "coverage_data"))
for t in tests:
t.add_sources()
add_flags(ui, lib, build)
......
......@@ -27,7 +27,8 @@ class FeatureTests(TestsBase):
tb.scan_tests_from_file(str(wrname))
def create_psl_cov_file_opt(self, name):
psl_flag = "--psl-report=psl_cov_feature_{}.json".format(name)
psl_path = "functional_coverage/coverage_data/psl_cov_feature_{}.json".format(name)
psl_flag = "--psl-report={}".format(psl_path)
return {"ghdl.sim_flags" : [psl_flag]}
def configure(self) -> bool:
......@@ -64,8 +65,12 @@ class FeatureTests(TestsBase):
'seed' : get_seed(cfg)
}
psl_opts = self.create_psl_cov_file_opt(name)
tb.add_config(name, generics=generics, sim_options=psl_opts)
if (cfg['psl_coverage']):
psl_opts = self.create_psl_cov_file_opt(name)
tb.add_config(name, generics=generics, sim_options=psl_opts)
else:
tb.add_config(name, generics=generics)
return self._check_for_unconfigured()
def _check_for_unconfigured(self) -> bool:
......
......@@ -36,7 +36,7 @@ def merge_psl_coverage_files(out_file, in_file_prefix):
continue
in_filename = os.path.join(psl_dir, filename)
print("Merging JSON PSL coverage from: {}".format(in_filename))
print("Merging JSON PSL coverage from: {}\n".format(in_filename))
json_in_file = open(in_filename, 'r')
json_obj = json.load(json_in_file)
......
......@@ -19,7 +19,8 @@ class ReferenceTests(TestsBase):
add_sources(self.lib, sources)
def create_psl_cov_file_opt(self, name):
psl_flag = "--psl-report=psl_cov_reference_{}.json".format(name)
psl_path = "functional_coverage/coverage_data/psl_cov_reference_{}.json".format(name)
psl_flag = "--psl-report={}".format(psl_path)
return {"ghdl.sim_flags" : [psl_flag]}
def configure(self) -> bool:
......@@ -38,9 +39,13 @@ class ReferenceTests(TestsBase):
'seed' : get_seed(cfg),
'data_path' : str(self.build) + '/../' + cfg['data_path'],
}
psl_opts = self.create_psl_cov_file_opt(data_set)
tb.add_config(data_set, generics=generics, sim_options=psl_opts)
if (cfg['psl_coverage']):
psl_opts = self.create_psl_cov_file_opt(data_set)
tb.add_config(data_set, generics=generics, sim_options=psl_opts)
else:
tb.add_config(data_set, generics=generics)
tcl = self.build / 'modelsim_init_{}.tcl'.format(data_set)
with tcl.open('wt', encoding='utf-8') as f:
print(dedent('''\
......
......@@ -43,7 +43,8 @@ class SanityTests(TestsBase):
add_sources(self.lib, ['sanity/**/*.vhd'])
def create_psl_cov_file_opt(self, name):
psl_flag = "--psl-report=psl_cov_sanity_{}.json".format(name)
psl_path = "functional_coverage/coverage_data/psl_cov_sanity_{}.json".format(name)
psl_flag = "--psl-report={}".format(psl_path)
return {"ghdl.sim_flags" : [psl_flag]}
def configure(self):
......@@ -78,6 +79,11 @@ class SanityTests(TestsBase):
}
sanity_cfg_name = name.replace(" ", "_").replace("/", "_").strip('"')
psl_opts = self.create_psl_cov_file_opt(sanity_cfg_name)
tb.add_config(name, generics=generics, sim_options=psl_opts)
if (cfg['psl_coverage']):
psl_opts = self.create_psl_cov_file_opt(name)
tb.add_config(name, generics=generics, sim_options=psl_opts)
else:
tb.add_config(name, generics=generics)
return True
......@@ -14,7 +14,8 @@ class UnitTests(TestsBase):
self._create_wrapper(self.build / "tb_wrappers.vhd")
def add_psl_cov_file(self, tb, name):
psl_flag = "--psl-report=psl_cov_unit_{}.json".format(name)
psl_path = "functional_coverage/coverage_data/psl_cov_unit_{}.json".format(name)
psl_flag = "--psl-report={}".format(psl_path)
tb.set_sim_option("ghdl.sim_flags", [psl_flag])
def configure(self) -> bool:
......@@ -47,7 +48,8 @@ class UnitTests(TestsBase):
init_files = get_common_modelsim_init_files()
init_files += [str(tcl)]
tb.set_sim_option("modelsim.init_files.after_load", init_files)
self.add_psl_cov_file(tb, name)
if (cfg['psl_coverage']):
self.add_psl_cov_file(tb, name)
self.add_modelsim_gui_file(tb, cfg, name)
return self._check_for_unconfigured()
......
......@@ -11,3 +11,4 @@ feature:
wave: feature/feature_env_setup.tcl
tests:
txt_buffer_hazard:
iterations: 1
_default: &default
log_level: info
psl_coverage: true
error_tolerance: 0
# seed: 0 # optional; use to reconstruct results from randomized runs
# randomize: false
......@@ -72,7 +73,7 @@ feature:
iterations: 1
timestamp_registers:
txt_buffer_hazard:
iterations: 5
iterations: 20
reference:
default:
<<: *default
......
_default: &default
log_level: info
psl_coverage: true
error_tolerance: 0
randomize: true
unit:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment