From 626222c698b1f76096e3a9aeb4f6f908dd21110f Mon Sep 17 00:00:00 2001 From: Megvii Engine Team Date: Wed, 3 Aug 2022 13:50:31 +0800 Subject: [PATCH] fix(test): fix test for brainpp docker env GitOrigin-RevId: c4c2cc73d2b9c97f0e86f1a4333ec35b2a89d1f9 --- src/core/test/comp_node.cpp | 5 +++-- src/core/test/utils/async_worker.cpp | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/core/test/comp_node.cpp b/src/core/test/comp_node.cpp index 38ec36fd4..e36d1fdeb 100644 --- a/src/core/test/comp_node.cpp +++ b/src/core/test/comp_node.cpp @@ -563,10 +563,11 @@ TEST(TestCompNodeSyncManager, DeviceWait) { cn2.device_wait_event(mgr.busy_wait_set_ready_and_get_event()); ev_cn1->record(); ev_cn2_end->record(); - EXPECT_LE(timer.get_secs(), 0.06); + std::this_thread::yield(); + EXPECT_LE(timer.get_secs(), 0.09); ev_cn1->host_wait(); - EXPECT_GE(timer.get_secs(), 0.1); + EXPECT_GE(timer.get_secs(), 0.12); ev_cn2_end->host_wait(); auto ev2_t = ev_cn2_begin->elapsed_time_until(*ev_cn2_end); EXPECT_GE(ev2_t, 0.1); diff --git a/src/core/test/utils/async_worker.cpp b/src/core/test/utils/async_worker.cpp index 7fb6eac78..5b31735e4 100644 --- a/src/core/test/utils/async_worker.cpp +++ b/src/core/test/utils/async_worker.cpp @@ -87,8 +87,8 @@ TEST(TestAsyncWorker, AsyncWorkerSetException) { std::this_thread::sleep_for(100ms); }); - timer.reset(); worker_set.start(); + timer.reset(); ASSERT_THROW(worker_set.wait_all(), std::runtime_error); ASSERT_LT(timer.get_msecs(), 100); } -- GitLab