Commit 97e9d740 authored by Martin Jeřábek's avatar Martin Jeřábek
Browse files

Merge branch '141-ghdl-unit-tests-only-one-unit-test-in-run-for-all-testcases' into 'master'

Resolve "ghdl unit tests: only one unit test in run for all testcases"

Closes #141

See merge request illeondr/CAN_FD_IP_Core!75
parents 01a43cfd ebd1ae7f
......@@ -39,22 +39,38 @@ def create_wrapper(lib):
m = r.match(l)
if m:
tests.append(m.group(1))
wrapper = []
configs = []
tbs = []
for test in tests:
configs.append(dedent("""\
configuration tbconf_{test} of vunittb_wrapper is
for tb
for i_test : CAN_test use entity work.CAN_test({test}); end for;
end for;
end configuration;
-- -----------------------------------------------------------------------------
""".format(test=test)
))
tbs.append(dedent("""\
library work;
USE work.CANtestLib.All;
entity tb_{test} is generic (runner_cfg : string); end entity;
architecture tb of tb_{test} is
component vunittb_wrapper is generic (xrunner_cfg : string); end component;
for all:vunittb_wrapper use configuration work.tbconf_{test};
begin
tb:vunittb_wrapper generic map(xrunner_cfg => runner_cfg);
end architecture;
-- -----------------------------------------------------------------------------
""".format(test=test)
))
with open("tb_wrappers.vhd", "wt", encoding='utf-8') as f:
for test in tests:
f.write(dedent("""\
library work;
USE work.CANtestLib.All;
for c in configs:
f.write(c)
for t in tbs:
f.write(t)
entity tb_{test} is generic (runner_cfg : string); end entity;
architecture tb of tb_{test} is
for all:CAN_test use entity work.CAN_test({test});
begin
tb:entity work.vunittb_wrapper generic map(xrunner_cfg => runner_cfg);
end architecture;
-- -----------------------------------------------------------------------------
""".format(test=test)
))
lib.add_source_file("tb_wrappers.vhd")
# ghdl creates a new process group for itself and fails to kill its child when it receives a signal :(
......
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