Merge pull request #12318 from tchaikov/wip-18128

test/ceph_crypto: do not read ceph.conf in global_init()

Reviewed-by: Loic Dachary <ldachary@redhat.com>
This commit is contained in:
Loic Dachary 2016-12-05 14:47:59 +01:00 committed by GitHub
commit 09d2d6f76b
2 changed files with 15 additions and 1 deletions

View File

@ -751,7 +751,6 @@ target_link_libraries(unittest_perf_counters global)
# unittest_ceph_crypto
add_executable(unittest_ceph_crypto
ceph_crypto.cc
$<TARGET_OBJECTS:unit-main>
)
add_ceph_unittest(unittest_ceph_crypto ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/unittest_ceph_crypto)
target_link_libraries(unittest_ceph_crypto global)

View File

@ -1,5 +1,8 @@
#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 {
@ -138,3 +141,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<const char*> 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();
}