File tree Expand file tree Collapse file tree 1 file changed +5
-12
lines changed
Expand file tree Collapse file tree 1 file changed +5
-12
lines changed Original file line number Diff line number Diff line change @@ -57,20 +57,13 @@ TEST(MutexDebug, Lock) {
5757 test_lock<ceph::mutex_debug>();
5858}
5959
60- TEST (MutexDebug , NotRecursive) {
60+ TEST (MutexDebugDeathTest , NotRecursive) {
6161 ceph::mutex_debug m (" foo" );
62- auto ttl = &test_try_lock<mutex_debug>;
63-
64- ASSERT_NO_THROW (m.lock ());
65- ASSERT_TRUE (m.is_locked ());
66- ASSERT_FALSE (std::async (std::launch::async, ttl, &m).get ());
67-
62+ // avoid assert during test cleanup where the mutex is locked and cannot be
63+ // pthread_mutex_destroy'd
64+ std::unique_lock locker{m};
6865 ASSERT_TRUE (m.is_locked ());
69- ASSERT_FALSE (std::async (std::launch::async, ttl, &m).get ());
70-
71- ASSERT_NO_THROW (m.unlock ());
72- ASSERT_FALSE (m.is_locked ());
73- ASSERT_TRUE (std::async (std::launch::async, ttl, &m).get ());
66+ ASSERT_DEATH (m.lock (), " FAILED ceph_assert(recursive || !is_locked_by_me())" );
7467}
7568
7669TEST (MutexRecursiveDebug, Lock) {
You can’t perform that action at this time.
0 commit comments