diff --git a/CMakeLists.txt b/CMakeLists.txt index 5e042ba95..0d71234e3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -70,6 +70,10 @@ add_library( set(UBSAN_BLACKLIST ${PROJECT_SOURCE_DIR}/scripts/ubsan.blacklist) +if (MLN_WITH_SANITIZER) + message(STATUS "MLN_WITH_SANITIZER is enabled, using \"${MLN_WITH_SANITIZER}\" sanitizer") +endif() + target_compile_options( mbgl-compiler-options INTERFACE diff --git a/test/storage/main_resource_loader.test.cpp b/test/storage/main_resource_loader.test.cpp index 383320f87..dc7257109 100644 --- a/test/storage/main_resource_loader.test.cpp +++ b/test/storage/main_resource_loader.test.cpp @@ -69,7 +69,7 @@ TEST(MainResourceLoader, TEST_REQUIRES_SERVER(VolatileStoragePolicy)) { // Volatile resources are not stored in cache, // so we always get new data from the server ("Response N+1"). - req = fs.request(resource, [&](Response res2) { + req = fs.request(resource, [&, firstData](Response res2) { req.reset(); EXPECT_EQ(nullptr, res2.error); ASSERT_TRUE(res2.data); diff --git a/test/util/thread.test.cpp b/test/util/thread.test.cpp index 795ca8d92..fd5cee7ee 100644 --- a/test/util/thread.test.cpp +++ b/test/util/thread.test.cpp @@ -366,18 +366,21 @@ TEST(Thread, PoolWaitAdd) { auto seq = Scheduler::GetSequenced(); // add new tasks every few milliseconds - std::atomic addActive{true}; - std::atomic added{0}; - std::atomic executed{0}; - seq->schedule([&] { - while (addActive) { - pool->schedule([&] { executed++; }); - added++; + struct State { + std::atomic addActive{true}; + std::atomic added{0}; + std::atomic executed{0}; + }; + auto state = std::make_shared(); + seq->schedule([pool, state] { + while (state->addActive) { + pool->schedule([state] { state->executed++; }); + state->added++; } }); // Wait be sure some are added - while (added < 1) { + while (state->added < 1) { std::this_thread::sleep_for(Milliseconds(10)); } @@ -387,8 +390,10 @@ TEST(Thread, PoolWaitAdd) { pool->waitForEmpty(); - addActive = false; + state->addActive = false; pool->waitForEmpty(); + + ASSERT_GE(state->added.load(), 1); } TEST(Thread, PoolWaitException) {