scripts: tests: Move --ninja test to test_tooling

Brings the previously-created --ninja test to its test section file.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
This commit is contained in:
Lukasz Mrugala 2024-02-05 13:02:34 +00:00 committed by David Leach
commit fd063d6ae5
2 changed files with 33 additions and 27 deletions

View file

@ -477,33 +477,6 @@ class TestRunner:
assert str(sys_exit.value) == '0'
@pytest.mark.parametrize(
'test_path, test_platforms',
TESTDATA_4,
ids=[
'ninja',
]
)
@pytest.mark.parametrize(
'flag',
['--ninja', '-N']
)
def test_ninja(self, capfd, out_path, test_path, test_platforms, flag):
args = ['--outdir', out_path, '-T', test_path, flag] + \
[val for pair in zip(
['-p'] * len(test_platforms), test_platforms
) for val in pair]
with mock.patch.object(sys, 'argv', [sys.argv[0]] + args), \
pytest.raises(SystemExit) as sys_exit:
self.loader.exec_module(self.twister_module)
out, err = capfd.readouterr()
sys.stdout.write(out)
sys.stderr.write(err)
assert str(sys_exit.value) == '0'
@pytest.mark.parametrize(
'test_path, test_platforms',
TESTDATA_4,

View file

@ -84,3 +84,36 @@ class TestTooling:
# Normally, board not supporting our toolchain would be filtered, so we check against that
assert len(filtered_j) == 1
assert filtered_j[0][3] != 'filtered'
@pytest.mark.parametrize(
'test_path, test_platforms',
[
(
os.path.join(TEST_DATA, 'tests', 'dummy', 'agnostic'),
['qemu_x86'],
)
],
ids=[
'ninja',
]
)
@pytest.mark.parametrize(
'flag',
['--ninja', '-N']
)
@mock.patch.object(TestPlan, 'TESTSUITE_FILENAME', testsuite_filename_mock)
def test_ninja(self, capfd, out_path, test_path, test_platforms, flag):
args = ['--outdir', out_path, '-T', test_path, flag] + \
[val for pair in zip(
['-p'] * len(test_platforms), test_platforms
) for val in pair]
with mock.patch.object(sys, 'argv', [sys.argv[0]] + args), \
pytest.raises(SystemExit) as sys_exit:
self.loader.exec_module(self.twister_module)
out, err = capfd.readouterr()
sys.stdout.write(out)
sys.stderr.write(err)
assert str(sys_exit.value) == '0'