unittest_formatter_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS}
check_PROGRAMS += unittest_formatter
-unittest_config_SOURCES = test/config.cc
-unittest_config_LDFLAGS = -pthread ${AM_LDFLAGS}
-unittest_config_LDADD = librados.la ${UNITTEST_LDADD}
-unittest_config_CXXFLAGS = ${CRYPTO_CFLAGS} ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS}
-check_PROGRAMS += unittest_config
+unittest_libceph_config_SOURCES = test/libceph_config.cc
+unittest_libceph_config_LDFLAGS = -pthread ${AM_LDFLAGS}
+unittest_libceph_config_LDADD = libceph.la ${UNITTEST_LDADD}
+unittest_libceph_config_CXXFLAGS = ${CRYPTO_CFLAGS} ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS}
+check_PROGRAMS += unittest_libceph_config
+
+unittest_librados_config_SOURCES = test/librados_config.cc
+unittest_librados_config_LDFLAGS = -pthread ${AM_LDFLAGS}
+unittest_librados_config_LDADD = librados.la ${UNITTEST_LDADD}
+unittest_librados_config_CXXFLAGS = ${CRYPTO_CFLAGS} ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS}
+check_PROGRAMS += unittest_librados_config
+
+unittest_daemon_config_SOURCES = test/daemon_config.cc
+unittest_daemon_config_LDFLAGS = -pthread ${AM_LDFLAGS}
+unittest_daemon_config_LDADD = ${UNITTEST_LDADD} ${LIBGLOBAL_LDA}
+unittest_daemon_config_CXXFLAGS = ${CRYPTO_CFLAGS} ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS}
+check_PROGRAMS += unittest_daemon_config
if WITH_RADOSGW
unittest_librgw_SOURCES = test/librgw.cc
+++ /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 New Dream Network
- *
- * 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 "gtest/gtest.h"
-#include "include/rados/librados.h"
-
-#include <sstream>
-#include <string>
-#include <string.h>
-
-using std::string;
-
-TEST(RadosConfig, SimpleSet) {
- rados_t cl;
- int ret = rados_create(&cl, NULL);
- ASSERT_EQ(ret, 0);
-
- ret = rados_conf_set(cl, "debug", "21");
- ASSERT_EQ(ret, 0);
-
- char buf[128];
- memset(buf, 0, sizeof(buf));
- ret = rados_conf_get(cl, "debug", buf, sizeof(buf));
- ASSERT_EQ(ret, 0);
- ASSERT_EQ(string("21"), string(buf));
-
- rados_shutdown(cl);
-}
-
-TEST(RadosConfig, ArgV) {
- rados_t cl;
- int ret = rados_create(&cl, NULL);
- ASSERT_EQ(ret, 0);
-
- const char *argv[] = { "foo", "--debug", "2",
- "--keyfile", "/tmp/my-keyfile", NULL };
- size_t argc = (sizeof(argv) / sizeof(argv[0])) - 1;
- rados_conf_parse_argv(cl, argc, argv);
-
- char buf[128];
- memset(buf, 0, sizeof(buf));
- ret = rados_conf_get(cl, "keyfile", buf, sizeof(buf));
- ASSERT_EQ(ret, 0);
- ASSERT_EQ(string("/tmp/my-keyfile"), string(buf));
-
- memset(buf, 0, sizeof(buf));
- ret = rados_conf_get(cl, "debug", buf, sizeof(buf));
- ASSERT_EQ(ret, 0);
- ASSERT_EQ(string("2"), string(buf));
-
- rados_shutdown(cl);
-}
--- /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 New Dream Network
+ *
+ * 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/ceph_argparse.h"
+#include "common/config.h"
+#include "include/ceph/libceph.h"
+#include "include/rados/librados.h"
+#include "test/unit.h"
+
+#include <sstream>
+#include <string>
+#include <string.h>
+
+using std::string;
+
+TEST(DaemonConfig, SimpleSet) {
+ int ret;
+ ret = g_ceph_context->_conf->set_val("debug", "21");
+ ASSERT_EQ(ret, 0);
+ g_ceph_context->_conf->apply_changes(NULL);
+ char buf[128];
+ memset(buf, 0, sizeof(buf));
+ char *tmp = buf;
+ ret = g_ceph_context->_conf->get_val("debug", &tmp, sizeof(buf));
+ ASSERT_EQ(ret, 0);
+ ASSERT_EQ(string("21"), string(buf));
+}
+
+TEST(DaemonConfig, ArgV) {
+ int ret;
+ const char *argv[] = { "foo", "--debug", "22",
+ "--keyfile", "/tmp/my-keyfile", NULL };
+ size_t argc = (sizeof(argv) / sizeof(argv[0])) - 1;
+ vector<const char*> args;
+ argv_to_vec(argc, argv, args);
+ g_ceph_context->_conf->parse_argv(args);
+ g_ceph_context->_conf->apply_changes(NULL);
+
+ char buf[128];
+ char *tmp = buf;
+ memset(buf, 0, sizeof(buf));
+ ret = g_ceph_context->_conf->get_val("keyfile", &tmp, sizeof(buf));
+ ASSERT_EQ(ret, 0);
+ ASSERT_EQ(string("/tmp/my-keyfile"), string(buf));
+
+ memset(buf, 0, sizeof(buf));
+ ret = g_ceph_context->_conf->get_val("debug", &tmp, sizeof(buf));
+ ASSERT_EQ(ret, 0);
+ ASSERT_EQ(string("22"), string(buf));
+}
--- /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 New Dream Network
+ *
+ * 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 "gtest/gtest.h"
+#include "include/ceph/libceph.h"
+
+#include <sstream>
+#include <string>
+#include <string.h>
+
+using std::string;
+
+TEST(LibCephConfig, SimpleSet) {
+ struct ceph_mount_info *cmount;
+ int ret = ceph_create(&cmount, NULL);
+ ASSERT_EQ(ret, 0);
+
+ ret = ceph_conf_set(cmount, "debug", "21");
+ ASSERT_EQ(ret, 0);
+
+ char buf[128];
+ memset(buf, 0, sizeof(buf));
+ ret = ceph_conf_get(cmount, "debug", buf, sizeof(buf));
+ ASSERT_EQ(ret, 0);
+ ASSERT_EQ(string("21"), string(buf));
+
+ ceph_shutdown(cmount);
+}
+
+TEST(LibCephConfig, ArgV) {
+ struct ceph_mount_info *cmount;
+ int ret = ceph_create(&cmount, NULL);
+ ASSERT_EQ(ret, 0);
+
+ const char *argv[] = { "foo", "--debug", "2",
+ "--keyfile", "/tmp/my-keyfile", NULL };
+ size_t argc = (sizeof(argv) / sizeof(argv[0])) - 1;
+ ceph_conf_parse_argv(cmount, argc, argv);
+
+ char buf[128];
+ memset(buf, 0, sizeof(buf));
+ ret = ceph_conf_get(cmount, "keyfile", buf, sizeof(buf));
+ ASSERT_EQ(ret, 0);
+ ASSERT_EQ(string("/tmp/my-keyfile"), string(buf));
+
+ memset(buf, 0, sizeof(buf));
+ ret = ceph_conf_get(cmount, "debug", buf, sizeof(buf));
+ ASSERT_EQ(ret, 0);
+ ASSERT_EQ(string("2"), string(buf));
+
+ ceph_shutdown(cmount);
+}
--- /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 New Dream Network
+ *
+ * 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 "gtest/gtest.h"
+#include "include/rados/librados.h"
+
+#include <sstream>
+#include <string>
+#include <string.h>
+
+using std::string;
+
+TEST(LibRadosConfig, SimpleSet) {
+ rados_t cl;
+ int ret = rados_create(&cl, NULL);
+ ASSERT_EQ(ret, 0);
+
+ ret = rados_conf_set(cl, "debug", "21");
+ ASSERT_EQ(ret, 0);
+
+ char buf[128];
+ memset(buf, 0, sizeof(buf));
+ ret = rados_conf_get(cl, "debug", buf, sizeof(buf));
+ ASSERT_EQ(ret, 0);
+ ASSERT_EQ(string("21"), string(buf));
+
+ rados_shutdown(cl);
+}
+
+TEST(LibRadosConfig, ArgV) {
+ rados_t cl;
+ int ret = rados_create(&cl, NULL);
+ ASSERT_EQ(ret, 0);
+
+ const char *argv[] = { "foo", "--debug", "2",
+ "--keyfile", "/tmp/my-keyfile", NULL };
+ size_t argc = (sizeof(argv) / sizeof(argv[0])) - 1;
+ rados_conf_parse_argv(cl, argc, argv);
+
+ char buf[128];
+ memset(buf, 0, sizeof(buf));
+ ret = rados_conf_get(cl, "keyfile", buf, sizeof(buf));
+ ASSERT_EQ(ret, 0);
+ ASSERT_EQ(string("/tmp/my-keyfile"), string(buf));
+
+ memset(buf, 0, sizeof(buf));
+ ret = rados_conf_get(cl, "debug", buf, sizeof(buf));
+ ASSERT_EQ(ret, 0);
+ ASSERT_EQ(string("2"), string(buf));
+
+ rados_shutdown(cl);
+}