Update from libtest tree.
authorBrian Aker <brian@tangent.org>
Thu, 4 Aug 2011 01:53:16 +0000 (18:53 -0700)
committerBrian Aker <brian@tangent.org>
Thu, 4 Aug 2011 01:53:16 +0000 (18:53 -0700)
libtest/common.h
libtest/server.cc

index c2fe5144a66975e984b9a2d466a013e0c1782d96..7a7f1ff0fec127e23c10d7219498c91cde69187e 100644 (file)
@@ -19,7 +19,6 @@
  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-
 /*
   Common include file for libmemached
 */
 
 #include <config.h>
 
-#include <inttypes.h>
-#include <cstdlib>
-#include <sys/types.h>
-
-#include <cerrno>
 #include <cassert>
+#include <cerrno>
+#include <cstdlib>
 #include <sstream>
 #include <string>
 
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+
+#ifdef HAVE_SYS_WAIT_H
+#include <sys/wait.h>
+#endif
+
+#ifdef HAVE_SYS_RESOURCE_H 
+#include <sys/resource.h> 
+#endif
+#ifdef HAVE_FNMATCH_H
+#include <fnmatch.h>
+#endif
+
 #include <libtest/test.hpp>
index c2f38ba9a8512acd2537d30795aa55f462666684..b8fb603e13696fdadc9bdcfa6cb97a6f719bbf6d 100644 (file)
@@ -51,6 +51,19 @@ static inline std::string &rtrim(std::string &s)
 #include <libtest/memcached.h>
 #endif
 
+extern "C" {
+  static bool exited_successfully(int status)
+  {
+    if (WEXITSTATUS(status) == 0)
+    {
+      return true;
+    }
+
+    return true;
+  }
+}
+
+
 namespace libtest {
 
 std::ostream& operator<<(std::ostream& output, const Server &arg)
@@ -180,7 +193,8 @@ bool Server::start()
     _running+= " &";
   }
 
-  if (system(_running.c_str()) == -1)
+  int ret= system(_running.c_str());
+  if (not exited_successfully(ret))
   {
     Error << "system() failed:" << strerror(errno);
     _running.clear();
@@ -513,6 +527,7 @@ bool server_startup_st::is_helgrind() const
 bool server_startup(server_startup_st& construct, const std::string& server_type, in_port_t try_port, int argc, const char *argv[])
 {
   Outn();
+  (void)try_port;
 
   // Look to see if we are being provided ports to use
   {