From: Kefu Chai Date: Mon, 30 Jul 2018 13:29:03 +0000 (+0800) Subject: test: use death_test_style="threadsafe" for Mutex.NormalAsserts X-Git-Tag: v14.0.1~689^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1739d6b77796026d0e3e7cf49aa90e1728e622cc;p=ceph.git 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 --- diff --git a/src/test/common/test_mutex.cc b/src/test/common/test_mutex.cc index a4b496103e7c..ed987e0d9ae0 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) {