Skip to content

Commit

Permalink
Update tests for xunit classename attribute and default empty test name.
Browse files Browse the repository at this point in the history
  • Loading branch information
go2sh committed Feb 22, 2016
1 parent bf50fc2 commit 7ada684
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 36 deletions.
4 changes: 2 additions & 2 deletions vunit/test/acceptance/artificial/vhdl/tb_magic_paths.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
-- License, v. 2.0. If a copy of the MPL was not distributed with this file,
-- You can obtain one at http://mozilla.org/MPL/2.0/.
--
-- Copyright (c) 2015, Lars Asplund [email protected]
-- Copyright (c) 2015-2016, Lars Asplund [email protected]

library vunit_lib;
context vunit_lib.vunit_context;
Expand Down Expand Up @@ -30,7 +30,7 @@ begin
begin
test_runner_setup(runner, runner_cfg);
check_has_suffix(tb_path, "acceptance/artificial/vhdl/");
check_has_suffix(output_path, "acceptance/artificial out/tests/lib.tb_magic_paths/");
check_has_suffix(output_path, "acceptance/artificial out/tests/lib.tb_magic_paths.all/");
test_runner_cleanup(runner);
wait;
end process;
Expand Down
38 changes: 19 additions & 19 deletions vunit/test/acceptance/test_artificial.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def test_artificial_elaborate_only(self):

elab_expected_report = []
for status, name in EXPECTED_REPORT:
if name in ("lib.tb_elab_fail",):
if name in ("lib.tb_elab_fail.all",):
status = "failed"
else:
status = "passed"
Expand All @@ -55,16 +55,16 @@ def test_artificial_elaborate_only(self):
self.check(self.artificial_run_vhdl,
exit_code=0,
clean=False,
args=["--elaborate", "lib.tb_pass"])
args=["--elaborate", "lib.tb_pass.all"])
check_report(self.report_file, [
("passed", "lib.tb_pass")])
("passed", "lib.tb_pass.all")])

self.check(self.artificial_run_vhdl,
exit_code=1,
clean=False,
args=["--elaborate", "lib.tb_elab_fail"])
args=["--elaborate", "lib.tb_elab_fail.all"])
check_report(self.report_file, [
("failed", "lib.tb_elab_fail")])
("failed", "lib.tb_elab_fail.all")])

def _test_artificial(self, args=None):
"""
Expand Down Expand Up @@ -172,29 +172,29 @@ def check(self, run_file, args=None, persistent_sim=True, clean=True, exit_code=
def test_exit_0_flag(self):
self.check(self.artificial_run_vhdl,
exit_code=1,
args=["lib.tb_fail"])
args=["lib.tb_fail.all"])
self.check(self.artificial_run_vhdl,
exit_code=0,
args=["--exit-0", "lib.tb_fail"])
args=["--exit-0", "lib.tb_fail.all"])


EXPECTED_REPORT = (
("passed", "lib.tb_other_file_tests.pass"),
("failed", "lib.tb_other_file_tests.fail"),
("passed", "lib.tb_pass"),
("failed", "lib.tb_fail"),
("passed", "lib.tb_infinite_events"),
("failed", "lib.tb_fail_on_warning"),
("passed", "lib.tb_no_fail_on_warning"),
("passed", "lib.tb_two_architectures.pass"),
("failed", "lib.tb_two_architectures.fail"),
("passed", "lib.tb_pass.all"),
("failed", "lib.tb_fail.all"),
("passed", "lib.tb_infinite_events.all"),
("failed", "lib.tb_fail_on_warning.all"),
("passed", "lib.tb_no_fail_on_warning.all"),
("passed", "lib.tb_two_architectures.pass.all"),
("failed", "lib.tb_two_architectures.fail.all"),
("passed", "lib.tb_with_vhdl_runner.pass"),
("passed", "lib.tb_with_vhdl_runner.Test with spaces"),
("failed", "lib.tb_with_vhdl_runner.fail"),
("failed", "lib.tb_with_vhdl_runner.Test that timeouts"),
("passed", "lib.tb_magic_paths"),
("passed", "lib.tb_no_fail_after_cleanup"),
("failed", "lib.tb_elab_fail"),
("passed", "lib.tb_magic_paths.all"),
("passed", "lib.tb_no_fail_after_cleanup.all"),
("failed", "lib.tb_elab_fail.all"),

("passed", "lib.tb_same_sim_all_pass.Test 1"),
("passed", "lib.tb_same_sim_all_pass.Test 2"),
Expand All @@ -208,15 +208,15 @@ def test_exit_0_flag(self):
("failed", "lib.tb_with_checks.Test failing check"),
("failed", "lib.tb_with_checks.Test non-stopping failing check"),

("passed", "lib.tb_set_generic"),
("passed", "lib.tb_set_generic.all"),

("passed", "lib.tb_with_generic_config.Test 0"),
("passed", "lib.tb_with_generic_config.Test 1"),
("passed", "lib.tb_with_generic_config.Test 2"),
("passed", "lib.tb_with_generic_config.Test 3"),
("passed", "lib.tb_with_generic_config.Test 4"),

("passed", "lib.tb_no_generic_override"),
("passed", "lib.tb_no_generic_override.all"),

("passed", "lib.tb_ieee_warning.pass"),
("failed", "lib.tb_ieee_warning.fail"))
2 changes: 1 addition & 1 deletion vunit/test/acceptance/test_external_run_scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def test_vhdl_array_example_project(self):
def test_vhdl_user_guide_example_project(self):
self.check(join(ROOT, "examples", "vhdl", "user_guide", "run.py"), exit_code=1)
check_report(self.report_file,
[("passed", "lib.tb_example"),
[("passed", "lib.tb_example.all"),
("passed", "lib.tb_example_many.test_pass"),
("failed", "lib.tb_example_many.test_fail")])

Expand Down
2 changes: 1 addition & 1 deletion vunit/test/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def check_report(report_file, tests):

if test.find("failure") is not None:
status = "failed"
report[test.attrib["name"]] = status
report[test.attrib["classname"] + "." + test.attrib["name"]] = status

for status, name in tests:
if report[name] != status:
Expand Down
24 changes: 12 additions & 12 deletions vunit/test/unit/test_test_scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Copyright (c) 2014-2015, Lars Asplund [email protected]
# Copyright (c) 2014-2016, Lars Asplund [email protected]

"""
Tests the test scanner
Expand Down Expand Up @@ -46,15 +46,15 @@ def test_that_single_vhdl_test_is_created(self):
ent = lib.add_entity("tb_entity")
ent.set_contents("")
tests = self.test_scanner.from_project(project)
self.assert_has_tests(tests, ["lib.tb_entity"])
self.assert_has_tests(tests, ["lib.tb_entity.all"])

