Skip to content

Commit 151e6ab

Browse files
committed
test: Add scheduler test for shared job names across targets
I noticed while looking at the scheduler code that this case is not appropriately handled by DVSim, so I designed a test case for it to highlight the failure, with the aim of fixing it in some future commit. Signed-off-by: Alex Jones <alex.jones@lowrisc.org>
1 parent 003b8bb commit 151e6ab

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

tests/test_scheduler.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -757,6 +757,22 @@ def test_multiple_targets(fxt: Fxt) -> None:
757757
result = Scheduler(jobs, fxt.mock_launcher).run()
758758
_assert_result_status(result, 15)
759759

760+
@staticmethod
761+
@pytest.mark.xfail(
762+
reason="DVSim currently stores job status in a per-job-name dictionary, meaning that"
763+
" job information is lost if jobs have the same name across different targets."
764+
)
765+
@pytest.mark.timeout(DEFAULT_TIMEOUT)
766+
def test_same_name_different_targets(fxt: Fxt) -> None:
767+
"""Test that jobs in different targets can have the same name."""
768+
jobs = make_many_jobs(fxt.tmp_path, 2, vary_targets=True, interdeps={1: [0]}, name="job")
769+
# Job 0 will pass whereas job 1 will fail.
770+
fxt.mock_ctx.set_config(jobs[1], MockJob(default_status=JobStatus.FAILED))
771+
result = Scheduler(jobs, fxt.mock_launcher).run()
772+
assert_that(len(result), equal_to(2))
773+
assert_that(result[0].status, equal_to(JobStatus.PASSED))
774+
assert_that(result[1].status, equal_to(JobStatus.FAILED))
775+
760776
@staticmethod
761777
@pytest.mark.timeout(DEFAULT_TIMEOUT)
762778
@pytest.mark.parametrize("num_deps", range(2, 6))

0 commit comments

Comments
 (0)