summaryrefslogtreecommitdiff
path: root/libtest
diff options
context:
space:
mode:
authorBrian Aker <brian@tangent.org>2013-01-13 12:56:54 -0500
committerBrian Aker <brian@tangent.org>2013-01-13 12:56:54 -0500
commit2b6312d4024614619c74b573f2da6ad462224464 (patch)
treecb3305c6812cf6d780c7f10af479e82eb7e009d0 /libtest
parent5b66b60ec4431d03b1e8fc22cdf57dd1cd9daae5 (diff)
parentf8b292888ba497bd220f6469a21bc8928ce1ecc2 (diff)
downloadlibmemcached-2b6312d4024614619c74b573f2da6ad462224464.tar.gz
Merge 1.0
Diffstat (limited to 'libtest')
-rw-r--r--libtest/cmdline.h8
-rw-r--r--libtest/fatal.hpp2
-rw-r--r--libtest/server.cc6
-rw-r--r--libtest/server.h4
-rw-r--r--libtest/server_container.cc4
-rw-r--r--libtest/server_container.h2
-rw-r--r--libtest/timer.hpp3
-rw-r--r--libtest/wait.h3
8 files changed, 23 insertions, 9 deletions
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 <spawn.h>
+#ifdef _WIN32
+typedef int posix_spawn_file_actions_t;
+#else
+# include <spawn.h>
+#endif
+
+#include <pthread.h>
// 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 <cassert>
#include <cstdio>
#include <cstring>
+
#include <netdb.h>
#include <netinet/in.h>
+
#include <string>
#include <unistd.h>
#include <vector>
@@ -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<Server *>::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 <cassert>
#include <cstdio>
#include <cstring>
+
#include <netdb.h>
#include <netinet/in.h>
+
#include <string>
#include <unistd.h>
#include <vector>
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 <unistd.h>
#include <string>
-#include <signal.h>
+#include <csignal>
+#include <sys/types.h>
#include <libtest/dream.h>
namespace libtest {