From: Kefu Chai Date: Tue, 24 Mar 2020 12:12:36 +0000 (+0800) Subject: test/objectstore: set "threadsafe" flag for ASSERT_DEATH tests X-Git-Tag: v16.1.0~2771^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=373f587f0fceaa4aab994172a98459b670fcf79b;p=ceph.git 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 --- diff --git a/src/test/objectstore/chain_xattr.cc b/src/test/objectstore/chain_xattr.cc index a928464af747..27c6bbb2f6d5 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"; } {