From 9e2f8bdc3a3a5606d6e8010c9baeff11e63ee1bd Mon Sep 17 00:00:00 2001 From: Brian Aker Date: Wed, 9 Jan 2013 23:15:49 -0500 Subject: Update for mingw compile. --- libtest/cmdline.h | 8 +++++++- libtest/fatal.hpp | 2 +- libtest/server.cc | 6 +++--- libtest/server.h | 4 +++- libtest/server_container.cc | 4 ++-- libtest/server_container.h | 2 ++ libtest/timer.hpp | 3 +++ libtest/wait.h | 3 ++- 8 files changed, 23 insertions(+), 9 deletions(-) (limited to 'libtest') diff --git a/libtest/cmdline.h b/libtest/cmdline.h index 2f639116..d150ff59 100644 --- a/libtest/cmdline.h +++ b/libtest/cmdline.h @@ -36,7 +36,13 @@ #pragma once -#include +#ifdef _WIN32 +typedef int posix_spawn_file_actions_t; +#else +# include +#endif + +#include // http://www.gnu.org/software/automake/manual/automake.html#Using-the-TAP-test-protocol #ifndef EXIT_SKIP diff --git a/libtest/fatal.hpp b/libtest/fatal.hpp index 8b810e7b..7e627a46 100644 --- a/libtest/fatal.hpp +++ b/libtest/fatal.hpp @@ -53,7 +53,7 @@ public: // The following are just for unittesting the exception class static bool is_disabled(); static void disable(); - static void enable(); + static uint32_t disabled_counter(); static void increment_disabled_counter(); diff --git a/libtest/server.cc b/libtest/server.cc index 33b20ad8..522120be 100644 --- a/libtest/server.cc +++ b/libtest/server.cc @@ -124,7 +124,7 @@ Server::Server(const std::string& host_arg, const in_port_t port_arg, Server::~Server() { - kill(); + murder(); } bool Server::check() @@ -148,7 +148,7 @@ bool Server::cycle() while (--limit and is_pid_valid(_app.pid())) { - if (kill()) + if (murder()) { Log << "Killed existing server," << *this; dream(0, 50000); @@ -498,7 +498,7 @@ bool Server::args(Application& app) return true; } -bool Server::kill() +bool Server::murder() { if (check_pid(_app.pid())) // If we kill it, reset { diff --git a/libtest/server.h b/libtest/server.h index f5138808..5b26fcdd 100644 --- a/libtest/server.h +++ b/libtest/server.h @@ -41,8 +41,10 @@ #include #include #include + #include #include + #include #include #include @@ -249,7 +251,7 @@ public: std::string log_and_pid(); - bool kill(); + bool murder(); bool start(); bool command(libtest::Application& app); diff --git a/libtest/server_container.cc b/libtest/server_container.cc index 513e472c..cc1e0a56 100644 --- a/libtest/server_container.cc +++ b/libtest/server_container.cc @@ -103,7 +103,7 @@ bool server_startup_st::shutdown(uint32_t host_to_shutdown) { Server* tmp= servers[host_to_shutdown]; - if (tmp and tmp->kill() == false) + if (tmp and tmp->murder() == false) { } else { @@ -139,7 +139,7 @@ bool server_startup_st::shutdown() bool success= true; for (std::vector::iterator iter= servers.begin(); iter != servers.end(); ++iter) { - if ((*iter)->has_pid() and (*iter)->kill() == false) + if ((*iter)->has_pid() and (*iter)->murder() == false) { Error << "Unable to kill:" << *(*iter); success= false; diff --git a/libtest/server_container.h b/libtest/server_container.h index 9e083365..48d90901 100644 --- a/libtest/server_container.h +++ b/libtest/server_container.h @@ -39,8 +39,10 @@ #include #include #include + #include #include + #include #include #include diff --git a/libtest/timer.hpp b/libtest/timer.hpp index 28ec4741..cd34124f 100644 --- a/libtest/timer.hpp +++ b/libtest/timer.hpp @@ -122,6 +122,9 @@ private: mach_port_deallocate(mach_task_self(), _clock_serv); ts.tv_sec= _mach_timespec.tv_sec; ts.tv_nsec= _mach_timespec.tv_nsec; +#elif defined(_WIN32) + ts.tv_sec= time(NULL); + ts.tv_nsec= 0; #else clock_gettime(CLOCK_REALTIME, &ts); #endif diff --git a/libtest/wait.h b/libtest/wait.h index a39a853e..5f013cd3 100644 --- a/libtest/wait.h +++ b/libtest/wait.h @@ -38,8 +38,9 @@ #include #include -#include +#include +#include #include namespace libtest { -- cgit v1.2.1