Skip to content

Commit

Permalink
i#7157 dyn inject: Fix switch trace injection test (#7276)
Browse files Browse the repository at this point in the history
Fixes the existing scheduler unit test that verifies kernel context
switch template injection.

The res bool was unused, therefore a failure to match expectations was
never reported. The expected timestamps inside the injected part of the
trace should be the ones updated by the scheduler, not the original one
in the trace template.

Issue: #7157
  • Loading branch information
abhinav92003 authored Feb 14, 2025
1 parent a09c4c9 commit d11ec3f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions clients/drcachesim/tests/scheduler_unit_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5957,7 +5957,8 @@ test_kernel_switch_sequences()
check_ref(refs[0], idx, TID_BASE + 2, TRACE_TYPE_MARKER,
TRACE_MARKER_TYPE_CONTEXT_SWITCH_START, scheduler_t::SWITCH_THREAD) &&
check_ref(refs[0], idx, TID_BASE + 2, TRACE_TYPE_MARKER,
TRACE_MARKER_TYPE_TIMESTAMP, THREAD_SWITCH_TIMESTAMP) &&
// Verify that the timestamp is updated.
TRACE_MARKER_TYPE_TIMESTAMP, TIMESTAMP) &&
check_ref(refs[0], idx, TID_BASE + 2, TRACE_TYPE_INSTR) &&
check_ref(refs[0], idx, TID_BASE + 2, TRACE_TYPE_INSTR) &&
check_ref(refs[0], idx, TID_BASE + 2, TRACE_TYPE_MARKER,
Expand All @@ -5975,7 +5976,8 @@ test_kernel_switch_sequences()
check_ref(refs[0], idx, TID_BASE + 4, TRACE_TYPE_MARKER,
TRACE_MARKER_TYPE_CONTEXT_SWITCH_START, scheduler_t::SWITCH_PROCESS) &&
check_ref(refs[0], idx, TID_BASE + 4, TRACE_TYPE_MARKER,
TRACE_MARKER_TYPE_TIMESTAMP, PROCESS_SWITCH_TIMESTAMP) &&
// Verify that the timestamp is updated.
TRACE_MARKER_TYPE_TIMESTAMP, TIMESTAMP) &&
check_ref(refs[0], idx, TID_BASE + 4, TRACE_TYPE_INSTR) &&
check_ref(refs[0], idx, TID_BASE + 4, TRACE_TYPE_INSTR) &&
check_ref(refs[0], idx, TID_BASE + 4, TRACE_TYPE_MARKER,
Expand All @@ -5989,6 +5991,7 @@ test_kernel_switch_sequences()
check_ref(refs[0], idx, TID_BASE + 4, TRACE_TYPE_INSTR) &&
check_ref(refs[0], idx, TID_BASE + 4, TRACE_TYPE_INSTR) &&
check_ref(refs[0], idx, TID_BASE + 4, TRACE_TYPE_INSTR);
assert(res);

{
// Test a bad input sequence.
Expand Down

0 comments on commit d11ec3f

Please sign in to comment.