Commit 315fb337 authored by Ille, Ondrej, Ing.'s avatar Ille, Ondrej, Ing.

test: Move PSL settings to be separate for all test types.

Unit tests have corresponding Vunit Test object created.
Other tests dont, and different runs are done via add_config on
testbench object. Thus on unit tests, sim_options can be passed over
test object. On others these must be passed to add_config.
parent f37e36fb
......@@ -71,7 +71,6 @@ def add_sources(lib, patterns) -> None:
if f != "tb_wrappers.vhd":
lib.add_source_file(str(f))
def add_common_sources(lib, ui) -> None:
add_sources(lib, ['../src/**/*.vhd'])
ui.enable_check_preprocessing()
......@@ -93,10 +92,6 @@ def add_flags(ui, lib, build) -> None:
for rt in reference_tests:
rt.scan_tests_from_file(str(build / "../reference/vunit_reference_wrapper.vhd"))
sanity_tests = lib.get_test_benches('*sanity*', allow_empty=True)
for st in sanity_tests:
st.scan_tests_from_file(str(build / "../sanity/tb_sanity.vhd"))
#lib.add_compile_option("ghdl.flags", ["-Wc,-g"])
lib.add_compile_option("ghdl.flags", ["-fprofile-arcs", "-ftest-coverage", "-fpsl"])
......@@ -110,20 +105,6 @@ def add_flags(ui, lib, build) -> None:
sim_flags = ["--ieee-asserts=disable-at-0"]
ui.set_sim_option("ghdl.sim_flags", sim_flags)
# PSL Coverage file is per-test specific! This must be set to avoid overwriting
# coverage results between tests
log.debug("Setting PSL coverage paths")
testbenches = lib.get_test_benches()
for testbench in testbenches:
log.debug("Testbench:")
log.debug(testbench.name)
tests = testbench.get_tests()
log.debug("Test cases:")
for test in tests:
log.debug(test.name)
psl_flag = "--psl-report=psl_cov_{}_{}.json".format(testbench.name, test.name)
test.set_sim_option("ghdl.sim_flags", [psl_flag])
modelsim_init_files = get_common_modelsim_init_files()
ui.set_sim_option("modelsim.init_files.after_load", modelsim_init_files)
......
......@@ -26,6 +26,10 @@ class FeatureTests(TestsBase):
tb = self.lib.get_test_benches('*tb_feature')[0]
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)
return {"ghdl.sim_flags" : [psl_flag]}
def configure(self) -> bool:
tb = self.lib.get_test_benches('*tb_feature')[0]
default = self.config['default']
......@@ -59,7 +63,9 @@ class FeatureTests(TestsBase):
'test_name' : name,
'seed' : get_seed(cfg)
}
tb.add_config(name, generics=generics)
psl_opts = self.create_psl_cov_file_opt(name)
tb.add_config(name, generics=generics, sim_options=psl_opts)
return self._check_for_unconfigured()
def _check_for_unconfigured(self) -> bool:
......
......@@ -18,6 +18,10 @@ class ReferenceTests(TestsBase):
sources.append('reference/vunit_reference_wrapper.vhd')
add_sources(self.lib, sources)
def create_psl_cov_file_opt(self, name):
psl_flag = "--psl-report=psl_cov_reference_{}.json".format(name)
return {"ghdl.sim_flags" : [psl_flag]}
def configure(self) -> bool:
tb = self.lib.get_test_benches('*reference*')[0]
default = self.config['default']
......@@ -34,7 +38,8 @@ class ReferenceTests(TestsBase):
'seed' : get_seed(cfg),
'data_path' : str(self.build) + '/../' + cfg['data_path'],
}
tb.add_config(data_set, generics=generics)
psl_opts = self.create_psl_cov_file_opt(data_set)
tb.add_config(data_set, generics=generics, sim_options=psl_opts)
tcl = self.build / 'modelsim_init_{}.tcl'.format(data_set)
with tcl.open('wt', encoding='utf-8') as f:
......
......@@ -42,6 +42,10 @@ class SanityTests(TestsBase):
def add_sources(self):
add_sources(self.lib, ['sanity/**/*.vhd'])
def create_psl_cov_file_opt(self, name):
psl_flag = "--psl-report=psl_cov_sanity_{}.json".format(name)
return {"ghdl.sim_flags" : [psl_flag]}
def configure(self):
# TODO: wave
tb = self.lib.get_test_benches('*tb_sanity')[0]
......@@ -72,5 +76,8 @@ class SanityTests(TestsBase):
'timing_config': vhdl_serialize(cfg['timing_config']),
'gauss_iter' : vhdl_serialize(cfg['gauss_iter']),
}
tb.add_config(name, generics=generics)
return True
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)
return True
......@@ -13,6 +13,10 @@ class UnitTests(TestsBase):
add_sources(self.lib, ['unit/**/*.vhd'])
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)
tb.set_sim_option("ghdl.sim_flags", [psl_flag])
def configure(self) -> bool:
lib, config, build = self.lib, self.config, self.build
default = config['default']
......@@ -43,6 +47,7 @@ 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)
self.add_modelsim_gui_file(tb, cfg, name)
return self._check_for_unconfigured()
......
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