Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i#5733, i#5734: Minor fixes in tests #5796

Merged
merged 5 commits into from
Dec 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions clients/drcachesim/common/memtrace_stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,25 @@ class memtrace_stream_t {
/**
* Implementation of memtrace_stream_t useful for mocks in tests.
*/
class test_memtrace_stream_t : public memtrace_stream_t {
class default_memtrace_stream_t : public memtrace_stream_t {
public:
virtual ~test_memtrace_stream_t()
default_memtrace_stream_t()
: record_ordinal_(nullptr)
{
}
default_memtrace_stream_t(uint64_t *record_ordinal)
: record_ordinal_(record_ordinal)
{
}
virtual ~default_memtrace_stream_t()
{
}
uint64_t
get_record_ordinal() const override
{
return 0;
if (record_ordinal_ == nullptr)
return 0;
return *record_ordinal_;
}
uint64_t
get_instruction_ordinal() const override
Expand Down Expand Up @@ -178,5 +188,8 @@ class test_memtrace_stream_t : public memtrace_stream_t {
{
return 0;
}

private:
uint64_t *record_ordinal_;
};
#endif /* _MEMTRACE_STREAM_H_ */
2 changes: 1 addition & 1 deletion clients/drcachesim/tests/record_filter_unit_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class test_record_filter_t : public dynamorio::drmemtrace::record_filter_t {
std::vector<trace_entry_t> output;
};

class local_stream_t : public test_memtrace_stream_t {
class local_stream_t : public default_memtrace_stream_t {
public:
uint64_t
get_last_timestamp() const override
Expand Down
2 changes: 1 addition & 1 deletion clients/drcachesim/tests/view_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class view_nomod_test_t : public view_t {
std::string
run_test_helper(view_t &view, const std::vector<memref_t> &memrefs)
{
class local_stream_t : public test_memtrace_stream_t {
class local_stream_t : public default_memtrace_stream_t {
public:
local_stream_t(view_t &view, const std::vector<memref_t> &memrefs)
: view_(view)
Expand Down
4 changes: 4 additions & 0 deletions clients/drcachesim/tools/invariant_checker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,10 @@ invariant_checker_t::check_schedule_data()
// Check that the scheduling data in the files written by raw2trace match
// the data in the trace.
per_shard_t global;
// Use a synthetic stream object to allow report_if_false to work normally.
auto stream = std::unique_ptr<memtrace_stream_t>(
new default_memtrace_stream_t(&global.ref_count_));
global.stream = stream.get();
std::vector<schedule_entry_t> serial;
std::unordered_map<uint64_t, std::vector<schedule_entry_t>> cpu2sched;
for (auto &shard_keyval : shard_map_) {
Expand Down
3 changes: 2 additions & 1 deletion suite/tests/linux/rseq.c
Original file line number Diff line number Diff line change
Expand Up @@ -1037,7 +1037,8 @@ main()
if (register_rseq()) {
#ifdef RSEQ_TEST_ATTACH
/* Set -offline to avoid trying to open a pipe to a missing reader. */
if (setenv("DYNAMORIO_OPTIONS", "-stderr_mask 0xc -client_lib ';;-offline'",
if (setenv("DYNAMORIO_OPTIONS",
"-stderr_mask 0xc -client_lib ';;-offline -max_trace_size 256K'",
1 /*override*/) != 0)
return 1;
/* Create a thread that sits in the rseq region, to test attaching and detaching
Expand Down