From 6c4826606dc81fdd847959a49454c69a958bb1d8 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Mon, 5 Dec 2016 20:23:21 +0800 Subject: [PATCH] test/ceph_crypto: do not read ceph.conf in global_init() ForkDeathTest.MD5 expect an empty output while global_init() complains if ceph.conf is missing if 0 is passed in as the `flags`. this test passes if ceph.conf is in current working directory, but jenkins does not prepare this file for this test. Fixes: http://tracker.ceph.com/issues/18128 Signed-off-by: Kefu Chai (cherry picked from commit c72a2271a8012a66d7bbccf5766a73da5bb878d6) Conflicts: src/test/ceph_crypto.cc - jewel does not have 5af29540675b674c1985ff98b28a783ed124acf6 --- src/test/ceph_crypto.cc | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/test/ceph_crypto.cc b/src/test/ceph_crypto.cc index 893f332b073f..6f166a8de7b2 100644 --- a/src/test/ceph_crypto.cc +++ b/src/test/ceph_crypto.cc @@ -1,6 +1,11 @@ #include "common/ceph_crypto.h" -#include "test/unit.h" +#include "gtest/gtest.h" +#include "common/ceph_argparse.h" +#include "common/ceph_crypto.h" +#include "common/common_init.h" +#include "global/global_init.h" +#include "global/global_context.h" class CryptoEnvironment: public ::testing::Environment { public: @@ -138,3 +143,15 @@ TEST_F(ForkDeathTest, MD5) { ASSERT_EXIT(do_simple_crypto(), ::testing::ExitedWithCode(0), "^$"); } #endif //GTEST_HAS_DEATH_TEST + +int main(int argc, char **argv) { + std::vector args(argv, argv + argc); + env_to_vec(args); + auto cct = global_init(NULL, args, + CEPH_ENTITY_TYPE_CLIENT, + CODE_ENVIRONMENT_UTILITY, + CINIT_FLAG_NO_DEFAULT_CONFIG_FILE); + common_init_finish(g_ceph_context); + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} -- 2.47.3