def test_that_single_verilog_test_is_created(self):
project = ProjectStub()
lib = project.add_library("lib")
module = lib.add_module("tb_module")
module.set_contents("")
tests = self.test_scanner.from_project(project)
self.assert_has_tests(tests, ["lib.tb_module"])
self.assert_has_tests(tests, ["lib.tb_module.all"])

def test_that_tests_are_filtered(self):
project = ProjectStub()
Expand All @@ -74,9 +74,9 @@ def test_that_tests_are_filtered(self):

tests = self.test_scanner.from_project(project, entity_filter=tb_filter)
self.assert_has_tests(tests,
["lib.entity_tb",
"lib.tb_entity",
"lib.tb_entity2"])
["lib.entity_tb.all",
"lib.tb_entity.all",
"lib.tb_entity2.all"])

def test_that_two_tests_are_created_from_two_architectures(self):
project = ProjectStub()
Expand All @@ -89,8 +89,8 @@ def test_that_two_tests_are_created_from_two_architectures(self):

tests = self.test_scanner.from_project(project)
self.assert_has_tests(tests,
["lib.tb_entity.arch",
"lib.tb_entity.arch2"])
["lib.tb_entity.arch.all",
"lib.tb_entity.arch2.all"])

def test_create_tests_with_runner_cfg_generic(self):
project = ProjectStub()
Expand Down Expand Up @@ -206,7 +206,7 @@ def test_create_default_test_with_runner_cfg_generic(self):

tests = self.test_scanner.from_project(project)
self.assert_has_tests(tests,
["lib.tb_entity"])
["lib.tb_entity.all"])

def test_that_pragma_run_in_same_simulation_works(self):
project = ProjectStub()
Expand Down Expand Up @@ -237,8 +237,8 @@ def test_adds_tb_path_generic(self):

tests = self.test_scanner.from_project(project)

with_path_generics = find_generics(tests, "lib.tb_entity_with_tb_path")
without_path_generics = find_generics(tests, "lib.tb_entity_without_tb_path")
with_path_generics = find_generics(tests, "lib.tb_entity_with_tb_path.all")
without_path_generics = find_generics(tests, "lib.tb_entity_without_tb_path.all")
self.assertEqual(with_path_generics["tb_path"], (out() + "/").replace("\\", "/"))
self.assertNotIn("tb_path", without_path_generics)

Expand All @@ -262,7 +262,7 @@ def test_warning_on_non_overrriden_tb_path(self, mock_logger):
self.assertIn("lib.tb_entity", call_args)
self.assertIn(tb_path_non_overriden_value, call_args)
self.assertIn(tb_path_value, call_args)
generics = find_generics(tests, "lib.tb_entity")
generics = find_generics(tests, "lib.tb_entity.all")
self.assertEqual(generics["tb_path"], tb_path_value)

@mock.patch("vunit.test_scanner.LOGGER")
Expand Down
2 changes: 1 addition & 1 deletion vunit/test/unit/test_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ def test_scan_tests_from_other_file(self):

tests = ui._create_tests(None) # pylint: disable=protected-access
# tb_top is a single test case in itself
self.assertEqual(tests.test_names(), ["lib.tb_top"])
self.assertEqual(tests.test_names(), ["lib.tb_top.all"])

if tb_type == "vhdl":
test_bench = lib.entity("tb_top")
Expand Down

0 comments on commit 7ada684

Please sign in to comment.