From 1739d6b77796026d0e3e7cf49aa90e1728e622cc Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Mon, 30 Jul 2018 21:29:03 +0800 Subject: [PATCH] test: use death_test_style="threadsafe" for Mutex.NormalAsserts use threadsafe for running the Mutex assert test to run the test from beginning to avoid the hang. this test overrides the symbol of ceph::__ceph_assert_fail() with a local one offered by the application links against libceph-common. but we intentionally forbid this behavior: we do not allow libceph-common to reference the symbols exposed from application with the same name. see http://tracker.ceph.com/issues/25154 Signed-off-by: Kefu Chai --- src/test/common/test_mutex.cc | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/test/common/test_mutex.cc b/src/test/common/test_mutex.cc index a4b496103e7cc..ed987e0d9ae09 100644 --- a/src/test/common/test_mutex.cc +++ b/src/test/common/test_mutex.cc @@ -11,19 +11,6 @@ #include "common/config.h" #include "include/coredumpctl.h" -/* - * Override normal ceph assert. - * It is needed to prevent hang when we assert() and THEN still wait on lock(). - */ -namespace ceph -{ - void __ceph_assert_fail(const char *assertion, const char *file, int line, - const char *func) - { - throw 0; - } -} - static CephContext* cct; static void do_init() { @@ -44,7 +31,8 @@ static void disable_lockdep() { TEST(Mutex, NormalAsserts) { Mutex* m = new Mutex("Normal",false); m->Lock(); - EXPECT_THROW(m->Lock(), int); + testing::GTEST_FLAG(death_test_style) = "threadsafe"; + EXPECT_DEATH(m->Lock(), ".*"); } TEST(Mutex, RecursiveWithLockdep) { -- 2.39.5