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".
#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;
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);
void common_init(std::vector<const char*>& args,
const char *module_type,
bool init_keys);
-void set_no_logging();
void set_foreground_logging();
#endif
}
ASSERT_EQ(failed, true);
}
-
-#include <test/unit_test_main.h>
EXPECT_EQ(my_val_t::get_copy_ctor(), 10);
EXPECT_EQ(my_val_t::get_assigns(), 0);
}
-
-#include <test/unit_test_main.h>
+++ /dev/null
-// -*- 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();
-}