From 373f587f0fceaa4aab994172a98459b670fcf79b Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Tue, 24 Mar 2020 20:12:36 +0800 Subject: [PATCH] test/objectstore: set "threadsafe" flag for ASSERT_DEATH tests 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 --- src/test/objectstore/chain_xattr.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/test/objectstore/chain_xattr.cc b/src/test/objectstore/chain_xattr.cc index a928464af74..27c6bbb2f6d 100644 --- a/src/test/objectstore/chain_xattr.cc +++ b/src/test/objectstore/chain_xattr.cc @@ -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"; } {