From: Brian Aker Date: Sun, 15 Jul 2012 07:52:17 +0000 (-0700) Subject: Merge of cppcheck, assert fix. X-Git-Tag: 1.0.10~3 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=6278f4fcc2b81952d7420c081961dd83935c8c85;hp=85b7bde8fee1a43ace784690188e2f4c62f89825;p=awesomized%2Flibmemcached Merge of cppcheck, assert fix. --- diff --git a/ChangeLog b/ChangeLog index d3b338d3..76edf62a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +1.0.10 +* --disable-assert has been removed from configure, and --enable-assert has been added in its place. + + 1.0.9 Wed Jul 4 22:46:19 EDT 2012 * Faster close on socket. * Instance allocation is now seperated from server interface. This should allow for a better preservation of ABI compliance from now on. diff --git a/bootstrap.sh b/bootstrap.sh index e1c39ec8..240f6ac0 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -4,5 +4,5 @@ if test -f configure; then make clean; make merge-clean; make distclean; fi; rm -r -f autom4te.cache ./config/autorun.sh -./configure +./configure --enable-assert make diff --git a/libtest/cmdline.cc b/libtest/cmdline.cc index 1233f514..94d4cce4 100644 --- a/libtest/cmdline.cc +++ b/libtest/cmdline.cc @@ -741,7 +741,7 @@ void Application::create_argv(const char *args[]) built_argv[x++]= strdup(_exectuble_with_path.c_str()); - for (Options::const_iterator iter= _options.begin(); iter != _options.end(); iter++) + for (Options::const_iterator iter= _options.begin(); iter != _options.end(); ++iter) { built_argv[x++]= strdup((*iter).first.c_str()); if ((*iter).second.empty() == false) diff --git a/libtest/core.cc b/libtest/core.cc index fba81c03..0ebe3efd 100644 --- a/libtest/core.cc +++ b/libtest/core.cc @@ -42,8 +42,11 @@ namespace libtest { void create_core(void) { -#ifdef TARGET_OS_OSX - return; +#if defined(TARGET_OS_OSX) && TARGET_OS_OSX + if (TARGET_OS_OSX) + { + return; + } #endif if (getenv("YATL_COREDUMP")) { diff --git a/libtest/failed.cc b/libtest/failed.cc index 314a2e99..ae79e307 100644 --- a/libtest/failed.cc +++ b/libtest/failed.cc @@ -46,7 +46,7 @@ namespace libtest { struct failed_st { - failed_st(const std::string collection_arg, const std::string test_arg) : + failed_st(const std::string& collection_arg, const std::string& test_arg) : collection(collection_arg), test(test_arg) { } @@ -70,7 +70,7 @@ public: void print_failed_test(void) { - for (Failures::iterator iter= failures.begin(); iter != failures.end(); iter++) + for (Failures::iterator iter= failures.begin(); iter != failures.end(); ++iter) { Error << "\t" << (*iter).collection << " " << (*iter).test; } diff --git a/libtest/fatal.cc b/libtest/fatal.cc index d4459662..c61b5cfb 100644 --- a/libtest/fatal.cc +++ b/libtest/fatal.cc @@ -54,7 +54,7 @@ fatal::fatal(const char *file_arg, int line_arg, const char *func_arg, const cha strncpy(_mesg, last_error, sizeof(_mesg)); - snprintf(_error_message, sizeof(_error_message), "%s", last_error); + snprintf(_error_message, sizeof(_error_message), "%.*s", last_error_length, last_error); } static bool _disabled= false; diff --git a/libtest/is_local.cc b/libtest/is_local.cc index b03c2325..7ae7b7f4 100644 --- a/libtest/is_local.cc +++ b/libtest/is_local.cc @@ -45,5 +45,16 @@ bool test_is_local() return (getenv("LIBTEST_LOCAL")); } +static bool _is_massive= false; +void is_massive(bool arg) +{ + _is_massive= arg; +} + +bool is_massive() +{ + return _is_massive; +} + } // namespace libtest diff --git a/libtest/is_local.hpp b/libtest/is_local.hpp index c06bc9dd..08355533 100644 --- a/libtest/is_local.hpp +++ b/libtest/is_local.hpp @@ -41,4 +41,10 @@ namespace libtest { LIBTEST_API bool test_is_local(); +LIBTEST_API +void is_massive(bool); + +LIBTEST_API +bool is_massive(); + } // namespace libtest diff --git a/libtest/m4/mysql.m4 b/libtest/m4/mysql.m4 index ed61b40d..2edd3b86 100644 --- a/libtest/m4/mysql.m4 +++ b/libtest/m4/mysql.m4 @@ -1,3 +1,6 @@ +m4_include([libtest/m4/ax_lib_mysql.m4]) +m4_include([libtest/m4/ax_prog_mysqld.m4]) + AX_LIB_MYSQL([5.0]) AM_CONDITIONAL(HAVE_LIBMYSQL, test "x${found_mysql}" = "xyes") AS_IF([test "x${found_mysql}" = "xyes"], diff --git a/libtest/main.cc b/libtest/main.cc index 79f177c3..453d2966 100644 --- a/libtest/main.cc +++ b/libtest/main.cc @@ -187,11 +187,21 @@ int main(int argc, char *argv[]) } } + if ((bool(getenv("YATL_RUN_MASSIVE_TESTS"))) or opt_massive) + { + opt_massive= true; + } + if (opt_quiet) { close(STDOUT_FILENO); } + if (opt_massive) + { + is_massive(opt_massive); + } + char buffer[1024]; if (getenv("LIBTEST_TMP")) { diff --git a/libtest/server_container.cc b/libtest/server_container.cc index d8ef5d49..0448e209 100644 --- a/libtest/server_container.cc +++ b/libtest/server_container.cc @@ -287,17 +287,16 @@ bool server_startup_st::start_server(const std::string& server_type, in_port_t t server->build(argc, argv); +#if 0 if (false) { Out << "Pausing for startup, hit return when ready."; std::string gdb_command= server->base_command(); - std::string options; -#if 0 - Out << "run " << server->args(options); -#endif getchar(); } - else if (server->start() == false) + else +#endif + if (server->start() == false) { delete server; return false; @@ -397,17 +396,18 @@ bool server_startup_st::start_socket_server(const std::string& server_type, cons server->build(argc, argv); +#if 0 if (false) { Out << "Pausing for startup, hit return when ready."; std::string gdb_command= server->base_command(); std::string options; -#if 0 Out << "run " << server->args(options); -#endif getchar(); } - else if (server->start() == false) + else +#endif + if (server->start() == false) { Error << "Failed to start " << *server; delete server; diff --git a/libtest/unittest.cc b/libtest/unittest.cc index b68669f5..3d85b77d 100644 --- a/libtest/unittest.cc +++ b/libtest/unittest.cc @@ -179,7 +179,6 @@ static test_return_t var_drizzle_exists_test(void *) static test_return_t var_tmp_test(void *) { FILE *file= fopen("var/tmp/junk", "w+"); - char buffer[1024]; test_true(file); fclose(file); return TEST_SUCCESS; diff --git a/m4/pandora_header_assert.m4 b/m4/pandora_header_assert.m4 index 2fdf9d4c..f72f2d5e 100644 --- a/m4/pandora_header_assert.m4 +++ b/m4/pandora_header_assert.m4 @@ -11,10 +11,10 @@ AC_DEFUN([PANDORA_HEADER_ASSERT], AC_CHECK_HEADERS(assert.h) AC_MSG_CHECKING([whether to enable assertions]) AC_ARG_ENABLE([assert], - [AS_HELP_STRING([--disable-assert], - [Turn off assertions])], - [ac_cv_assert="no"], - [ac_cv_assert="yes"]) + [AS_HELP_STRING([--enable-assert], + [Turn on assertions])], + [ac_cv_assert="yes"], + [ac_cv_assert="no"]) AC_MSG_RESULT([$ac_cv_assert]) AS_IF([test "$ac_cv_assert" = "no"],