]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test: use death_test_style="threadsafe" for Mutex.NormalAsserts 23320/head
authorKefu Chai <kchai@redhat.com>
Mon, 30 Jul 2018 13:29:03 +0000 (21:29 +0800)
committerKefu Chai <kchai@redhat.com>
Fri, 3 Aug 2018 02:02:34 +0000 (10:02 +0800)
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 <kchai@redhat.com>
src/test/common/test_mutex.cc

index a4b496103e7cc85dc3850b1f30439de64166b250..ed987e0d9ae09b5ae8b1e45cf54853cf8a8da97c 100644 (file)
 #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) {