]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
test/objectstore: set "threadsafe" flag for ASSERT_DEATH tests
authorKefu Chai <kchai@redhat.com>
Tue, 24 Mar 2020 12:12:36 +0000 (20:12 +0800)
committerKefu Chai <kchai@redhat.com>
Tue, 24 Mar 2020 12:16:10 +0000 (20:16 +0800)
we are seeing failures like

192/192 Test #144: unittest_chain_xattr ....................***Timeout 3600.01 sec
[==========] Running 5 tests from 1 test suite.
[----------] Global test environment set-up.
[----------] 5 tests from chain_xattr
[ RUN      ] chain_xattr.get_and_set

[WARNING] /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest-death-test.cc:1122:: Death tests use fork(), which is unsafe particularly in a threaded context.
For this test, Google Test detected 3 threads. See https://github.com/google/googletest/blob/master/googletest/docs/advanced.md#death-tests-and-threads for more explanation and suggested solutions,
especially if this is the last message you see before your test times out.

so in this change, the "threadsafe" death test style is used for
testing the expected assertion failures.

see also
https://github.com/google/googletest/blob/master/googletest/docs/advanced.md#death-test-styles

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/test/objectstore/chain_xattr.cc

index a928464af74738fe5ecd729ffc4f2d2a29ac16bd..27c6bbb2f6d5322c2233e3b2eb856913e0d80707 100644 (file)
@@ -122,8 +122,10 @@ TEST(chain_xattr, get_and_set) {
     int x;
     const string name = user + string(CHAIN_XATTR_MAX_NAME_LEN * 2, '@');
     PrCtl unset_dumpable;
+    ::testing::FLAGS_gtest_death_test_style = "threadsafe";
     ASSERT_DEATH(chain_setxattr(file, name.c_str(), &x, sizeof(x)), "");
     ASSERT_DEATH(chain_fsetxattr(fd, name.c_str(), &x, sizeof(x)), "");
+    ::testing::FLAGS_gtest_death_test_style = "fast";
   }
 
   {