Commit b387251a authored by Martin Jeřábek's avatar Martin Jeřábek

Merge branch 'testfw-update' into 'master'

Testfw update

Closes #269

See merge request !238
parents f9bb7051 525f10f9
Pipeline #6783 passed with stage
in 42 seconds
......@@ -69,5 +69,3 @@ add wave -label "CAN RX" $TCOMP/can_rx
add wave -noupdate -divider -height 20 "CAN Node"
add wave -label "Protocol control" $TCOMP/CAN_inst/can_core_comp/PC_State
add wave -label "Bit timing state" $TCOMP/CAN_inst/bt_FSM_out
......@@ -71,15 +71,19 @@ def create():
# NOTE: I'd like to use [True, False, None] for strict, but click is damn
# stubborn about interpreting None as False
@click.argument('config', type=click.Path())
@click.argument('vunit_args', nargs=-1)
@click.option('--strict/--no-strict', default=True,
@click.option('--__strict-from-config', 'strict', flag_value=-1, default=True, hidden=True)
@click.option('--strict', 'strict', flag_value=1,
help='Return non-zero if an unconfigured test was found.')
@click.option('--no-strict', 'strict', flag_value=0)
@click.option('--create-ghws/--no-create-ghws', default=False,
help='Only elaborate and create basic GHW files necessary for converting TCL layout files to GTKW files for gtkwave..')
def test(obj, config, strict, create_ghws, vunit_args):
def test(obj, *, config, strict, create_ghws, vunit_args):
"""Run the tests. Configuration is passed in YAML config file.
You mas pass arguments directly to VUnit by appending them at the command end.
......@@ -110,9 +114,18 @@ def test(obj, config, strict, create_ghws, vunit_args):
if 'strict' in config:
if strict == -1:
strict = config['strict']
if strict == -1:
strict = 0
strict = bool(strict)
if create_ghws:
# discard the passed vunit_args, it does only evil
vunit_args = ['--elaborate']
# filter out "-g" (gui mode) - it causes problems.
# It's not 100% fool-proof, but should catch 99% of cases.
vunit_args = [a for a in vunit_args if a != '-g']
vunit_args += ['--elaborate']
ui = create_vunit(obj, vunit_args, out_basename)
......@@ -56,6 +56,7 @@ def factory(line: str):
'port-in': signal.create,
'port-out': signal.create,
'port-inout': signal.create,
'port-buffer': signal.create,
'generate-for': generate_for.create,
'package': container.create,
'process': container.create,
......@@ -134,9 +134,9 @@ def add_flags(ui, lib, build) -> None:
rt.scan_tests_from_file(str(build / "../reference/vunit_reference_wrapper.vhd"))
#lib.add_compile_option("ghdl.flags", ["-Wc,-g"])
lib.add_compile_option("ghdl.flags", ["-fprofile-arcs", "-ftest-coverage", "-fpsl"])
lib.add_compile_option("ghdl.flags", ["-fprofile-arcs", "-ftest-coverage", "-fpsl", "-g"])
elab_flags = ["-Wl,-lgcov"]
elab_flags = ["-Wl,-lgcov", "-g"]
......@@ -26,19 +26,18 @@ class ReferenceTests(TestsBase):
def configure(self) -> bool:
tb = self.lib.get_test_benches('*reference*')[0]
default = self.config['default']
self.add_modelsim_gui_file(tb, default, 'sanity')
tcl = / 'modelsim_init_reference.tcl'
with'wt', encoding='utf-8') as f:
global TCOMP
set TCOMP i_test
set TCOMP tb_reference_wrapper/i_test
'''), file=f)
init_files = get_common_modelsim_init_files()
init_files += [str(tcl)]
for data_set,cfg in self.config['tests'].items():
for data_set, cfg in self.config['tests'].items():
dict_merge(cfg, default)
# bm = len_to_matrix(cfg['topology'], cfg['bus_len_v'])
generics = {
......@@ -56,6 +55,6 @@ class ReferenceTests(TestsBase):
tb.add_config(data_set, generics=generics)
tb.set_sim_option("modelsim.init_files.after_load", init_files)
self.add_modelsim_gui_file(tb, cfg, data_set, init_files)
tb.set_sim_option("modelsim.init_files.after_load", init_files)
self.add_modelsim_gui_file(tb, default, 'reference', init_files)
return True
......@@ -96,7 +96,7 @@ class SanityTests(TestsBase):
sanity_cfg_name = name.replace(" ", "_").replace("/", "_").strip('"')
if (cfg['psl_coverage']):
if cfg['psl_coverage']:
psl_opts = self.create_psl_cov_file_opt(name)
tb.add_config(name, generics=generics, sim_options=psl_opts)
strict: false # unconfigured tests reported as error; defaults to true
_default: &default
log_level: info
error_tolerance: 0
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