tests: run memcached verbosely, catch output and show it on failure
[awesomized/libmemcached] / libtest / server.cc
index 7f3a2d1eda5947444f60a7e23392e893c7642b26..401218baeb32e1e3a5668f90cd3cdbff6190121e 100644 (file)
@@ -43,6 +43,7 @@
 #include <climits>
 #include <cstdlib>
 #include <iostream>
+#include <string>
 
 #include <algorithm> 
 #include <functional> 
@@ -129,7 +130,7 @@ Server::~Server()
 
 bool Server::check()
 {
-  _app.slurp();
+  _app.clear();
   return _app.check();
 }
 
@@ -528,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