Skip to content

Commit

Permalink
i#6354 test: Verify one CPU ID per stream with MAP_TO_RECORDED
Browse files Browse the repository at this point in the history
Added check to verify that output stream's CPU ID matches the CPU ID
markers seen in the trace.

Issue: #6354
  • Loading branch information
prasun3 committed Oct 10, 2023
1 parent 54f393b commit 2416231
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 0 deletions.
7 changes: 7 additions & 0 deletions clients/drcachesim/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,13 @@ if (X86 AND X64 AND ZIP_FOUND)
add_test(NAME tool.scheduler_launcher
COMMAND scheduler_launcher -trace_dir ${trace_dir})
set_tests_properties(tool.scheduler_launcher PROPERTIES TIMEOUT ${test_seconds})

set(trace_dir_2
"${PROJECT_SOURCE_DIR}/clients/drcachesim/tests/drmemtrace.schedtest.x64")
add_test(NAME tool.scheduler_launcher_map_to_rec
COMMAND scheduler_launcher -trace_dir ${trace_dir_2} -cpu_schedule_file
${trace_dir_2}/cpu_schedule.bin.zip)
set_tests_properties(tool.scheduler_launcher_map_to_rec PROPERTIES TIMEOUT ${test_seconds})
endif ()

# We have a companion test built using a separate --build-and-test CMake project in
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
13 changes: 13 additions & 0 deletions clients/drcachesim/tests/scheduler_launcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,19 @@ simulate_core(int ordinal, scheduler_t::stream_t *stream, const scheduler_t &sch
thread_sequence += 'A' + static_cast<char>(input % 26);
cur_segment_instrs = 0;
}
} else if (record.marker.type == dynamorio::drmemtrace::TRACE_TYPE_MARKER) {
if (record.marker.marker_type ==
dynamorio::drmemtrace::TRACE_MARKER_TYPE_CPU_ID) {
if (!op_cpu_schedule_file.get_value().empty()) {
int cpu = (int)record.marker.marker_value;
int output_cpuid = stream->get_output_cpuid();
if (cpu != output_cpuid) {
FATAL_ERROR(
"CPU marker differs from output stream CPU ID: %d != %d\n",
cpu, output_cpuid);
}
}
}
}
}
}
Expand Down

0 comments on commit 2416231

Please sign in to comment.