From e0722babba376443e039911f0285ee471e545529 Mon Sep 17 00:00:00 2001 From: Brian Aker Date: Thu, 5 Jan 2012 17:58:55 -0800 Subject: [PATCH] Fix for Clang on OSX. --- libtest/server_container.cc | 49 ++++++------------------------------- libtest/unittest.cc | 45 ++++++++++++++++++++-------------- 2 files changed, 35 insertions(+), 59 deletions(-) diff --git a/libtest/server_container.cc b/libtest/server_container.cc index 684303a2..cd23169f 100644 --- a/libtest/server_container.cc +++ b/libtest/server_container.cc @@ -175,32 +175,19 @@ bool server_startup(server_startup_st& construct, const std::string& server_type { server= build_gearmand("localhost", try_port); } - else - { - Error << "Libgearman was not found"; - } - } - else - { - Error << "No gearmand binary is available"; } } else if (server_type.compare("blobslap_worker") == 0) { - if (GEARMAND_BINARY and GEARMAND_BLOBSLAP_WORKER) + if (GEARMAND_BINARY) { - if (HAVE_LIBGEARMAN) + if (GEARMAND_BLOBSLAP_WORKER) { - server= build_blobslap_worker(try_port); + if (HAVE_LIBGEARMAN) + { + server= build_blobslap_worker(try_port); + } } - else - { - Error << "Libgearman was not found"; - } - } - else - { - Error << "No gearmand binary is available"; } } else if (server_type.compare("memcached-sasl") == 0) @@ -211,14 +198,6 @@ bool server_startup(server_startup_st& construct, const std::string& server_type { server= build_memcached_sasl("localhost", try_port, construct.username(), construct.password()); } - else - { - Error << "Libmemcached was not found"; - } - } - else - { - Error << "No memcached binary that was compiled with sasl is available"; } } else if (server_type.compare("memcached") == 0) @@ -229,19 +208,7 @@ bool server_startup(server_startup_st& construct, const std::string& server_type { server= build_memcached("localhost", try_port); } - else - { - Error << "Libmemcached was not found"; - } } - else - { - Error << "No memcached binary is available"; - } - } - else - { - Error << "Failed to start " << server_type << ", no support was found to be compiled in for it."; } if (server == NULL) @@ -253,7 +220,7 @@ bool server_startup(server_startup_st& construct, const std::string& server_type /* We will now cycle the server we have created. */ - if (not server->cycle()) + if (server->cycle() == false) { Error << "Could not start up server " << *server; delete server; @@ -270,7 +237,7 @@ bool server_startup(server_startup_st& construct, const std::string& server_type Out << "run " << server->args(options); getchar(); } - else if (not server->start()) + else if (server->start() == false) { Error << "Failed to start " << *server; delete server; diff --git a/libtest/unittest.cc b/libtest/unittest.cc index 6fb9260f..87102ddd 100644 --- a/libtest/unittest.cc +++ b/libtest/unittest.cc @@ -230,13 +230,16 @@ static test_return_t gearmand_cycle_test(void *object) server_startup_st *servers= (server_startup_st*)object; test_true(servers); - if (HAVE_LIBGEARMAN and GEARMAND_BINARY) + if (GEARMAND_BINARY) { - test_true(has_gearmand_binary()); - const char *argv[1]= { "cycle_gearmand" }; - test_true(server_startup(*servers, "gearmand", 9999, 1, argv)); - - return TEST_SUCCESS; + if (HAVE_LIBGEARMAN) + { + test_true(has_gearmand_binary()); + const char *argv[1]= { "cycle_gearmand" }; + test_true(server_startup(*servers, "gearmand", 9999, 1, argv)); + + return TEST_SUCCESS; + } } return TEST_SKIPPED; @@ -264,13 +267,16 @@ static test_return_t memcached_socket_cycle_test(void *object) server_startup_st *servers= (server_startup_st*)object; test_true(servers); - if (MEMCACHED_BINARY and HAVE_LIBMEMCACHED) + if (MEMCACHED_BINARY) { - test_true(has_memcached_binary()); - const char *argv[1]= { "cycle_memcached" }; - test_true(servers->start_socket_server("memcached", 9997, 1, argv)); - - return TEST_SUCCESS; + if (HAVE_LIBMEMCACHED) + { + test_true(has_memcached_binary()); + const char *argv[1]= { "cycle_memcached" }; + test_true(servers->start_socket_server("memcached", 9997, 1, argv)); + + return TEST_SUCCESS; + } } return TEST_SKIPPED; @@ -286,13 +292,16 @@ static test_return_t memcached_sasl_test(void *object) return TEST_SKIPPED; } - if (MEMCACHED_SASL_BINARY and HAVE_LIBMEMCACHED) + if (MEMCACHED_SASL_BINARY) { - test_true(has_memcached_sasl_binary()); - const char *argv[1]= { "cycle_memcached_sasl" }; - test_true(server_startup(*servers, "memcached-sasl", 9996, 1, argv)); - - return TEST_SUCCESS; + if (HAVE_LIBMEMCACHED) + { + test_true(has_memcached_sasl_binary()); + const char *argv[1]= { "cycle_memcached_sasl" }; + test_true(server_startup(*servers, "memcached-sasl", 9996, 1, argv)); + + return TEST_SUCCESS; + } } return TEST_SKIPPED; -- 2.30.2