From: Brian Aker Date: Sun, 11 Mar 2012 07:40:27 +0000 (-0800) Subject: Update of libtest X-Git-Tag: 1.0.5~4 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=168c52f7a08866dbf2f151123ecf2bffbe7a5b0f;p=awesomized%2Flibmemcached Update of libtest --- diff --git a/libtest/binaries.cc b/libtest/binaries.cc index 33cde3b7..e437f969 100644 --- a/libtest/binaries.cc +++ b/libtest/binaries.cc @@ -20,6 +20,7 @@ */ +#include #include namespace libtest { diff --git a/libtest/blobslap_worker.cc b/libtest/blobslap_worker.cc index fe1cdce3..caddbdd7 100644 --- a/libtest/blobslap_worker.cc +++ b/libtest/blobslap_worker.cc @@ -20,6 +20,7 @@ */ +#include #include #include diff --git a/libtest/cmdline.cc b/libtest/cmdline.cc index efe03040..76b677f4 100644 --- a/libtest/cmdline.cc +++ b/libtest/cmdline.cc @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include #include using namespace libtest; diff --git a/libtest/common.h b/libtest/common.h index 1e50bf08..05f273a7 100644 --- a/libtest/common.h +++ b/libtest/common.h @@ -25,8 +25,6 @@ #pragma once -#include - #include #include #include diff --git a/libtest/core.cc b/libtest/core.cc index 3e30444a..fac66616 100644 --- a/libtest/core.cc +++ b/libtest/core.cc @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include #include diff --git a/libtest/cpu.cc b/libtest/cpu.cc index d75df955..10bb303c 100644 --- a/libtest/cpu.cc +++ b/libtest/cpu.cc @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include #include #include diff --git a/libtest/dream.cc b/libtest/dream.cc index 32dece35..c03bd902 100644 --- a/libtest/dream.cc +++ b/libtest/dream.cc @@ -20,6 +20,7 @@ */ +#include #include namespace libtest { diff --git a/libtest/failed.cc b/libtest/failed.cc index 11e237dc..88b84664 100644 --- a/libtest/failed.cc +++ b/libtest/failed.cc @@ -20,6 +20,7 @@ */ +#include #include #include diff --git a/libtest/fatal.cc b/libtest/fatal.cc index 36683a48..4cef2047 100644 --- a/libtest/fatal.cc +++ b/libtest/fatal.cc @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include #include #include diff --git a/libtest/framework.cc b/libtest/framework.cc index 1541e7da..a9730a0e 100644 --- a/libtest/framework.cc +++ b/libtest/framework.cc @@ -20,6 +20,7 @@ */ +#include #include #include diff --git a/libtest/gearmand.cc b/libtest/gearmand.cc index 4a544f10..85307fcf 100644 --- a/libtest/gearmand.cc +++ b/libtest/gearmand.cc @@ -20,6 +20,7 @@ */ +#include #include #include diff --git a/libtest/http.cc b/libtest/http.cc index 5309d504..1a0a10ec 100644 --- a/libtest/http.cc +++ b/libtest/http.cc @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include #include #if defined(HAVE_CURL_CURL_H) && HAVE_CURL_CURL_H diff --git a/libtest/is_local.cc b/libtest/is_local.cc index dfc303b2..ec3322af 100644 --- a/libtest/is_local.cc +++ b/libtest/is_local.cc @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include #include diff --git a/libtest/killpid.cc b/libtest/killpid.cc index 79f6a3f8..cfc9316f 100644 --- a/libtest/killpid.cc +++ b/libtest/killpid.cc @@ -20,6 +20,7 @@ */ +#include #include #include diff --git a/libtest/libtool.cc b/libtest/libtool.cc index 90f0035e..5beea9b9 100644 --- a/libtest/libtool.cc +++ b/libtest/libtool.cc @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include #include #include diff --git a/libtest/memcached.cc b/libtest/memcached.cc index c5358bf5..81068aef 100644 --- a/libtest/memcached.cc +++ b/libtest/memcached.cc @@ -20,6 +20,7 @@ */ +#include #include #include diff --git a/libtest/port.cc b/libtest/port.cc index b6820335..2561343d 100644 --- a/libtest/port.cc +++ b/libtest/port.cc @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include #include #include diff --git a/libtest/runner.cc b/libtest/runner.cc index b205b0e7..6b8d0d48 100644 --- a/libtest/runner.cc +++ b/libtest/runner.cc @@ -20,6 +20,7 @@ */ +#include #include namespace libtest { diff --git a/libtest/server.cc b/libtest/server.cc index e554039a..31ea6eff 100644 --- a/libtest/server.cc +++ b/libtest/server.cc @@ -20,6 +20,7 @@ */ +#include #include #include @@ -180,9 +181,11 @@ bool Server::start() { Wait wait(pid_file(), 8); - if (not wait.successful()) + if (wait.successful() == false) { - Error << "Unable to open pidfile for: " << _running; + libtest::fatal(LIBYATL_DEFAULT_PARAM, + "Unable to open pidfile for: %s", + _running.c_str()); } } diff --git a/libtest/server_container.cc b/libtest/server_container.cc index 6d0c785e..ff44228a 100644 --- a/libtest/server_container.cc +++ b/libtest/server_container.cc @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include #include #include @@ -235,7 +236,6 @@ bool server_startup(server_startup_st& construct, const std::string& server_type } else if (server->start() == false) { - Error << "Failed to start " << *server; delete server; return false; } diff --git a/libtest/signal.cc b/libtest/signal.cc index 42e6d78d..bc9da4bc 100644 --- a/libtest/signal.cc +++ b/libtest/signal.cc @@ -20,6 +20,7 @@ */ +#include #include #include diff --git a/libtest/socket.cc b/libtest/socket.cc index 21fade0b..832f0c4a 100644 --- a/libtest/socket.cc +++ b/libtest/socket.cc @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include #include static char global_socket[1024]= { 0 }; diff --git a/libtest/strerror.cc b/libtest/strerror.cc index d081bafc..0739d625 100644 --- a/libtest/strerror.cc +++ b/libtest/strerror.cc @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include #include namespace libtest { diff --git a/libtest/test.cc b/libtest/test.cc index 66d258a0..d367603d 100644 --- a/libtest/test.cc +++ b/libtest/test.cc @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include #include #include @@ -192,15 +193,9 @@ int main(int argc, char *argv[]) try { do { exit_code= EXIT_SUCCESS; - Framework *world= new Framework(); + Framework world; - if (world == NULL) - { - Error << "Failed to create Framework()"; - return EXIT_FAILURE; - } - - assert(sigignore(SIGPIPE) == 0); + fatal_assert(sigignore(SIGPIPE) == 0); libtest::SignalThread signal; if (not signal.setup()) @@ -211,10 +206,10 @@ int main(int argc, char *argv[]) Stats stats; - get_world(world); + get_world(&world); test_return_t error; - void *creators_ptr= world->create(error); + void *creators_ptr= world.create(error); switch (error) { @@ -223,11 +218,9 @@ int main(int argc, char *argv[]) case TEST_SKIPPED: Out << "SKIP " << argv[0]; - delete world; return EXIT_SUCCESS; case TEST_FAILURE: - delete world; return EXIT_FAILURE; } @@ -250,7 +243,7 @@ int main(int argc, char *argv[]) wildcard= argv[2]; } - for (collection_st *next= world->collections; next and next->name and (not signal.is_shutdown()); next++) + for (collection_st *next= world.collections; next and next->name and (not signal.is_shutdown()); next++) { bool failed= false; bool skipped= false; @@ -262,11 +255,11 @@ int main(int argc, char *argv[]) stats.collection_total++; - test_return_t collection_rc= world->startup(creators_ptr); + test_return_t collection_rc= world.startup(creators_ptr); if (collection_rc == TEST_SUCCESS and next->pre) { - collection_rc= world->runner()->pre(next->pre, creators_ptr); + collection_rc= world.runner()->pre(next->pre, creators_ptr); } switch (collection_rc) @@ -303,20 +296,20 @@ int main(int argc, char *argv[]) test_return_t return_code; try { - if (test_success(return_code= world->item.startup(creators_ptr))) + if (test_success(return_code= world.item.startup(creators_ptr))) { - if (test_success(return_code= world->item.flush(creators_ptr, run))) + if (test_success(return_code= world.item.flush(creators_ptr, run))) { // @note pre will fail is SKIPPED is returned - if (test_success(return_code= world->item.pre(creators_ptr))) + if (test_success(return_code= world.item.pre(creators_ptr))) { { // Runner Code gettimeofday(&start_time, NULL); - assert(world->runner()); + assert(world.runner()); assert(run->test_fn); try { - return_code= world->runner()->run(run->test_fn, creators_ptr); + return_code= world.runner()->run(run->test_fn, creators_ptr); } // Special case where check for the testing of the exception // system. @@ -339,7 +332,7 @@ int main(int argc, char *argv[]) } // @todo do something if post fails - (void)world->item.post(creators_ptr); + (void)world.item.post(creators_ptr); } else if (return_code == TEST_SKIPPED) { } @@ -394,7 +387,7 @@ int main(int argc, char *argv[]) throw fatal_message("invalid return code"); } - if (test_failed(world->on_error(return_code, creators_ptr))) + if (test_failed(world.on_error(return_code, creators_ptr))) { Error << "Failed while running on_error()"; signal.set_shutdown(SHUTDOWN_GRACEFUL); @@ -402,7 +395,7 @@ int main(int argc, char *argv[]) } } - (void) world->runner()->post(next->post, creators_ptr); + (void) world.runner()->post(next->post, creators_ptr); cleanup: if (failed == false and skipped == false) @@ -420,7 +413,7 @@ cleanup: stats.collection_skipped++; } - world->shutdown(creators_ptr); + world.shutdown(creators_ptr); Outn(); } @@ -451,8 +444,6 @@ cleanup: stats_print(&stats); - delete world; - Outn(); // Generate a blank to break up the messages if make check/test has been run } while (exit_code == EXIT_SUCCESS and opt_repeat); } diff --git a/libtest/vchar.cc b/libtest/vchar.cc index 779cfbba..9e0b92a4 100644 --- a/libtest/vchar.cc +++ b/libtest/vchar.cc @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include #include namespace libtest {