From a90329aef45ecc4c4b025b867d43e7764fb842d6 Mon Sep 17 00:00:00 2001 From: Tommi Virtanen Date: Fri, 14 Jan 2011 15:41:28 -0800 Subject: [PATCH] Revert "unit tests: do standard ceph init before tests" This reverts commit 77f90978dc38d025e05300f7650a550ae15704fa. Unit tests should not parse the normal "-c ceph.conf" command line arguments, they should not read config files, etc. If something needs initializing for a specific unit tests, we'll either fix it to not need it, initialize it just for that, or figure some nicer way of doing this. The commit also broke "make distcheck". --- src/common/common_init.cc | 36 +++++++++--------------------------- src/common/common_init.h | 1 - src/test/base64.cc | 2 -- src/test/encoding.cc | 2 -- src/test/unit_test_main.h | 32 -------------------------------- 5 files changed, 9 insertions(+), 64 deletions(-) delete mode 100644 src/test/unit_test_main.h diff --git a/src/common/common_init.cc b/src/common/common_init.cc index 7fc6a917e8d7c..71455089baf0f 100644 --- a/src/common/common_init.cc +++ b/src/common/common_init.cc @@ -19,7 +19,14 @@ #include "include/color.h" #include "tls.h" -static void set_no_logging_impl() +/* Set foreground logging + * + * Forces the process to log only to stderr, overriding whatever was in the ceph.conf. + * + * TODO: make this configurable by a command line switch or environment variable, if users want + * an unusual logging setup for their foreground process. + */ +void set_foreground_logging() { free((void*)g_conf.log_file); g_conf.log_file = NULL; @@ -32,38 +39,13 @@ static void set_no_logging_impl() g_conf.log_sym_history = 0; - g_conf.log_to_stderr = LOG_TO_STDERR_NONE; + g_conf.log_to_stderr = LOG_TO_STDERR_ALL; g_conf.log_to_syslog = false; g_conf.log_per_instance = false; g_conf.log_to_file = false; -} - -/* Set no logging - */ -void set_no_logging() -{ - set_no_logging_impl(); - - if (_dout_need_open) { - Mutex::Locker l(_dout_lock); - _dout_open_log(false); - } -} - -/* Set foreground logging - * - * Forces the process to log only to stderr, overriding whatever was in the ceph.conf. - * - * TODO: make this configurable by a command line switch or environment variable, if users want - * an unusual logging setup for their foreground process. - */ -void set_foreground_logging() -{ - set_no_logging_impl(); - g_conf.log_to_stderr = LOG_TO_STDERR_ALL; if (_dout_need_open) { Mutex::Locker l(_dout_lock); diff --git a/src/common/common_init.h b/src/common/common_init.h index 772ca832f8241..bcffc8ddf2755 100644 --- a/src/common/common_init.h +++ b/src/common/common_init.h @@ -7,7 +7,6 @@ void common_set_defaults(bool daemon); void common_init(std::vector& args, const char *module_type, bool init_keys); -void set_no_logging(); void set_foreground_logging(); #endif diff --git a/src/test/base64.cc b/src/test/base64.cc index 17f34024a40af..dc091221eb344 100644 --- a/src/test/base64.cc +++ b/src/test/base64.cc @@ -59,5 +59,3 @@ TEST(IncorrectBase64Decoding2, StringSimple) { } ASSERT_EQ(failed, true); } - -#include diff --git a/src/test/encoding.cc b/src/test/encoding.cc index 730cb50611f1a..9ea1c84a4824d 100644 --- a/src/test/encoding.cc +++ b/src/test/encoding.cc @@ -196,5 +196,3 @@ TEST(EncodingRoundTrip, MultimapConstructorCounter) { EXPECT_EQ(my_val_t::get_copy_ctor(), 10); EXPECT_EQ(my_val_t::get_assigns(), 0); } - -#include diff --git a/src/test/unit_test_main.h b/src/test/unit_test_main.h deleted file mode 100644 index 86c4230cb4591..0000000000000 --- a/src/test/unit_test_main.h +++ /dev/null @@ -1,32 +0,0 @@ -// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- -// vim: ts=8 sw=2 smarttab -/* - * Ceph - scalable distributed file system - * - * Copyright (C) 2011 Dreamhost - * - * This is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software - * Foundation. See file COPYING. - * - */ - -#include "common/common_init.h" - -#include "gtest/gtest.h" - -/* The main function for Ceph unit tests */ -int main(int argc, char **argv) -{ - ::testing::InitGoogleTest(&argc, argv); - - vector args; - argv_to_vec(argc, const_cast(argv), args); - env_to_vec(args); - common_set_defaults(false); - common_init(args, argv[0], false); - set_no_logging(); - - return RUN_ALL_TESTS(); -} -- 2.39.5