fix error
Some checks failed
ci/push/linux-x64-gcc/1 Pipeline failed
ci/pr/linux-aarch64-gcc/1 Pipeline failed
ci/push/linux-aarch64-gcc/1 Pipeline failed
ci/push/linux-aarch64-gcc/2 Pipeline failed
ci/pr/linux-x64-gcc/1 Pipeline failed
ci/push/linux-x64-gcc/2 Pipeline failed
ci/pr/linux-aarch64-gcc/2 Pipeline failed
ci/pr/linux-x64-gcc/2 Pipeline failed

This commit is contained in:
tqcq 2024-08-11 11:30:42 +08:00
parent b5541c581c
commit e8104ca460
2 changed files with 4 additions and 12 deletions

View File

@ -85,7 +85,6 @@ TEST_F(CondVarTest, NotifyOne_Wait) {
TEST_F(CondVarTest, NotifyOne_WaitFor) { TEST_F(CondVarTest, NotifyOne_WaitFor) {
// Wait // Wait
// constexpr auto kWaitTimeoutMs = 100; // constexpr auto kWaitTimeoutMs = 100;
auto start = ReadSteadyClock();
constexpr auto kWaitTimeout = std::chrono::milliseconds(50); constexpr auto kWaitTimeout = std::chrono::milliseconds(50);
auto WaitFor = [&] { auto WaitFor = [&] {
UniqueLock<Mutex> inner_locker(*m); UniqueLock<Mutex> inner_locker(*m);
@ -110,16 +109,9 @@ TEST_F(CondVarTest, NotifyOne_WaitFor) {
cv->NotifyOne(); cv->NotifyOne();
} }
auto now = ReadSteadyClock();
worker->join(); worker->join();
if (now - start > kWaitTimeout) { ASSERT_FALSE(is_timeout);
// timeout ASSERT_TRUE(is_set);
ASSERT_TRUE(is_timeout);
ASSERT_FALSE(is_set);
} else {
ASSERT_FALSE(is_timeout);
ASSERT_TRUE(is_set);
}
} }
// timeout // timeout

View File

@ -249,8 +249,8 @@ TEST(ScopedLock, TryLock) {
} }
TEST(ScopedLock, MultiThread) { TEST(ScopedLock, MultiThread) {
constexpr std::size_t kThreadCount = 5; constexpr std::size_t kThreadCount = 4;
constexpr std::size_t kLoopCount = 10000; constexpr std::size_t kLoopCount = 1000;
int x = 0; int x = 0;
Mutex m; Mutex m;