Skip to content

Commit

Permalink
print logs upon Many_ConcurrentReaders test failure (#6781)
Browse files Browse the repository at this point in the history
  • Loading branch information
ironage authored and nicola-cab committed Jul 12, 2023
1 parent e5cbfa4 commit 69686d6
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions test/test_shared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1392,18 +1392,28 @@ TEST(Many_ConcurrentReaders)
sg_w->close();

auto reader = [path_str]() {
std::stringstream logs;
try {
auto logger = util::StreamLogger(logs);
DBOptions options;
options.logger = std::make_shared<util::StreamLogger>(logs);
options.logger->set_level_threshold(Logger::Level::all);
constexpr bool no_create = false;
for (int i = 0; i < 1000; ++i) {
DBRef sg_r = DB::create(path_str);
DBRef sg_r = DB::create(path_str, no_create, options);
ReadTransaction rt(sg_r);
ConstTableRef t = rt.get_table("table");
auto col_key = t->get_column_key("column");
REALM_ASSERT(t->get_object(0).get<StringData>(col_key) == "string");
rt.get_group().verify();
}
}
catch (...) {
REALM_ASSERT(false);
catch (const std::exception& e) {
std::cerr << "Exception during Many_ConcurrentReaders:" << std::endl;
std::cerr << "Reason: '" << e.what() << "'" << std::endl;
std::cerr << logs.str();
constexpr bool unexpected_exception = false;
REALM_ASSERT_EX(unexpected_exception, e.what());
}
};

Expand Down

0 comments on commit 69686d6

Please sign in to comment.