twister: tests: Add unit tests for names of external and module tests

Add test cases verifing that test id for external and module tests is
not --testsuite-root dependant.

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
This commit is contained in:
Maciej Perkowski 2022-10-24 11:57:59 +02:00 committed by Anas Nashif
parent 21eb27c5c0
commit 45e1ff94cd

View file

@ -104,6 +104,30 @@ TESTDATA_3 = [
'test_a.check_1.check_2',
'zephyr/test_a.check_1.check_2'
),
(
os.path.join(ZEPHYR_BASE, '..', 'module_A', 'samples', 'hello_world'),
os.path.join(ZEPHYR_BASE, '..', 'module_A', 'samples', 'hello_world'),
'test_c.check_1',
'module_A/samples/hello_world/test_c.check_1'
),
(
os.path.join(ZEPHYR_BASE, '..', 'module_A'),
os.path.join(ZEPHYR_BASE, '..', 'module_A', 'samples', 'hello_world'),
'test_c.check_2',
'module_A/samples/hello_world/test_c.check_2'
),
(
os.path.join(ZEPHYR_BASE, '..', '..', 'my_own_zephyr', 'samples', 'hello_world'),
os.path.join(ZEPHYR_BASE, '..', '..', 'my_own_zephyr', 'samples', 'hello_world'),
'test_c.check_1',
'external/my_own_zephyr/samples/hello_world/test_c.check_1'
),
(
os.path.join(ZEPHYR_BASE, '..', '..', 'my_own_zephyr'),
os.path.join(ZEPHYR_BASE, '..', '..', 'my_own_zephyr', 'samples', 'hello_world'),
'test_c.check_2',
'external/my_own_zephyr/samples/hello_world/test_c.check_2'
),
]
@pytest.mark.parametrize("testsuite_root, suite_path, name, expected", TESTDATA_3)
def test_get_unique(testsuite_root, suite_path, name, expected):