]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Revert "unit tests: do standard ceph init before tests"
authorTommi Virtanen <tv@hq.newdream.net>
Fri, 14 Jan 2011 23:41:28 +0000 (15:41 -0800)
committerTommi Virtanen <tv@hq.newdream.net>
Sat, 15 Jan 2011 00:27:24 +0000 (16:27 -0800)
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
src/common/common_init.h
src/test/base64.cc
src/test/encoding.cc
src/test/unit_test_main.h [deleted file]

index 7fc6a917e8d7c8791f7360eb51a2616580d365da..71455089baf0f2390932edb45f7e2beb5f13708d 100644 (file)
 #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);
index 772ca832f82416b5a6297845a8b13f26a390ff12..bcffc8ddf275500b0ad7e150b70a761de405d20c 100644 (file)
@@ -7,7 +7,6 @@ void common_set_defaults(bool daemon);
 void common_init(std::vector<const char*>& args,
                 const char *module_type,
                  bool init_keys);
-void set_no_logging();
 void set_foreground_logging();
 
 #endif
index 17f34024a40af1c69944dbb41ad5be8e0efd833d..dc091221eb344d5d9e17edf2bb461edffa462415 100644 (file)
@@ -59,5 +59,3 @@ TEST(IncorrectBase64Decoding2, StringSimple) {
   }
   ASSERT_EQ(failed, true);
 }
-
-#include <test/unit_test_main.h>
index 730cb50611f1a73679bf7d868c88fb14968ee78d..9ea1c84a4824d6310266b1d6ca704406e19900f6 100644 (file)
@@ -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 <test/unit_test_main.h>
diff --git a/src/test/unit_test_main.h b/src/test/unit_test_main.h
deleted file mode 100644 (file)
index 86c4230..0000000
+++ /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<const char*> args;
-  argv_to_vec(argc, const_cast<const char**>(argv), args);
-  env_to_vec(args);
-  common_set_defaults(false);
-  common_init(args, argv[0], false);
-  set_no_logging();
-
-  return RUN_ALL_TESTS();
-}