tests: honor EPIPE in kill(HUP) test
[awesomized/libmemcached] / libtest / server.cc
index d024d054ab02e4e6d1e284c7a601930f49f8238e..401218baeb32e1e3a5668f90cd3cdbff6190121e 100644 (file)
@@ -43,6 +43,7 @@
 #include <climits>
 #include <cstdlib>
 #include <iostream>
+#include <string>
 
 #include <algorithm> 
 #include <functional> 
@@ -129,9 +130,8 @@ Server::~Server()
 
 bool Server::check()
 {
-  _app.slurp();
-  _app.check();
-  return true;
+  _app.clear();
+  return _app.check();
 }
 
 bool Server::validate()
@@ -197,14 +197,6 @@ bool Server::has_pid() const
 
 bool Server::start()
 {
-  // If we find that we already have a pid then kill it.
-  if (has_pid() == true)
-  {
-#if 0
-    fatal_message("has_pid() failed, programer error");
-#endif
-  }
-
   if (getenv("YATL_GDB_SERVER"))
   {
     _app.use_gdb(true);
@@ -537,4 +529,20 @@ bool Server::kill()
   return false;
 }
 
+std::pair<std::string, std::string> Server::output()
+{
+  _app.slurp();
+  return {
+    std::string {
+      _app.stdout_result().data(),
+      _app.stdout_result().size()
+    },
+    std::string {
+      _app.stderr_result().data(),
+      _app.stderr_result().size()
+    }
+  };
+}
+
+
 } // namespace libtest