From 46ce3491f10a4cdd069e17c2b1cf598ba367a9f0 Mon Sep 17 00:00:00 2001 From: Brian Aker Date: Wed, 6 Jul 2011 13:26:23 -0700 Subject: [PATCH] Next pass through the framework. Also removing boost files since we don't use them (and I don't want to accidently make use of them). --- libtest/framework.cc | 5 +- libtest/framework.h | 2 +- libtest/include.am | 2 + libtest/memcached.cc | 116 ++++++++++++------------- libtest/server.cc | 51 ++++++++++- libtest/server.h | 36 ++++---- libtest/test.cc | 2 +- m4/pandora_have_libboost_date_time.m4 | 46 ---------- m4/pandora_have_libboost_filesystem.m4 | 47 ---------- m4/pandora_have_libboost_iostreams.m4 | 49 ----------- m4/pandora_have_libboost_options.m4 | 47 ---------- m4/pandora_have_libboost_regex.m4 | 54 ------------ m4/pandora_have_libboost_test.m4 | 45 ---------- m4/pandora_have_libboost_thread.m4 | 54 ------------ tests/include.am | 2 - 15 files changed, 128 insertions(+), 430 deletions(-) delete mode 100644 m4/pandora_have_libboost_date_time.m4 delete mode 100644 m4/pandora_have_libboost_filesystem.m4 delete mode 100644 m4/pandora_have_libboost_iostreams.m4 delete mode 100644 m4/pandora_have_libboost_options.m4 delete mode 100644 m4/pandora_have_libboost_regex.m4 delete mode 100644 m4/pandora_have_libboost_test.m4 delete mode 100644 m4/pandora_have_libboost_thread.m4 diff --git a/libtest/framework.cc b/libtest/framework.cc index 22a4f649..fab8a80a 100644 --- a/libtest/framework.cc +++ b/libtest/framework.cc @@ -93,11 +93,12 @@ test_return_t Framework::Item::startup(void* arg) return TEST_SUCCESS; } -void* Framework::create(test_return_t* arg) +void* Framework::create(test_return_t& arg) { + arg= TEST_SUCCESS; if (_create) { - return _creators_ptr= _create(arg); + return _creators_ptr= _create(&arg); } return NULL; diff --git a/libtest/framework.h b/libtest/framework.h index d3b82640..6cc2a5d1 100644 --- a/libtest/framework.h +++ b/libtest/framework.h @@ -19,7 +19,7 @@ struct Framework { test_callback_create_fn *_create; test_callback_fn *_destroy; - void* create(test_return_t* arg); + void* create(test_return_t& arg); /* This is called a the beginning of any collection run. */ test_callback_fn *collection_startup; diff --git a/libtest/include.am b/libtest/include.am index 0f4d910d..059ee741 100644 --- a/libtest/include.am +++ b/libtest/include.am @@ -11,6 +11,8 @@ LIBUTEST_TMP = ${abs_top_builddir}/tests/var/tmp/ +VALGRIND_COMMAND= $(LIBTOOL) --mode=execute valgrind --leak-check=yes --show-reachable=yes --track-fds=yes --malloc-fill=A5 --free-fill=DE + CLEANFILES+= \ tests/var/log/* \ tests/var/run/* \ diff --git a/libtest/memcached.cc b/libtest/memcached.cc index adaa30f6..04e69860 100644 --- a/libtest/memcached.cc +++ b/libtest/memcached.cc @@ -63,9 +63,6 @@ #include #include -#include - - #define CERR_PREFIX std::endl << __FILE__ << ":" << __LINE__ << " " #define SOCKET_FILE "/tmp/memcached.socket" @@ -73,35 +70,35 @@ static pid_t __getpid(server_st& server) { memcached_return_t rc; - pid_t pid= libmemcached_util_getpid(server.hostname, server.port(), &rc); + pid_t pid= libmemcached_util_getpid(server.hostname(), server.port(), &rc); return pid; } static bool __ping(server_st& server) { memcached_return_t rc; - bool ret= libmemcached_util_ping(server.hostname, server.port(), &rc); + bool ret= libmemcached_util_ping(server.hostname(), server.port(), &rc); return ret; } -static bool cycle_server(server_st& server) +static bool cycle_server(server_st *server) { while (1) { - if (libmemcached_util_ping(server.hostname, server.port(), NULL)) + if (libmemcached_util_ping(server->hostname(), server->port(), NULL)) { // First we try to kill it, and on fail of that we flush it. - pid_t pid= libmemcached_util_getpid(server.hostname, server.port(), NULL); + pid_t pid= libmemcached_util_getpid(server->hostname(), server->port(), NULL); if (pid > 0 and kill_pid(pid)) { - std::cerr << CERR_PREFIX << "Killed existing server," << server << " with pid:" << pid << std::endl; + std::cerr << CERR_PREFIX << "Killed existing server," << *server << " with pid:" << pid << std::endl; continue; } - else if (libmemcached_util_flush(server.hostname, server.port(), NULL)) // If we can flush it, we will just use it + else if (libmemcached_util_flush(server->hostname(), server->port(), NULL)) // If we can flush it, we will just use it { - std::cerr << CERR_PREFIX << "Found server on port " << int(server.port()) << ", flushed it!" << std::endl; - server.set_used(); + std::cerr << CERR_PREFIX << "Found server on port " << int(server->port()) << ", flushed it!" << std::endl; + server->set_used(); return true; } // No idea what is wrong here, so we need to find a different port else @@ -126,18 +123,12 @@ bool server_startup(server_startup_st *construct) } else { - for (uint32_t x= 0; x < construct->count; x++) - { - server_st &server= construct->server[x]; - server.set_methods(__getpid, __ping); - } - std::string server_config_string; uint32_t port_base= 0; for (uint32_t x= 0; x < (construct->count -1); x++) { - server_st &server= construct->server[x]; + server_st *server= NULL; { char *var; @@ -147,22 +138,22 @@ bool server_startup(server_startup_st *construct) if ((var= getenv(variable_buffer))) { - server.set_port((in_port_t)atoi(var)); + server= new server_st((in_port_t)atoi(var), __getpid, __ping); } else { - server.set_port(in_port_t(x + TEST_PORT_BASE + port_base)); + server= new server_st(in_port_t(x +TEST_PORT_BASE +port_base), __getpid, __ping); while (not cycle_server(server)) { - std::cerr << CERR_PREFIX << "Found server " << server << ", could not flush it, so trying next port." << std::endl; + std::cerr << CERR_PREFIX << "Found server " << *server << ", could not flush it, so trying next port." << std::endl; port_base++; - server.set_port(in_port_t(x + TEST_PORT_BASE + port_base)); + server->set_port(in_port_t(x +TEST_PORT_BASE +port_base)); } } } - if (server.is_used()) + if (server->is_used()) { std::cerr << std::endl << "Using server at : " << server << std::endl; } @@ -172,76 +163,84 @@ bool server_startup(server_startup_st *construct) if (x == 0) { snprintf(buffer, sizeof(buffer), "%s -d -t 1 -p %u -U %u -m 128", - MEMCACHED_BINARY, server.port(), server.port()); + MEMCACHED_BINARY, server->port(), server->port()); } else { snprintf(buffer, sizeof(buffer), "%s -d -t 1 -p %u -U %u", - MEMCACHED_BINARY, server.port(), server.port()); + MEMCACHED_BINARY, server->port(), server->port()); } - server.set_command(buffer); + server->set_command(buffer); - if (not server.start()) + if (not server->start()) { std::cerr << CERR_PREFIX << "Failed system(" << buffer << ")" << std::endl; + delete server; return false; } - std::cerr << "STARTING SERVER: " << buffer << " pid:" << server.pid() << std::endl; + std::cerr << "STARTING SERVER: " << buffer << " pid:" << server->pid() << std::endl; + } + construct->push_server(server); + + if (x == 0) + { + assert(server->has_port()); + set_default_port(server->port()); } + char port_str[NI_MAXSERV]; + snprintf(port_str, sizeof(port_str), "%u", int(server->port())); + server_config_string+= "--server="; - server_config_string+= server.hostname; + server_config_string+= server->hostname(); server_config_string+= ":"; - server_config_string+= boost::lexical_cast(server.port()); + server_config_string+= port_str; server_config_string+= " "; } // Socket { - server_st &server= construct->server[construct->count -1]; + std::string socket_file(SOCKET_FILE); + char *var; + + if ((var= getenv("LIBMEMCACHED_SOCKET"))) { - std::string socket_file; - char *var; + socket_file= var; + } - server.set_hostname(SOCKET_FILE); + server_st *server= new server_st(SOCKET_FILE, __getpid, __ping); - if ((var= getenv("LIBMEMCACHED_SOCKET"))) - { - socket_file+= var; - } - else - { - if (not cycle_server(server)) - { - std::cerr << CERR_PREFIX << "Found server " << server << ", could not flush it, failing since socket file is not available." << std::endl; - return false; - } - } + if (not cycle_server(server)) + { + std::cerr << CERR_PREFIX << "Found server " << server << ", could not flush it, failing since socket file is not available." << std::endl; + return false; } - if (server.is_used()) + if (server->is_used()) { - std::cerr << std::endl << "Using server at : " << server << std::endl; + std::cerr << std::endl << "Using server at : " << *server << std::endl; } else { char buffer[FILENAME_MAX]; snprintf(buffer, sizeof(buffer), "%s -d -t 1 -s %s", MEMCACHED_BINARY, SOCKET_FILE); - server.set_command(buffer); + server->set_command(buffer); - if (not server.start()) + if (not server->start()) { std::cerr << CERR_PREFIX << "Failed system(" << buffer << ")" << std::endl; + delete server; return false; } - std::cerr << "STARTING SERVER: " << buffer << " pid:" << server.pid() << std::endl; + std::cerr << "STARTING SERVER: " << buffer << " pid:" << server->pid() << std::endl; } + set_default_socket(server->hostname()); + construct->push_server(server); { - set_default_socket(server.hostname); server_config_string+= "--socket=\""; - server_config_string+= server.hostname; + server_config_string+= server->hostname(); server_config_string+= "\" "; } } @@ -258,11 +257,8 @@ bool server_startup(server_startup_st *construct) void server_shutdown(server_startup_st *construct) { - for (uint32_t x= 0; x < construct->count; x++) - { - if (construct->server[x].is_used()) - continue; + if (not construct) + return; - construct->server[x].kill(); - } + construct->shutdown(); } diff --git a/libtest/server.cc b/libtest/server.cc index d9175dba..cb15aee9 100644 --- a/libtest/server.cc +++ b/libtest/server.cc @@ -47,11 +47,11 @@ std::ostream& operator<<(std::ostream& output, const server_st &arg) { if (arg.is_socket()) { - output << arg.hostname; + output << arg.hostname(); } else { - output << arg.hostname << ":" << arg.port(); + output << arg.hostname() << ":" << arg.port(); } return output; // for multiple << operators } @@ -67,6 +67,29 @@ static void global_sleep(void) #endif } +server_st::server_st(in_port_t port_arg, test_server_getpid *get_pid_arg, test_server_ping *ping_arg) : + _used(false), + _pid(-1), + _port(port_arg), + __get_pid(get_pid_arg), + __ping(ping_arg), + _hostname("localhost") +{ + pid_file[0]= 0; +} + +server_st::server_st(const std::string &socket_file, test_server_getpid *get_pid_arg, test_server_ping *ping_arg) : + _used(false), + _pid(-1), + _port(0), + __get_pid(get_pid_arg), + __ping(ping_arg), + _hostname(socket_file) +{ + pid_file[0]= 0; +} + + server_st::~server_st() { if (has_pid()) @@ -148,5 +171,27 @@ bool server_st::kill() return false; } +void server_startup_st::push_server(server_st *arg) +{ + servers.push_back(arg); +} + +void server_startup_st::shutdown() +{ + for (std::vector::iterator iter= servers.begin(); iter != servers.end(); iter++) + { + if ((*iter)->is_used()) + continue; + + (*iter)->kill(); + } +} + server_startup_st::~server_startup_st() -{ } +{ + for (std::vector::iterator iter= servers.begin(); iter != servers.end(); iter++) + { + delete *iter; + } + servers.clear(); +} diff --git a/libtest/server.h b/libtest/server.h index 198e0f6a..f3bda21b 100644 --- a/libtest/server.h +++ b/libtest/server.h @@ -14,6 +14,7 @@ #include #include #include +#include #define SERVERS_TO_CREATE 5 @@ -31,21 +32,12 @@ private: std::string _command; test_server_getpid *__get_pid; test_server_ping *__ping; + std::string _hostname; public: + server_st(in_port_t port_arg, test_server_getpid *, test_server_ping *); - char hostname[NI_MAXHOST]; - - server_st() : - _used(false), - _pid(-1), - _port(0), - __get_pid(NULL), - __ping(NULL) - { - pid_file[0]= 0; - strncpy(hostname, "localhost", sizeof(hostname)); - } + server_st(const std::string &socket_file, test_server_getpid *, test_server_ping *); void set_methods(test_server_getpid *get_pid_arg, test_server_ping *ping_arg) { @@ -53,6 +45,14 @@ public: __ping= ping_arg; } + const char *hostname() const + { + if (_hostname.empty()) + return ""; + + return _hostname.c_str(); + } + bool ping() { if (__ping) @@ -110,12 +110,7 @@ public: bool is_socket() const { - return hostname[0] == '/'; - } - - void set_hostname(const char *arg) - { - strncpy(hostname, arg, sizeof(hostname)); + return _hostname[0] == '/'; } bool kill(); @@ -132,13 +127,16 @@ struct server_startup_st uint8_t count; uint8_t udp; std::string server_list; - server_st server[SERVERS_TO_CREATE]; + std::vector servers; server_startup_st() : count(SERVERS_TO_CREATE), udp(0) { } + void shutdown(); + void push_server(server_st *); + ~server_startup_st(); }; diff --git a/libtest/test.cc b/libtest/test.cc index 29c26ca4..b07340e4 100644 --- a/libtest/test.cc +++ b/libtest/test.cc @@ -200,7 +200,7 @@ int main(int argc, char *argv[]) get_world(world); test_return_t error; - void *creators_ptr= world->create(&error); + void *creators_ptr= world->create(error); if (test_failed(error)) { std::cerr << "create() failed" << std::endl; diff --git a/m4/pandora_have_libboost_date_time.m4 b/m4/pandora_have_libboost_date_time.m4 deleted file mode 100644 index 71c3efe3..00000000 --- a/m4/pandora_have_libboost_date_time.m4 +++ /dev/null @@ -1,46 +0,0 @@ -dnl Copyright (C) 2010 Monty Taylor -dnl This file is free software; Monty Taylor -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -AC_DEFUN([_PANDORA_SEARCH_BOOST_DATE_TIME],[ - AC_REQUIRE([AC_LIB_PREFIX]) - AC_REQUIRE([ACX_PTHREAD]) - - dnl -------------------------------------------------------------------- - dnl Check for Boost.Date_Time - dnl -------------------------------------------------------------------- - - AC_LANG_PUSH(C++) - AC_LIB_HAVE_LINKFLAGS(boost_date_time-mt,,[ - #include - ],[ - boost::gregorian::date weekstart(2002,2,1); - ]) - AS_IF([test "x${ac_cv_libboost_date_time_mt}" = "xno"],[ - AC_LIB_HAVE_LINKFLAGS(boost_date_time,,[ - #include - ],[ - boost::gregorian::date weekstart(2002,2,1); - ]) - ]) - AC_LANG_POP() - - AM_CONDITIONAL(HAVE_BOOST_DATE_TIME, - [test "x${ac_cv_libboost_date_time}" = "xyes" -o "x${ac_cv_libboost_date_time_mt}" = "xyes"]) - BOOST_LIBS="${BOOST_LIBS} ${LTLIBBOOST_DATE_TIME_MT} ${LTLIBBOOST_DATE_TIME}" - AC_SUBST(BOOST_LIBS) -]) - -AC_DEFUN([PANDORA_HAVE_BOOST_DATE_TIME],[ - PANDORA_HAVE_BOOST($1) - _PANDORA_SEARCH_BOOST_DATE_TIME($1) -]) - -AC_DEFUN([PANDORA_REQUIRE_BOOST_DATE_TIME],[ - PANDORA_REQUIRE_BOOST($1) - _PANDORA_SEARCH_BOOST_DATE_TIME($1) - AS_IF([test "x${ac_cv_libboost_date_time}" = "xno" -a "x${ac_cv_libboost_date_time_mt}" = "xno"], - AC_MSG_ERROR([Boost.Date_Time is required for ${PACKAGE}])) -]) - diff --git a/m4/pandora_have_libboost_filesystem.m4 b/m4/pandora_have_libboost_filesystem.m4 deleted file mode 100644 index ea6953ec..00000000 --- a/m4/pandora_have_libboost_filesystem.m4 +++ /dev/null @@ -1,47 +0,0 @@ -dnl Copyright (C) 2010 Monty Taylor -dnl This file is free software; Monty Taylor -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -AC_DEFUN([_PANDORA_SEARCH_BOOST_FILESYSTEM],[ - AC_REQUIRE([AC_LIB_PREFIX]) - - dnl -------------------------------------------------------------------- - dnl Check for Boost.Filesystem - dnl -------------------------------------------------------------------- - - AC_LANG_PUSH(C++) - AC_LIB_HAVE_LINKFLAGS(boost_filesystem-mt,boost_system-mt,[ - #include - ],[ - boost::filesystem::path my_path("some_dir/file.txt"); - ]) - AS_IF([test "x${ac_cv_libboost_filesystem_mt}" = "xno"],[ - AC_LIB_HAVE_LINKFLAGS(boost_filesystem,boost_system,[ - #include - ],[ - boost::filesystem::path my_path("some_dir/file.txt"); - ]) - ]) - AC_LANG_POP() - - AM_CONDITIONAL(HAVE_BOOST_FILESYSTEM, - [test "x${ac_cv_libboost_filesystem}" = "xyes" -o "x${ac_cv_libboost_filesystem_mt}" = "xyes"]) - BOOST_LIBS="${BOOST_LIBS} ${LTLIBBOOST_FILESYSTEM_MT} ${LTLIBBOOST_FILESYSTEM}" - AC_DEFINE([BOOST_FILESYSTEM_DEPRECATED], [1], - [Use the v2 interface until we can stop using old versions]) - AC_SUBST(BOOST_LIBS) -]) - -AC_DEFUN([PANDORA_HAVE_BOOST_FILESYSTEM],[ - PANDORA_HAVE_BOOST($1) - _PANDORA_SEARCH_BOOST_FILESYSTEM($1) -]) - -AC_DEFUN([PANDORA_REQUIRE_BOOST_FILESYSTEM],[ - PANDORA_REQUIRE_BOOST($1) - _PANDORA_SEARCH_BOOST_FILESYSTEM($1) - AS_IF([test "x${ac_cv_libboost_filesystem}" = "xno" -a "x${ac_cv_libboost_filesystem_mt}" = "xno"], - AC_MSG_ERROR([Boost.Filesystem is required for ${PACKAGE}])) -]) - diff --git a/m4/pandora_have_libboost_iostreams.m4 b/m4/pandora_have_libboost_iostreams.m4 deleted file mode 100644 index e9ac7b6e..00000000 --- a/m4/pandora_have_libboost_iostreams.m4 +++ /dev/null @@ -1,49 +0,0 @@ -dnl Copyright (C) 2010 Andrew Hutchings -dnl This file is free software; Andrew Hutchings -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -AC_DEFUN([_PANDORA_SEARCH_BOOST_IOSTREAMS],[ - AC_REQUIRE([AC_LIB_PREFIX]) - - dnl -------------------------------------------------------------------- - dnl Check for Boost.Iostreams - dnl -------------------------------------------------------------------- - - AC_LANG_PUSH(C++) - AC_LIB_HAVE_LINKFLAGS(boost_iostreams-mt,,[ - #include - #include - ],[ - const char* input= "hello world"; - boost::iostreams::stream in(input, strlen(input)); - ]) - AS_IF([test "x${ac_cv_libboost_iostreams_mt}" = "xno"],[ - AC_LIB_HAVE_LINKFLAGS(boost_iostreams,,[ - #include - #include - ],[ - const char* input= "hello world"; - boost::iostreams::stream in(input, strlen(input)); - ]) - ]) - AC_LANG_POP() - - AM_CONDITIONAL(HAVE_BOOST_IOSTREAMS, - [test "x${ac_cv_libboost_iostreams}" = "xyes" -o "x${ac_cv_libboost_iostreams_mt}" = "xyes"]) - BOOST_LIBS="${BOOST_LIBS} ${LTLIBBOOST_IOSTREAMS_MT} ${LTLIBBOOST_IOSTREAMS}" - AC_SUBST(BOOST_LIBS) -]) - -AC_DEFUN([PANDORA_HAVE_BOOST_IOSTREAMS],[ - PANDORA_HAVE_BOOST($1) - _PANDORA_SEARCH_BOOST_IOSTREAMS($1) -]) - -AC_DEFUN([PANDORA_REQUIRE_BOOST_IOSTREAMS],[ - PANDORA_REQUIRE_BOOST($1) - _PANDORA_SEARCH_BOOST_IOSTREAMS($1) - AS_IF([test "x${ac_cv_libboost_iostreams}" = "xno" -a "x${ac_cv_libboost_iostreams_mt}" = "xno"], - AC_MSG_ERROR([Boost.Iostreams is required for ${PACKAGE}])) -]) - diff --git a/m4/pandora_have_libboost_options.m4 b/m4/pandora_have_libboost_options.m4 deleted file mode 100644 index 43fc03fc..00000000 --- a/m4/pandora_have_libboost_options.m4 +++ /dev/null @@ -1,47 +0,0 @@ -dnl Copyright (C) 2010 Monty Taylor -dnl This file is free software; Monty Taylor -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -AC_DEFUN([_PANDORA_SEARCH_BOOST_PROGRAM_OPTIONS],[ - AC_REQUIRE([AC_LIB_PREFIX]) - - dnl -------------------------------------------------------------------- - dnl Check for boost::program_options - dnl -------------------------------------------------------------------- - - AC_LANG_PUSH(C++) - AC_LIB_HAVE_LINKFLAGS(boost_program_options-mt,,[ - #include - ],[ - boost::program_options::options_description d; - d.add_options()("a","some option"); - ]) - AS_IF([test "x${ac_cv_libboost_program_options_mt}" = "xno"],[ - AC_LIB_HAVE_LINKFLAGS(boost_program_options,,[ - #include - ],[ - boost::program_options::options_description d; - d.add_options()("a","some option"); - ]) - ]) - AC_LANG_POP() - - AM_CONDITIONAL(HAVE_BOOST_PROGRAM_OPTIONS, - [test "x${ac_cv_libboost_program_options}" = "xyes" -o "x${ac_cv_libboost_program_options_mt}" = "xyes"]) - BOOST_LIBS="${BOOST_LIBS} ${LTLIBBOOST_PROGRAM_OPTIONS} ${LTLIBBOOST_PROGRAM_OPTIONS_MT}" - AC_SUBST(BOOST_LIBS) -]) - -AC_DEFUN([PANDORA_HAVE_BOOST_PROGRAM_OPTIONS],[ - PANDORA_HAVE_BOOST($1) - _PANDORA_SEARCH_BOOST_PROGRAM_OPTIONS($1) -]) - -AC_DEFUN([PANDORA_REQUIRE_BOOST_PROGRAM_OPTIONS],[ - PANDORA_REQUIRE_BOOST($1) - _PANDORA_SEARCH_BOOST_PROGRAM_OPTIONS($1) - AS_IF([test "x${ac_cv_libboost_program_options}" = "xno" -a "x${ac_cv_libboost_program_options_mt}" = "xno"], - AC_MSG_ERROR([boost::program_options is required for ${PACKAGE}])) -]) - diff --git a/m4/pandora_have_libboost_regex.m4 b/m4/pandora_have_libboost_regex.m4 deleted file mode 100644 index 50a496ac..00000000 --- a/m4/pandora_have_libboost_regex.m4 +++ /dev/null @@ -1,54 +0,0 @@ -dnl Copyright (C) 2010 Andrew Hutchings -dnl This file is free software; Andrew Hutchings -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -AC_DEFUN([_PANDORA_SEARCH_BOOST_REGEX],[ - AC_REQUIRE([AC_LIB_PREFIX]) - AC_REQUIRE([ACX_PTHREAD]) - - dnl -------------------------------------------------------------------- - dnl Check for boost::regex - dnl -------------------------------------------------------------------- - - save_CFLAGS="${CFLAGS}" - save_CXXFLAGS="${CXXFLAGS}" - CFLAGS="${PTHREAD_CFLAGS} ${CFLAGS}" - CXXFLAGS="${PTHREAD_CFLAGS} ${CXXFLAGS}" - - AC_LANG_PUSH(C++) - AC_LIB_HAVE_LINKFLAGS(boost_regex-mt,,[ - #include - ],[ - boost::regex test_regex("drizzle"); - ]) - AS_IF([test "x${ac_cv_libboost_regex_mt}" = "xno"],[ - AC_LIB_HAVE_LINKFLAGS(boost_regex,,[ - #include - ],[ - boost::regex test_regex("drizzle"); - ]) - ]) - AC_LANG_POP() - CFLAGS="${save_CFLAGS}" - CXXFLAGS="${save_CXXFLAGS}" - - - AM_CONDITIONAL(HAVE_BOOST_REGEX, - [test "x${ac_cv_libboost_regex}" = "xyes" -o "x${ac_cv_libboost_regex_mt}" = "xyes"]) - BOOST_LIBS="${BOOST_LIBS} ${LTLIBBOOST_REGEX_MT} ${LTLIBBOOST_REGEX}" - AC_SUBST(BOOST_LIBS) -]) - -AC_DEFUN([PANDORA_HAVE_BOOST_REGEX],[ - PANDORA_HAVE_BOOST($1) - _PANDORA_SEARCH_BOOST_REGEX($1) -]) - -AC_DEFUN([PANDORA_REQUIRE_BOOST_REGEX],[ - PANDORA_REQUIRE_BOOST($1) - _PANDORA_SEARCH_BOOST_REGEX($1) - AS_IF([test "x${ac_cv_libboost_regex}" = "xno" -a "x${ac_cv_libboost_regex_mt}" = "xno"], - AC_MSG_ERROR([boost::regex is required for ${PACKAGE}])) -]) - diff --git a/m4/pandora_have_libboost_test.m4 b/m4/pandora_have_libboost_test.m4 deleted file mode 100644 index 7a526c04..00000000 --- a/m4/pandora_have_libboost_test.m4 +++ /dev/null @@ -1,45 +0,0 @@ -dnl Copyright (C) 2011 Andrew Hutchings -dnl This file is free software; Andrew Hutchings -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -AC_DEFUN([_PANDORA_SEARCH_BOOST_TEST],[ - AC_REQUIRE([AC_LIB_PREFIX]) - - dnl -------------------------------------------------------------------- - dnl Check for boost::test - dnl -------------------------------------------------------------------- - - AC_LANG_PUSH(C++) - AC_LIB_HAVE_LINKFLAGS(boost_unit_test_framework-mt,,[ - #include - ],[ - boost::unit_test::unit_test_log.set_threshold_level(boost::unit_test::log_messages); - ]) - AS_IF([test "x${ac_cv_libboost_unit_test_framework_mt}" = "xno"],[ - AC_LIB_HAVE_LINKFLAGS(boost_unit_test_framework,,[ - #include - ],[ - boost::unit_test::unit_test_log.set_threshold_level(boost::unit_test::log_messages); - ]) - ]) - AC_LANG_POP() - - AM_CONDITIONAL(HAVE_BOOST_TEST, - [test "x${ac_cv_libboost_unit_test_framework}" = "xyes" -o "x${ac_cv_libboost_unit_test_framework_mt}" = "xyes"]) - BOOST_LIBS="${BOOST_LIBS} ${LTLIBBOOST_TEST_MT} ${LTLIBBOOST_TEST}" - AC_SUBST(BOOST_LIBS) -]) - -AC_DEFUN([PANDORA_HAVE_BOOST_TEST],[ - PANDORA_HAVE_BOOST($1) - _PANDORA_SEARCH_BOOST_TEST($1) -]) - -AC_DEFUN([PANDORA_REQUIRE_BOOST_TEST],[ - PANDORA_REQUIRE_BOOST($1) - _PANDORA_SEARCH_BOOST_TEST($1) - AS_IF([test "x${ac_cv_libboost_unit_test_framework}" = "xno" -a "x${ac_cv_libboost_unit_test_framework_mt}" = "xno"], - AC_MSG_ERROR([boost::test is required for ${PACKAGE}])) -]) - diff --git a/m4/pandora_have_libboost_thread.m4 b/m4/pandora_have_libboost_thread.m4 deleted file mode 100644 index e3359fb3..00000000 --- a/m4/pandora_have_libboost_thread.m4 +++ /dev/null @@ -1,54 +0,0 @@ -dnl Copyright (C) 2010 Monty Taylor -dnl This file is free software; Monty Taylor -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -AC_DEFUN([_PANDORA_SEARCH_BOOST_THREAD],[ - AC_REQUIRE([AC_LIB_PREFIX]) - AC_REQUIRE([ACX_PTHREAD]) - - dnl -------------------------------------------------------------------- - dnl Check for boost::thread - dnl -------------------------------------------------------------------- - - save_CFLAGS="${CFLAGS}" - save_CXXFLAGS="${CXXFLAGS}" - CFLAGS="${PTHREAD_CFLAGS} ${CFLAGS}" - CXXFLAGS="${PTHREAD_CFLAGS} ${CXXFLAGS}" - - AC_LANG_PUSH(C++) - AC_LIB_HAVE_LINKFLAGS(boost_thread-mt,,[ - #include - ],[ - boost::thread id; - ]) - AS_IF([test "x${ac_cv_libboost_thread_mt}" = "xno"],[ - AC_LIB_HAVE_LINKFLAGS(boost_thread,,[ - #include - ],[ - boost::thread id; - ]) - ]) - AC_LANG_POP() - CFLAGS="${save_CFLAGS}" - CXXFLAGS="${save_CXXFLAGS}" - - - AM_CONDITIONAL(HAVE_BOOST_THREAD, - [test "x${ac_cv_libboost_thread}" = "xyes" -o "x${ac_cv_libboost_thread_mt}" = "xyes"]) - BOOST_LIBS="${BOOST_LIBS} ${LTLIBBOOST_THREAD_MT} ${LTLIBBOOST_THREAD}" - AC_SUBST(BOOST_LIBS) -]) - -AC_DEFUN([PANDORA_HAVE_BOOST_THREAD],[ - PANDORA_HAVE_BOOST($1) - _PANDORA_SEARCH_BOOST_THREAD($1) -]) - -AC_DEFUN([PANDORA_REQUIRE_BOOST_THREAD],[ - PANDORA_REQUIRE_BOOST($1) - _PANDORA_SEARCH_BOOST_THREAD($1) - AS_IF([test "x${ac_cv_libboost_thread}" = "xno" -a "x${ac_cv_libboost_thread_mt}" = "xno"], - AC_MSG_ERROR([boost::thread is required for ${PACKAGE}])) -]) - diff --git a/tests/include.am b/tests/include.am index d6d3dab0..557e4419 100644 --- a/tests/include.am +++ b/tests/include.am @@ -13,8 +13,6 @@ TESTS_LDADDS= \ libtest/libserver.la \ libtest/libtest.la -VALGRIND_COMMAND= $(LIBTOOL) --mode=execute valgrind --leak-check=yes --show-reachable=yes --track-fds=yes --malloc-fill=A5 --free-fill=DE - DEBUG_COMMAND= $(LIBTOOL) --mode=execute gdb PAHOLE_COMMAND= $(LIBTOOL) --mode=execute pahole -- 2.30.2