From 62a30a3c57bfd9ec5209eb59c48aa88ee0cf11c4 Mon Sep 17 00:00:00 2001 From: Yaming Kuang Date: Tue, 26 Sep 2023 19:58:53 -0700 Subject: [PATCH] better logging assert message --- src/tests/test_blk_read_tracker.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/tests/test_blk_read_tracker.cpp b/src/tests/test_blk_read_tracker.cpp index 01eecb58f..9e5d981e0 100644 --- a/src/tests/test_blk_read_tracker.cpp +++ b/src/tests/test_blk_read_tracker.cpp @@ -403,7 +403,7 @@ TEST_F(BlkReadTrackerTest, TestThreadedInsertWaitonThenRemove) { std::thread t([this, &bids, i, &mtx, &called]() { get_inst()->wait_on(bids[i], [i, &bids, &mtx, &called]() { std::unique_lock lk(mtx); - assert(!called[i]); // callback shouldn't be called more than once; + LOGMSG_ASSERT(called[i] == false, "not expecting callback to be called more than once!"); called[i] = true; LOGINFO("wait_on called on blkid: {};", bids[i].to_string()); }); @@ -427,8 +427,8 @@ TEST_F(BlkReadTrackerTest, TestThreadedInsertWaitonThenRemove) { LOGINFO("Step 4: all threads joined."); - for (const auto x : called) { - assert(x); // all callbacks should be called; + for (auto i = 0ul; i < called.size(); ++i) { + LOGMSG_ASSERT(called[i] == true, "expecting all waiters to be called"); } LOGINFO("Step 5: all bids wait_on cb called.");