Update framework.
authorBrian Aker <brian@tangent.org>
Tue, 17 Apr 2012 16:55:40 +0000 (09:55 -0700)
committerBrian Aker <brian@tangent.org>
Tue, 17 Apr 2012 16:55:40 +0000 (09:55 -0700)
26 files changed:
configure.ac
example/t/memcached_light.cc
libtest/binaries.cc
libtest/binaries.h
libtest/cmdline.cc
libtest/cmdline.h
libtest/common.h
libtest/drizzled.cc [new file with mode: 0644]
libtest/drizzled.h [new file with mode: 0644]
libtest/framework.cc
libtest/gearmand.cc
libtest/include.am
libtest/main.cc [new file with mode: 0644]
libtest/server.cc
libtest/server_container.cc
libtest/test.cc [deleted file]
libtest/unittest.cc
tests/failure.cc
tests/libmemcached-1.0/all_tests.cc
tests/libmemcached-1.0/all_tests_socket.cc
tests/libmemcached-1.0/atomsmasher.cc
tests/libmemcached-1.0/plus.cpp
tests/libmemcached-1.0/sasl.cc
tests/libmemcached_world.h
tests/libmemcached_world_socket.h
tests/mem_udp.cc

index de2bc88159b38238939fb2597a385157a4cd5fd0..19c54d5ceefac9486d6a13ee0c50bba57899ec8f 100644 (file)
@@ -71,6 +71,7 @@ m4_include([memcached/version.m4])
 
 AM_CONDITIONAL(BUILDING_LIBMEMCACHED, true)
 AM_CONDITIONAL(HAVE_LIBMEMCACHED, false)
+AM_CONDITIONAL(HAVE_LIBDRIZZLE, false)
 AC_DEFINE([HAVE_LIBMEMCACHED], [1], [Enables libmemcached Support])
 
 AM_CONDITIONAL(BUILDING_GEARMAN, false)
@@ -218,6 +219,7 @@ AS_IF([test "x$ac_cv_header_atomic_h" = "xyes"],[
 
 AC_DEFINE([HAVE_LIBDRIZZLE], [0], [Support for libdrizzle])
 AC_DEFINE([HAVE_DRIZZLED_BINARY], [0], [Support for DrizzleD])
+AC_DEFINE([DRIZZLED_BINARY], [0], [Support for DrizzleD])
 AC_DEFINE([GEARMAND_BLOBSLAP_WORKER], [0], [Support for Gearman Blobslap worker])
 AC_DEFINE([HAVE_LIBPQ], [0], [Support for Postgres])
 AC_DEFINE([HAVE_LIBCURL], [0], [Support for libcurl])
index bcfce0a52a19e3bdc350fe28ad64c9c562698510..e24d31c2350cdd47b6018eaf709aa5d0d869f780 100644 (file)
@@ -166,8 +166,6 @@ public:
   }
 };
 
-static MemcachedLightRunner defualt_libmemcached_runner;
-
 test_st cmdline_option_TESTS[] ={
   {"--help", true, help_TEST },
   {"--verbose", true, verbose_TEST },
@@ -238,6 +236,6 @@ void get_world(Framework *world)
   world->_create= world_create;
   world->_destroy= world_destroy;
   world->collections= collection;
-  world->set_runner(&defualt_libmemcached_runner);
+  world->set_runner(new MemcachedLightRunner);
 }
 
index e437f96942cdc285232f992b6fca986134073b34..2efde2f3791c4c1060a8cf83887cb237166a6932 100644 (file)
@@ -46,10 +46,22 @@ bool has_gearmand_binary()
   return false;
 }
 
+bool has_drizzled_binary()
+{
+#if defined(HAVE_DRIZZLED_BINARY) && HAVE_DRIZZLED_BINARY
+  if (access(DRIZZLED_BINARY, R_OK|X_OK) == 0)
+  {
+    return true;
+  }
+#endif
+
+  return false;
+}
+
 bool has_memcached_binary()
 {
 #if defined(HAVE_MEMCACHED_BINARY) && HAVE_MEMCACHED_BINARY
-  if (access(MEMCACHED_BINARY,R_OK|X_OK) == 0)
+  if (access(MEMCACHED_BINARY, R_OK|X_OK) == 0)
   {
     return true;
   }
index e071016cf2c7505862a3437ce8eeb632e48627e8..0b886872b225b973c533a123b675f8de089df10c 100644 (file)
@@ -32,5 +32,8 @@ bool has_memcached_sasl_binary();
 LIBTEST_API
 bool has_gearmand_binary();
 
+LIBTEST_API
+bool has_drizzled_binary();
+
 } // namespace libtest
 
index de7c89d70891e287e3aebb3e5bb366bdf469bce4..6b8205cb1fff276fe8d02ccb172fd123e4329541 100644 (file)
@@ -113,6 +113,7 @@ Application::Application(const std::string& arg, const bool _use_libtool_arg) :
   _use_valgrind(false),
   _use_gdb(false),
   _use_ptrcheck(false),
+  _will_fail(false),
   _argc(0),
   _exectuble(arg),
   stdin_fd(STDIN_FILENO),
@@ -252,7 +253,10 @@ Application::error_t Application::run(const char *args[])
 
   if (spawn_ret != 0)
   {
-    Error << strerror(spawn_ret) << "(" << spawn_ret << ")";
+    if (_will_fail == false)
+    {
+      Error << strerror(spawn_ret) << "(" << spawn_ret << ")";
+    }
     _pid= -1;
     return Application::INVALID;
   }
@@ -792,4 +796,9 @@ const char *gearmand_binary()
   return GEARMAND_BINARY;
 }
 
+const char *drizzled_binary() 
+{
+  return DRIZZLED_BINARY;
+}
+
 } // namespace exec_cmdline
index 44fd17f92ff4f75ec484fa8e05575e114ef59373..a3d9cb25333fb6b33da74febfa544e44d846160b 100644 (file)
@@ -134,6 +134,11 @@ public:
     return _pid;
   }
 
+  void will_fail()
+  {
+    _will_fail= true;
+  }
+
 private:
   void create_argv(const char *args[]);
   void delete_argv();
@@ -143,6 +148,7 @@ private:
   bool _use_valgrind;
   bool _use_gdb;
   bool _use_ptrcheck;
+  bool _will_fail;
   size_t _argc;
   std::string _exectuble_name;
   std::string _exectuble;
@@ -184,5 +190,6 @@ static inline std::ostream& operator<<(std::ostream& output, const enum Applicat
 int exec_cmdline(const std::string& executable, const char *args[], bool use_libtool= false);
 
 const char *gearmand_binary(); 
+const char *drizzled_binary();
 
 }
index 05f273a72bf6102317533a32e341df1eecaf31e4..39b99c51728c1bffda41d311b8a485a1b35f7821 100644 (file)
@@ -58,6 +58,7 @@
 #include <libtest/gearmand.h>
 #include <libtest/blobslap_worker.h>
 #include <libtest/memcached.h>
+#include <libtest/drizzled.h>
 
 #include <libtest/libtool.hpp>
 #include <libtest/killpid.h>
diff --git a/libtest/drizzled.cc b/libtest/drizzled.cc
new file mode 100644 (file)
index 0000000..c124192
--- /dev/null
@@ -0,0 +1,206 @@
+/*  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
+ * 
+ *  libtest
+ *
+ *  Copyright (C) 2011 Data Differential, http://datadifferential.com/
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 3 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+
+#include <config.h>
+#include <libtest/common.h>
+
+#include <libtest/drizzled.h>
+
+#include "util/instance.hpp"
+#include "util/operation.hpp"
+
+using namespace datadifferential;
+using namespace libtest;
+
+#include <cassert>
+#include <cerrno>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+#include <iostream>
+#include <signal.h>
+#include <sstream>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <unistd.h>
+
+#ifndef __INTEL_COMPILER
+#pragma GCC diagnostic ignored "-Wold-style-cast"
+#endif
+
+#if defined(HAVE_LIBDRIZZLE) && HAVE_LIBDRIZZLE
+#include <libdrizzle-1.0/drizzle_client.h>
+#endif
+
+using namespace libtest;
+
+namespace libtest {
+bool ping_drizzled(const in_port_t _port)
+{
+#if defined(HAVE_LIBDRIZZLE) && HAVE_LIBDRIZZLE
+  {
+    drizzle_st *drizzle= drizzle_create(NULL);
+
+    if (drizzle == NULL)
+    {
+      return false;
+    }
+
+    drizzle_con_st *con;
+
+    if ((con= drizzle_con_create(drizzle, NULL)) == NULL)
+    {
+      drizzle_free(drizzle);
+      return false;
+    }
+
+    drizzle_con_set_tcp(con, "localhost", _port);
+    drizzle_con_set_auth(con, "root", 0);
+
+    bool success= false;
+
+    drizzle_return_t rc;
+    if ((rc= drizzle_con_connect(con)) == DRIZZLE_RETURN_OK)
+    {
+      drizzle_result_st *result= drizzle_ping(con, NULL, &rc);
+      success= bool(result);
+      drizzle_result_free(result);
+    }
+
+    if (success == true)
+    { }
+    else if (rc != DRIZZLE_RETURN_OK)
+    {
+      Error << drizzle_error(drizzle) << " localhost:" << _port;
+    }
+
+    drizzle_con_free(con);
+    drizzle_free(drizzle);
+
+    return success;
+  }
+#endif
+
+  return false;
+}
+} // namespace libtest
+
+class Drizzle : public libtest::Server
+{
+private:
+public:
+  Drizzle(const std::string& host_arg, in_port_t port_arg) :
+    libtest::Server(host_arg, port_arg, DRIZZLED_BINARY, false)
+  {
+    set_pid_file();
+  }
+
+  bool ping()
+  {
+    size_t limit= 5;
+    while (_app.check() and --limit)
+    {
+      if (ping_drizzled(_port))
+      {
+        return true;
+      }
+      libtest::dream(1, 0);
+    }
+
+    return false;
+  }
+
+  const char *name()
+  {
+    return "drizzled";
+  };
+
+  void log_file_option(Application& app, const std::string& arg)
+  {
+  }
+
+  bool has_log_file_option() const
+  {
+    return true;
+  }
+
+  bool broken_pid_file()
+  {
+    return true;
+  }
+
+  bool is_libtool()
+  {
+    return false;
+  }
+
+  bool has_syslog() const
+  {
+    return true;
+  }
+
+  bool has_port_option() const
+  {
+    return true;
+  }
+
+  void port_option(Application& app, in_port_t arg)
+  {
+    if (arg > 0)
+    {
+      char buffer[1024];
+      snprintf(buffer, sizeof(buffer), "--drizzle-protocol.port=%d", int(arg));
+      app.add_option(buffer);
+    }
+  }
+
+  bool build(size_t argc, const char *argv[]);
+};
+
+bool Drizzle::build(size_t argc, const char *argv[])
+{
+  if (getuid() == 0 or geteuid() == 0)
+  {
+    add_option("--user=root");
+  }
+
+  add_option("--verbose=INSPECT");
+#if 0
+  add_option("--datadir=var/drizzle");
+#endif
+
+  for (size_t x= 0 ; x < argc ; x++)
+  {
+    add_option(argv[x]);
+  }
+
+  return true;
+}
+
+namespace libtest {
+
+libtest::Server *build_drizzled(const char *hostname, in_port_t try_port)
+{
+  return new Drizzle(hostname, try_port);
+}
+
+}
diff --git a/libtest/drizzled.h b/libtest/drizzled.h
new file mode 100644 (file)
index 0000000..496a201
--- /dev/null
@@ -0,0 +1,36 @@
+/*  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
+ * 
+ *  libtest
+ *
+ *  Copyright (C) 2012 Data Differential, http://datadifferential.com/
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 3 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+
+#pragma once
+
+#include <arpa/inet.h>
+
+namespace libtest { struct Server; }
+
+namespace libtest {
+
+libtest::Server *build_drizzled(const char *hostname, in_port_t try_port);
+
+bool ping_drizzled(const in_port_t);
+
+}
+
index 969186642cbdaac4b07a5a1956c16307e59e0e14..3a4d85d5b9fec36ae4a8aa4a495399397f692c25 100644 (file)
@@ -33,8 +33,6 @@ static test_return_t _default_callback(void *p)
   return TEST_SUCCESS;
 }
 
-static Runner defualt_runners;
-
 Framework::Framework() :
   collections(NULL),
   _create(NULL),
@@ -56,6 +54,8 @@ Framework::~Framework()
   }
 
   _servers.shutdown();
+
+  delete _runner;
 }
 
 test_return_t Framework::Item::pre(void *arg)
@@ -122,7 +122,7 @@ libtest::Runner *Framework::runner()
 {
   if (_runner == NULL)
   {
-    _runner= &defualt_runners;
+    _runner= new Runner;
   }
   _runner->set_servers(_servers);
 
index 325582f682fbf61a1c32de9530743e101cfefd74..7a33b4df058d383984b8af4f211ded631b635b40 100644 (file)
@@ -122,7 +122,7 @@ public:
 
   bool has_syslog() const
   {
-    return true;
+    return false; //  --syslog.errmsg-enable
   }
 
   bool has_port_option() const
index 59706ad8aaf30e8629f767b40b96272e27dc188f..58c7eb495e4ad67af923fef4272c5105ddce12d1 100644 (file)
@@ -49,6 +49,7 @@ drd:
 EXTRA_DIST+= libtest/run.gdb
 
 CLEANFILES+= \
+            tmp_chroot/var/drizzle/* \
             tmp_chroot/var/log/* \
             tmp_chroot/var/run/* \
             tmp_chroot/var/tmp/*
@@ -73,6 +74,7 @@ noinst_HEADERS+= \
                 libtest/fatal.hpp \
                 libtest/framework.h \
                 libtest/gearmand.h \
+                libtest/drizzled.h \
                 libtest/get.h \
                 libtest/has.hpp \
                 libtest/http.hpp \
@@ -99,34 +101,36 @@ noinst_HEADERS+= \
                 libtest/wait.h
 
 noinst_LTLIBRARIES+= libtest/libtest.la
-libtest_libtest_la_SOURCES= \
-                           libtest/binaries.cc \
-                           libtest/cmdline.cc \
-                           libtest/comparison.cc \
-                           libtest/core.cc \
-                           libtest/cpu.cc \
-                           libtest/dream.cc \
-                           libtest/fatal.cc \
-                           libtest/framework.cc \
-                           libtest/has.cc \
-                           libtest/http.cc \
-                           libtest/is_local.cc \
-                           libtest/killpid.cc \
-                           libtest/libtool.cc \
-                           libtest/port.cc \
-                           libtest/runner.cc \
-                           libtest/server.cc \
-                           libtest/server_container.cc \
-                           libtest/signal.cc \
-                           libtest/socket.cc \
-                           libtest/strerror.cc \
-                           libtest/test.cc \
-                           libtest/tmpfile.cc \
-                           libtest/vchar.cc
 
 libtest_libtest_la_CXXFLAGS=
 libtest_libtest_la_DEPENDENCIES=
 libtest_libtest_la_LIBADD=
+libtest_libtest_la_SOURCES=
+
+libtest_libtest_la_SOURCES+= libtest/binaries.cc 
+libtest_libtest_la_SOURCES+= libtest/cmdline.cc 
+libtest_libtest_la_SOURCES+= libtest/comparison.cc 
+libtest_libtest_la_SOURCES+= libtest/core.cc 
+libtest_libtest_la_SOURCES+= libtest/cpu.cc 
+libtest_libtest_la_SOURCES+= libtest/dream.cc 
+libtest_libtest_la_SOURCES+= libtest/fatal.cc 
+libtest_libtest_la_SOURCES+= libtest/framework.cc 
+libtest_libtest_la_SOURCES+= libtest/has.cc 
+libtest_libtest_la_SOURCES+= libtest/drizzled.cc 
+libtest_libtest_la_SOURCES+= libtest/http.cc 
+libtest_libtest_la_SOURCES+= libtest/is_local.cc 
+libtest_libtest_la_SOURCES+= libtest/killpid.cc 
+libtest_libtest_la_SOURCES+= libtest/libtool.cc 
+libtest_libtest_la_SOURCES+= libtest/main.cc 
+libtest_libtest_la_SOURCES+= libtest/port.cc 
+libtest_libtest_la_SOURCES+= libtest/runner.cc 
+libtest_libtest_la_SOURCES+= libtest/server.cc 
+libtest_libtest_la_SOURCES+= libtest/server_container.cc 
+libtest_libtest_la_SOURCES+= libtest/signal.cc 
+libtest_libtest_la_SOURCES+= libtest/socket.cc 
+libtest_libtest_la_SOURCES+= libtest/strerror.cc 
+libtest_libtest_la_SOURCES+= libtest/tmpfile.cc 
+libtest_libtest_la_SOURCES+= libtest/vchar.cc
 
 libtest_libtest_la_CXXFLAGS+= ${NO_CONVERSION}
 libtest_libtest_la_CXXFLAGS+= -DBUILDING_LIBTEST
@@ -170,6 +174,13 @@ libtest_unittest_CXXFLAGS+= -DHAVE_LIBMEMCACHED=0
 endif
 endif
 
+if HAVE_LIBDRIZZLE
+
+libtest_libtest_la_LIBADD+= $(libdrizzle_LIBS)
+libtest_libtest_la_CXXFLAGS+= $(libdrizzle_CFLAGS)
+
+endif
+
 if BUILDING_GEARMAN
 libtest_libtest_la_DEPENDENCIES+= libgearman/libgearman.la
 libtest_libtest_la_LIBADD+= libgearman/libgearman.la
@@ -192,7 +203,7 @@ libtest_libtest_la_SOURCES+= util/operation.cc
 endif
 endif
 
-libtest_tmp_dir: tmp_chroot/var/log tmp_chroot/var/tmp tmp_chroot/var/run
+libtest_tmp_dir: tmp_chroot/var/log tmp_chroot/var/tmp tmp_chroot/var/run tmp_chroot/var/drizzle
 
 tmp_chroot:
        @$(mkdir_p) tmp_chroot
@@ -206,6 +217,9 @@ tmp_chroot/var/log: tmp_chroot/var
 tmp_chroot/var/tmp: tmp_chroot/var
        @$(mkdir_p) tmp_chroot/var/tmp
 
+tmp_chroot/var/drizzle: tmp_chroot/var
+       @$(mkdir_p) tmp_chroot/var/drizzle
+
 tmp_chroot/var/run: tmp_chroot/var
        @$(mkdir_p) tmp_chroot/var/run
 
diff --git a/libtest/main.cc b/libtest/main.cc
new file mode 100644 (file)
index 0000000..ef10028
--- /dev/null
@@ -0,0 +1,479 @@
+/*  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
+ * 
+ *  libtest
+ *
+ *  Copyright (C) 2011 Data Differential, http://datadifferential.com/
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 3 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include <config.h>
+#include <libtest/common.h>
+
+#include <cassert>
+#include <cstdlib>
+#include <cstring>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
+#include <unistd.h>
+#include <ctime>
+#include <fnmatch.h>
+#include <iostream>
+
+#include <signal.h>
+
+#ifndef __INTEL_COMPILER
+#pragma GCC diagnostic ignored "-Wold-style-cast"
+#endif
+
+using namespace libtest;
+
+static void stats_print(Stats *stats)
+{
+  if (stats->collection_failed == 0 and stats->collection_success == 0)
+  {
+    return;
+  }
+
+  Out << "\tTotal Collections\t\t\t\t" << stats->collection_total;
+  Out << "\tFailed Collections\t\t\t\t" << stats->collection_failed;
+  Out << "\tSkipped Collections\t\t\t\t" << stats->collection_skipped;
+  Out << "\tSucceeded Collections\t\t\t\t" << stats->collection_success;
+  Outn();
+  Out << "Total\t\t\t\t" << stats->total;
+  Out << "\tFailed\t\t\t" << stats->failed;
+  Out << "\tSkipped\t\t\t" << stats->skipped;
+  Out << "\tSucceeded\t\t" << stats->success;
+}
+
+static long int timedif(struct timeval a, struct timeval b)
+{
+  long us, s;
+
+  us = (long)(a.tv_usec - b.tv_usec);
+  us /= 1000;
+  s = (long)(a.tv_sec - b.tv_sec);
+  s *= 1000;
+  return s + us;
+}
+
+#include <getopt.h>
+#include <unistd.h>
+
+int main(int argc, char *argv[])
+{
+  bool opt_massive= false;
+  unsigned long int opt_repeat= 1; // Run all tests once
+  bool opt_quiet= false;
+  std::string collection_to_run;
+
+  // Options parsing
+  {
+    enum long_option_t {
+      OPT_LIBYATL_VERSION,
+      OPT_LIBYATL_MATCH_COLLECTION,
+      OPT_LIBYATL_MASSIVE,
+      OPT_LIBYATL_QUIET,
+      OPT_LIBYATL_REPEAT
+    };
+
+    static struct option long_options[]=
+    {
+      { "version", no_argument, NULL, OPT_LIBYATL_VERSION },
+      { "quiet", no_argument, NULL, OPT_LIBYATL_QUIET },
+      { "repeat", no_argument, NULL, OPT_LIBYATL_REPEAT },
+      { "collection", required_argument, NULL, OPT_LIBYATL_MATCH_COLLECTION },
+      { "massive", no_argument, NULL, OPT_LIBYATL_MASSIVE },
+      { 0, 0, 0, 0 }
+    };
+
+    int option_index= 0;
+    while (1)
+    {
+      int option_rv= getopt_long(argc, argv, "", long_options, &option_index);
+      if (option_rv == -1)
+      {
+        break;
+      }
+
+      switch (option_rv)
+      {
+      case OPT_LIBYATL_VERSION:
+        break;
+
+      case OPT_LIBYATL_QUIET:
+        opt_quiet= true;
+        break;
+
+      case OPT_LIBYATL_REPEAT:
+        opt_repeat= strtoul(optarg, (char **) NULL, 10);
+        break;
+
+      case OPT_LIBYATL_MATCH_COLLECTION:
+        collection_to_run= optarg;
+        break;
+
+      case OPT_LIBYATL_MASSIVE:
+        opt_massive= true;
+        break;
+
+      case '?':
+        /* getopt_long already printed an error message. */
+        Error << "unknown option to getopt_long()";
+        exit(EXIT_FAILURE);
+
+      default:
+        break;
+      }
+    }
+  }
+
+  srandom((unsigned int)time(NULL));
+
+  if (bool(getenv("YATL_REPEAT")) and (strtoul(getenv("YATL_REPEAT"), (char **) NULL, 10) > 1))
+  {
+    opt_repeat= strtoul(getenv("YATL_REPEAT"), (char **) NULL, 10);
+  }
+
+  if ((bool(getenv("YATL_QUIET")) and (strcmp(getenv("YATL_QUIET"), "0") == 0)) or opt_quiet)
+  {
+    opt_quiet= true;
+  }
+  else if (getenv("JENKINS_URL"))
+  {
+    if (bool(getenv("YATL_QUIET")) and (strcmp(getenv("YATL_QUIET"), "1") == 0))
+    { }
+    else
+    {
+      opt_quiet= true;
+    }
+  }
+
+  if (opt_quiet)
+  {
+    close(STDOUT_FILENO);
+  }
+
+  char buffer[1024];
+  if (getenv("LIBTEST_TMP"))
+  {
+    snprintf(buffer, sizeof(buffer), "%s", getenv("LIBTEST_TMP"));
+  }
+  else
+  {
+    snprintf(buffer, sizeof(buffer), "%s", LIBTEST_TEMP);
+  }
+
+  if (chdir(buffer) == -1)
+  {
+    char getcwd_buffer[1024];
+    char *dir= getcwd(getcwd_buffer, sizeof(getcwd_buffer));
+
+    Error << "Unable to chdir() from " << dir << " to " << buffer << " errno:" << strerror(errno);
+    return EXIT_FAILURE;
+  }
+
+  if (libtest::libtool() == NULL)
+  {
+    Error << "Failed to locate libtool";
+    return EXIT_FAILURE;
+  }
+
+  int exit_code;
+
+  try {
+    do {
+      exit_code= EXIT_SUCCESS;
+      Framework world;
+
+      fatal_assert(sigignore(SIGPIPE) == 0);
+
+      libtest::SignalThread signal;
+      if (signal.setup() == false)
+      {
+        Error << "Failed to setup signals";
+        return EXIT_FAILURE;
+      }
+
+      Stats stats;
+
+      get_world(&world);
+
+      test_return_t error;
+      void *creators_ptr= world.create(error);
+
+      switch (error)
+      {
+      case TEST_SUCCESS:
+        break;
+
+      case TEST_SKIPPED:
+        Out << "SKIP " << argv[0];
+        return EXIT_SUCCESS;
+
+      case TEST_FAILURE:
+        return EXIT_FAILURE;
+      }
+
+      if (getenv("YATL_COLLECTION_TO_RUN"))
+      {
+        if (strlen(getenv("YATL_COLLECTION_TO_RUN")))
+        {
+          collection_to_run= getenv("YATL_COLLECTION_TO_RUN");
+        }
+      }
+
+      if (collection_to_run.compare("none") == 0)
+      {
+        return EXIT_SUCCESS;
+      }
+
+      if (collection_to_run.empty() == false)
+      {
+        Out << "Only testing " <<  collection_to_run;
+      }
+
+      char *wildcard= NULL;
+      if (argc == 3)
+      {
+        wildcard= argv[2];
+      }
+
+      for (collection_st *next= world.collections; next and next->name and (not signal.is_shutdown()); next++)
+      {
+        bool failed= false;
+        bool skipped= false;
+
+        if (collection_to_run.empty() == false and fnmatch(collection_to_run.c_str(), next->name, 0))
+        {
+          continue;
+        }
+
+        stats.collection_total++;
+
+        test_return_t collection_rc= world.startup(creators_ptr);
+
+        if (collection_rc == TEST_SUCCESS and next->pre)
+        {
+          collection_rc= world.runner()->pre(next->pre, creators_ptr);
+        }
+
+        switch (collection_rc)
+        {
+        case TEST_SUCCESS:
+          break;
+
+        case TEST_FAILURE:
+          Out << next->name << " [ failed ]";
+          failed= true;
+          signal.set_shutdown(SHUTDOWN_GRACEFUL);
+          goto cleanup;
+
+        case TEST_SKIPPED:
+          Out << next->name << " [ skipping ]";
+          skipped= true;
+          goto cleanup;
+
+        default:
+          fatal_message("invalid return code");
+        }
+
+        Out << "Collection: " << next->name;
+
+        for (test_st *run= next->tests; run->name; run++)
+        {
+          struct timeval start_time, end_time;
+          long int load_time= 0;
+
+          if (wildcard && fnmatch(wildcard, run->name, 0))
+          {
+            continue;
+          }
+
+          test_return_t return_code;
+          try {
+            if (test_success(return_code= world.item.startup(creators_ptr)))
+            {
+              if (test_success(return_code= world.item.flush(creators_ptr, run)))
+              {
+                // @note pre will fail is SKIPPED is returned
+                if (test_success(return_code= world.item.pre(creators_ptr)))
+                {
+                  { // Runner Code
+                    gettimeofday(&start_time, NULL);
+                    assert(world.runner());
+                    assert(run->test_fn);
+                    try 
+                    {
+                      return_code= world.runner()->run(run->test_fn, creators_ptr);
+                    }
+                    // Special case where check for the testing of the exception
+                    // system.
+                    catch (libtest::fatal &e)
+                    {
+                      if (fatal::is_disabled())
+                      {
+                        fatal::increment_disabled_counter();
+                        return_code= TEST_SUCCESS;
+                      }
+                      else
+                      {
+                        throw;
+                      }
+                    }
+
+                    gettimeofday(&end_time, NULL);
+                    load_time= timedif(end_time, start_time);
+                  }
+                }
+
+                // @todo do something if post fails
+                (void)world.item.post(creators_ptr);
+              }
+              else if (return_code == TEST_SKIPPED)
+              { }
+              else if (return_code == TEST_FAILURE)
+              {
+                Error << " item.flush(failure)";
+                signal.set_shutdown(SHUTDOWN_GRACEFUL);
+              }
+            }
+            else if (return_code == TEST_SKIPPED)
+            { }
+            else if (return_code == TEST_FAILURE)
+            {
+              Error << " item.startup(failure)";
+              signal.set_shutdown(SHUTDOWN_GRACEFUL);
+            }
+          }
+
+          catch (libtest::fatal &e)
+          {
+            Error << "Fatal exception was thrown: " << e.what();
+            return_code= TEST_FAILURE;
+          }
+          catch (std::exception &e)
+          {
+            Error << "Exception was thrown: " << e.what();
+            return_code= TEST_FAILURE;
+          }
+          catch (...)
+          {
+            Error << "Unknown exception occurred";
+            return_code= TEST_FAILURE;
+          }
+
+          stats.total++;
+
+          switch (return_code)
+          {
+          case TEST_SUCCESS:
+            Out << "\tTesting " << run->name <<  "\t\t\t\t\t" << load_time / 1000 << "." << load_time % 1000 << "[ " << test_strerror(return_code) << " ]";
+            stats.success++;
+            break;
+
+          case TEST_FAILURE:
+            stats.failed++;
+            failed= true;
+            Out << "\tTesting " << run->name <<  "\t\t\t\t\t" << "[ " << test_strerror(return_code) << " ]";
+            break;
+
+          case TEST_SKIPPED:
+            stats.skipped++;
+            skipped= true;
+            Out << "\tTesting " << run->name <<  "\t\t\t\t\t" << "[ " << test_strerror(return_code) << " ]";
+            break;
+
+          default:
+            fatal_message("invalid return code");
+          }
+
+          if (test_failed(world.on_error(return_code, creators_ptr)))
+          {
+            Error << "Failed while running on_error()";
+            signal.set_shutdown(SHUTDOWN_GRACEFUL);
+            break;
+          }
+        }
+
+        (void) world.runner()->post(next->post, creators_ptr);
+
+cleanup:
+        if (failed == false and skipped == false)
+        {
+          stats.collection_success++;
+        }
+
+        if (failed)
+        {
+          stats.collection_failed++;
+        }
+
+        if (skipped)
+        {
+          stats.collection_skipped++;
+        }
+
+        world.shutdown(creators_ptr);
+        Outn();
+      }
+
+      if (not signal.is_shutdown())
+      {
+        signal.set_shutdown(SHUTDOWN_GRACEFUL);
+      }
+
+      shutdown_t status= signal.get_shutdown();
+      if (status == SHUTDOWN_FORCED)
+      {
+        Out << "Tests were aborted.";
+        exit_code= EXIT_FAILURE;
+      }
+      else if (stats.collection_failed)
+      {
+        Out << "Some test failed.";
+        exit_code= EXIT_FAILURE;
+      }
+      else if (stats.collection_skipped and stats.collection_failed and stats.collection_success)
+      {
+        Out << "Some tests were skipped.";
+      }
+      else if (stats.collection_success and stats.collection_failed == 0)
+      {
+        Out << "All tests completed successfully.";
+      }
+
+      stats_print(&stats);
+
+      Outn(); // Generate a blank to break up the messages if make check/test has been run
+    } while (exit_code == EXIT_SUCCESS and --opt_repeat);
+  }
+  catch (libtest::fatal& e)
+  {
+    std::cerr << e.what() << std::endl;
+  }
+  catch (std::exception& e)
+  {
+    std::cerr << e.what() << std::endl;
+  }
+  catch (...)
+  {
+    std::cerr << "Unknown exception halted execution." << std::endl;
+  }
+
+  return exit_code;
+}
index 99a9eeb960eb0614f90838bd90c02084e598a5a0..41da231cf1ef3c25c73beb4919f8a05a2219bcf7 100644 (file)
@@ -201,6 +201,7 @@ bool Server::start()
       {
         if (_app.check())
         {
+          _app.slurp();
           continue;
         }
 
@@ -254,14 +255,18 @@ bool Server::start()
       }
 
       throw libtest::fatal(LIBYATL_DEFAULT_PARAM, 
-                           "Failed to ping(), waited: %u server started, having pid_file. exec: %s stderr:%s",
+                           "Failed native ping(), pid: %d is alive: %s waited: %u server started, having pid_file. exec: %s stderr:%s",
+                           int(_app.pid()),
+                           _app.check() ? "true" : "false",
                            this_wait, _running.c_str(), 
                            _app.stderr_c_str());
     }
     else
     {
       throw libtest::fatal(LIBYATL_DEFAULT_PARAM,
-                           "Failed to ping(), waited: %u server started. exec: %s stderr:%s",
+                           "Failed native ping(), pid: %d is alive: %s waited: %u server started. exec: %s stderr:%s",
+                           int(_app.pid()),
+                           _app.check() ? "true" : "false",
                            this_wait,
                            _running.c_str(),
                            _app.stderr_c_str());
@@ -371,7 +376,7 @@ bool Server::args(Application& app)
 {
 
   // Set a log file if it was requested (and we can)
-  if (false and has_log_file_option())
+  if (has_log_file_option())
   {
     set_log_file();
     log_file_option(app, _log_file);
index b63cfbb4de6787719081091687ad788834086289..4fdfd4140894a39855f160178a570e0f7be343a5 100644 (file)
@@ -179,6 +179,16 @@ bool server_startup(server_startup_st& construct, const std::string& server_type
       }
     }
   }
+  else if (server_type.compare("drizzled") == 0)
+  {
+    if (DRIZZLED_BINARY)
+    {
+      if (HAVE_LIBDRIZZLE)
+      {
+        server= build_drizzled("localhost", try_port);
+      }
+    }
+  }
   else if (server_type.compare("blobslap_worker") == 0)
   {
     if (GEARMAND_BINARY)
diff --git a/libtest/test.cc b/libtest/test.cc
deleted file mode 100644 (file)
index ef10028..0000000
+++ /dev/null
@@ -1,479 +0,0 @@
-/*  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
- * 
- *  libtest
- *
- *  Copyright (C) 2011 Data Differential, http://datadifferential.com/
- *
- *  This library is free software; you can redistribute it and/or
- *  modify it under the terms of the GNU Lesser General Public
- *  License as published by the Free Software Foundation; either
- *  version 3 of the License, or (at your option) any later version.
- *
- *  This library is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *  Lesser General Public License for more details.
- *
- *  You should have received a copy of the GNU Lesser General Public
- *  License along with this library; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- */
-
-#include <config.h>
-#include <libtest/common.h>
-
-#include <cassert>
-#include <cstdlib>
-#include <cstring>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/wait.h>
-#include <unistd.h>
-#include <ctime>
-#include <fnmatch.h>
-#include <iostream>
-
-#include <signal.h>
-
-#ifndef __INTEL_COMPILER
-#pragma GCC diagnostic ignored "-Wold-style-cast"
-#endif
-
-using namespace libtest;
-
-static void stats_print(Stats *stats)
-{
-  if (stats->collection_failed == 0 and stats->collection_success == 0)
-  {
-    return;
-  }
-
-  Out << "\tTotal Collections\t\t\t\t" << stats->collection_total;
-  Out << "\tFailed Collections\t\t\t\t" << stats->collection_failed;
-  Out << "\tSkipped Collections\t\t\t\t" << stats->collection_skipped;
-  Out << "\tSucceeded Collections\t\t\t\t" << stats->collection_success;
-  Outn();
-  Out << "Total\t\t\t\t" << stats->total;
-  Out << "\tFailed\t\t\t" << stats->failed;
-  Out << "\tSkipped\t\t\t" << stats->skipped;
-  Out << "\tSucceeded\t\t" << stats->success;
-}
-
-static long int timedif(struct timeval a, struct timeval b)
-{
-  long us, s;
-
-  us = (long)(a.tv_usec - b.tv_usec);
-  us /= 1000;
-  s = (long)(a.tv_sec - b.tv_sec);
-  s *= 1000;
-  return s + us;
-}
-
-#include <getopt.h>
-#include <unistd.h>
-
-int main(int argc, char *argv[])
-{
-  bool opt_massive= false;
-  unsigned long int opt_repeat= 1; // Run all tests once
-  bool opt_quiet= false;
-  std::string collection_to_run;
-
-  // Options parsing
-  {
-    enum long_option_t {
-      OPT_LIBYATL_VERSION,
-      OPT_LIBYATL_MATCH_COLLECTION,
-      OPT_LIBYATL_MASSIVE,
-      OPT_LIBYATL_QUIET,
-      OPT_LIBYATL_REPEAT
-    };
-
-    static struct option long_options[]=
-    {
-      { "version", no_argument, NULL, OPT_LIBYATL_VERSION },
-      { "quiet", no_argument, NULL, OPT_LIBYATL_QUIET },
-      { "repeat", no_argument, NULL, OPT_LIBYATL_REPEAT },
-      { "collection", required_argument, NULL, OPT_LIBYATL_MATCH_COLLECTION },
-      { "massive", no_argument, NULL, OPT_LIBYATL_MASSIVE },
-      { 0, 0, 0, 0 }
-    };
-
-    int option_index= 0;
-    while (1)
-    {
-      int option_rv= getopt_long(argc, argv, "", long_options, &option_index);
-      if (option_rv == -1)
-      {
-        break;
-      }
-
-      switch (option_rv)
-      {
-      case OPT_LIBYATL_VERSION:
-        break;
-
-      case OPT_LIBYATL_QUIET:
-        opt_quiet= true;
-        break;
-
-      case OPT_LIBYATL_REPEAT:
-        opt_repeat= strtoul(optarg, (char **) NULL, 10);
-        break;
-
-      case OPT_LIBYATL_MATCH_COLLECTION:
-        collection_to_run= optarg;
-        break;
-
-      case OPT_LIBYATL_MASSIVE:
-        opt_massive= true;
-        break;
-
-      case '?':
-        /* getopt_long already printed an error message. */
-        Error << "unknown option to getopt_long()";
-        exit(EXIT_FAILURE);
-
-      default:
-        break;
-      }
-    }
-  }
-
-  srandom((unsigned int)time(NULL));
-
-  if (bool(getenv("YATL_REPEAT")) and (strtoul(getenv("YATL_REPEAT"), (char **) NULL, 10) > 1))
-  {
-    opt_repeat= strtoul(getenv("YATL_REPEAT"), (char **) NULL, 10);
-  }
-
-  if ((bool(getenv("YATL_QUIET")) and (strcmp(getenv("YATL_QUIET"), "0") == 0)) or opt_quiet)
-  {
-    opt_quiet= true;
-  }
-  else if (getenv("JENKINS_URL"))
-  {
-    if (bool(getenv("YATL_QUIET")) and (strcmp(getenv("YATL_QUIET"), "1") == 0))
-    { }
-    else
-    {
-      opt_quiet= true;
-    }
-  }
-
-  if (opt_quiet)
-  {
-    close(STDOUT_FILENO);
-  }
-
-  char buffer[1024];
-  if (getenv("LIBTEST_TMP"))
-  {
-    snprintf(buffer, sizeof(buffer), "%s", getenv("LIBTEST_TMP"));
-  }
-  else
-  {
-    snprintf(buffer, sizeof(buffer), "%s", LIBTEST_TEMP);
-  }
-
-  if (chdir(buffer) == -1)
-  {
-    char getcwd_buffer[1024];
-    char *dir= getcwd(getcwd_buffer, sizeof(getcwd_buffer));
-
-    Error << "Unable to chdir() from " << dir << " to " << buffer << " errno:" << strerror(errno);
-    return EXIT_FAILURE;
-  }
-
-  if (libtest::libtool() == NULL)
-  {
-    Error << "Failed to locate libtool";
-    return EXIT_FAILURE;
-  }
-
-  int exit_code;
-
-  try {
-    do {
-      exit_code= EXIT_SUCCESS;
-      Framework world;
-
-      fatal_assert(sigignore(SIGPIPE) == 0);
-
-      libtest::SignalThread signal;
-      if (signal.setup() == false)
-      {
-        Error << "Failed to setup signals";
-        return EXIT_FAILURE;
-      }
-
-      Stats stats;
-
-      get_world(&world);
-
-      test_return_t error;
-      void *creators_ptr= world.create(error);
-
-      switch (error)
-      {
-      case TEST_SUCCESS:
-        break;
-
-      case TEST_SKIPPED:
-        Out << "SKIP " << argv[0];
-        return EXIT_SUCCESS;
-
-      case TEST_FAILURE:
-        return EXIT_FAILURE;
-      }
-
-      if (getenv("YATL_COLLECTION_TO_RUN"))
-      {
-        if (strlen(getenv("YATL_COLLECTION_TO_RUN")))
-        {
-          collection_to_run= getenv("YATL_COLLECTION_TO_RUN");
-        }
-      }
-
-      if (collection_to_run.compare("none") == 0)
-      {
-        return EXIT_SUCCESS;
-      }
-
-      if (collection_to_run.empty() == false)
-      {
-        Out << "Only testing " <<  collection_to_run;
-      }
-
-      char *wildcard= NULL;
-      if (argc == 3)
-      {
-        wildcard= argv[2];
-      }
-
-      for (collection_st *next= world.collections; next and next->name and (not signal.is_shutdown()); next++)
-      {
-        bool failed= false;
-        bool skipped= false;
-
-        if (collection_to_run.empty() == false and fnmatch(collection_to_run.c_str(), next->name, 0))
-        {
-          continue;
-        }
-
-        stats.collection_total++;
-
-        test_return_t collection_rc= world.startup(creators_ptr);
-
-        if (collection_rc == TEST_SUCCESS and next->pre)
-        {
-          collection_rc= world.runner()->pre(next->pre, creators_ptr);
-        }
-
-        switch (collection_rc)
-        {
-        case TEST_SUCCESS:
-          break;
-
-        case TEST_FAILURE:
-          Out << next->name << " [ failed ]";
-          failed= true;
-          signal.set_shutdown(SHUTDOWN_GRACEFUL);
-          goto cleanup;
-
-        case TEST_SKIPPED:
-          Out << next->name << " [ skipping ]";
-          skipped= true;
-          goto cleanup;
-
-        default:
-          fatal_message("invalid return code");
-        }
-
-        Out << "Collection: " << next->name;
-
-        for (test_st *run= next->tests; run->name; run++)
-        {
-          struct timeval start_time, end_time;
-          long int load_time= 0;
-
-          if (wildcard && fnmatch(wildcard, run->name, 0))
-          {
-            continue;
-          }
-
-          test_return_t return_code;
-          try {
-            if (test_success(return_code= world.item.startup(creators_ptr)))
-            {
-              if (test_success(return_code= world.item.flush(creators_ptr, run)))
-              {
-                // @note pre will fail is SKIPPED is returned
-                if (test_success(return_code= world.item.pre(creators_ptr)))
-                {
-                  { // Runner Code
-                    gettimeofday(&start_time, NULL);
-                    assert(world.runner());
-                    assert(run->test_fn);
-                    try 
-                    {
-                      return_code= world.runner()->run(run->test_fn, creators_ptr);
-                    }
-                    // Special case where check for the testing of the exception
-                    // system.
-                    catch (libtest::fatal &e)
-                    {
-                      if (fatal::is_disabled())
-                      {
-                        fatal::increment_disabled_counter();
-                        return_code= TEST_SUCCESS;
-                      }
-                      else
-                      {
-                        throw;
-                      }
-                    }
-
-                    gettimeofday(&end_time, NULL);
-                    load_time= timedif(end_time, start_time);
-                  }
-                }
-
-                // @todo do something if post fails
-                (void)world.item.post(creators_ptr);
-              }
-              else if (return_code == TEST_SKIPPED)
-              { }
-              else if (return_code == TEST_FAILURE)
-              {
-                Error << " item.flush(failure)";
-                signal.set_shutdown(SHUTDOWN_GRACEFUL);
-              }
-            }
-            else if (return_code == TEST_SKIPPED)
-            { }
-            else if (return_code == TEST_FAILURE)
-            {
-              Error << " item.startup(failure)";
-              signal.set_shutdown(SHUTDOWN_GRACEFUL);
-            }
-          }
-
-          catch (libtest::fatal &e)
-          {
-            Error << "Fatal exception was thrown: " << e.what();
-            return_code= TEST_FAILURE;
-          }
-          catch (std::exception &e)
-          {
-            Error << "Exception was thrown: " << e.what();
-            return_code= TEST_FAILURE;
-          }
-          catch (...)
-          {
-            Error << "Unknown exception occurred";
-            return_code= TEST_FAILURE;
-          }
-
-          stats.total++;
-
-          switch (return_code)
-          {
-          case TEST_SUCCESS:
-            Out << "\tTesting " << run->name <<  "\t\t\t\t\t" << load_time / 1000 << "." << load_time % 1000 << "[ " << test_strerror(return_code) << " ]";
-            stats.success++;
-            break;
-
-          case TEST_FAILURE:
-            stats.failed++;
-            failed= true;
-            Out << "\tTesting " << run->name <<  "\t\t\t\t\t" << "[ " << test_strerror(return_code) << " ]";
-            break;
-
-          case TEST_SKIPPED:
-            stats.skipped++;
-            skipped= true;
-            Out << "\tTesting " << run->name <<  "\t\t\t\t\t" << "[ " << test_strerror(return_code) << " ]";
-            break;
-
-          default:
-            fatal_message("invalid return code");
-          }
-
-          if (test_failed(world.on_error(return_code, creators_ptr)))
-          {
-            Error << "Failed while running on_error()";
-            signal.set_shutdown(SHUTDOWN_GRACEFUL);
-            break;
-          }
-        }
-
-        (void) world.runner()->post(next->post, creators_ptr);
-
-cleanup:
-        if (failed == false and skipped == false)
-        {
-          stats.collection_success++;
-        }
-
-        if (failed)
-        {
-          stats.collection_failed++;
-        }
-
-        if (skipped)
-        {
-          stats.collection_skipped++;
-        }
-
-        world.shutdown(creators_ptr);
-        Outn();
-      }
-
-      if (not signal.is_shutdown())
-      {
-        signal.set_shutdown(SHUTDOWN_GRACEFUL);
-      }
-
-      shutdown_t status= signal.get_shutdown();
-      if (status == SHUTDOWN_FORCED)
-      {
-        Out << "Tests were aborted.";
-        exit_code= EXIT_FAILURE;
-      }
-      else if (stats.collection_failed)
-      {
-        Out << "Some test failed.";
-        exit_code= EXIT_FAILURE;
-      }
-      else if (stats.collection_skipped and stats.collection_failed and stats.collection_success)
-      {
-        Out << "Some tests were skipped.";
-      }
-      else if (stats.collection_success and stats.collection_failed == 0)
-      {
-        Out << "All tests completed successfully.";
-      }
-
-      stats_print(&stats);
-
-      Outn(); // Generate a blank to break up the messages if make check/test has been run
-    } while (exit_code == EXIT_SUCCESS and --opt_repeat);
-  }
-  catch (libtest::fatal& e)
-  {
-    std::cerr << e.what() << std::endl;
-  }
-  catch (std::exception& e)
-  {
-    std::cerr << e.what() << std::endl;
-  }
-  catch (...)
-  {
-    std::cerr << "Unknown exception halted execution." << std::endl;
-  }
-
-  return exit_code;
-}
index de3e6f50c3d2f958850dd601438421f451321f72..f884af33483812434df32e002127938b3a863a5a 100644 (file)
@@ -154,6 +154,12 @@ static test_return_t var_log_exists_test(void *)
   return TEST_SUCCESS;
 }
 
+static test_return_t var_drizzle_exists_test(void *)
+{
+  test_compare(0, access("var/drizzle", R_OK | W_OK | X_OK));
+  return TEST_SUCCESS;
+}
+
 static test_return_t var_tmp_test(void *)
 {
   FILE *file= fopen("var/tmp/junk", "w+");
@@ -180,6 +186,14 @@ static test_return_t var_log_test(void *)
   return TEST_SUCCESS;
 }
 
+static test_return_t var_drizzle_test(void *)
+{
+  FILE *file= fopen("var/drizzle/junk", "w+");
+  test_true(file);
+  fclose(file);
+  return TEST_SUCCESS;
+}
+
 static test_return_t var_tmp_rm_test(void *)
 {
   test_true(unlink("var/tmp/junk") == 0);
@@ -198,6 +212,12 @@ static test_return_t var_log_rm_test(void *)
   return TEST_SUCCESS;
 }
 
+static test_return_t var_drizzle_rm_test(void *)
+{
+  test_true(unlink("var/drizzle/junk") == 0);
+  return TEST_SUCCESS;
+}
+
 static test_return_t _compare_test_return_t_test(void *)
 {
   test_compare(TEST_SUCCESS, TEST_SUCCESS);
@@ -225,6 +245,22 @@ static test_return_t _compare_gearman_return_t_test(void *)
   return TEST_SUCCESS;
 }
 
+static test_return_t drizzled_cycle_test(void *object)
+{
+  server_startup_st *servers= (server_startup_st*)object;
+  test_true(servers and servers->validate());
+
+#if defined(HAVE_GEARMAND_BINARY) && HAVE_GEARMAND_BINARY
+  test_true(has_drizzled_binary());
+#endif
+
+  test_skip(true, has_drizzled_binary());
+
+  test_true(server_startup(*servers, "drizzled", get_free_port(), 0, NULL));
+
+  return TEST_SUCCESS;
+}
+
 static test_return_t gearmand_cycle_test(void *object)
 {
   server_startup_st *servers= (server_startup_st*)object;
@@ -384,6 +420,7 @@ static test_return_t application_doesnotexist_BINARY(void *)
 
   test_skip_valgrind();
   Application true_app("doesnotexist");
+  true_app.will_fail();
 
   const char *args[]= { "--fubar", 0 };
 #if defined(TARGET_OS_OSX) && TARGET_OS_OSX
@@ -710,6 +747,18 @@ static test_return_t check_for_gearman(void *)
   return TEST_SUCCESS;
 }
 
+static test_return_t check_for_drizzle(void *)
+{
+  test_skip(true, HAVE_LIBDRIZZLE);
+  test_skip(true, has_drizzled_binary());
+  return TEST_SUCCESS;
+}
+
+
+test_st drizzled_tests[] ={
+  {"drizzled startup-shutdown", 0, drizzled_cycle_test },
+  {0, 0, 0}
+};
 
 test_st gearmand_tests[] ={
 #if 0
@@ -768,12 +817,15 @@ test_st directories_tests[] ={
   {"var/tmp exists", 0, var_tmp_exists_test },
   {"var/run exists", 0, var_run_exists_test },
   {"var/log exists", 0, var_log_exists_test },
+  {"var/drizzle exists", 0, var_drizzle_exists_test },
   {"var/tmp", 0, var_tmp_test },
   {"var/run", 0, var_run_test },
   {"var/log", 0, var_log_test },
+  {"var/drizzle", 0, var_drizzle_test },
   {"var/tmp rm", 0, var_tmp_rm_test },
   {"var/run rm", 0, var_run_rm_test },
   {"var/log rm", 0, var_log_rm_test },
+  {"var/drizzle rm", 0, var_drizzle_rm_test },
   {0, 0, 0}
 };
 
@@ -868,6 +920,7 @@ collection_st collection[] ={
   {"comparison", 0, 0, comparison_tests},
   {"gearmand", check_for_gearman, 0, gearmand_tests},
   {"memcached", check_for_libmemcached, 0, memcached_tests},
+  {"drizzled", check_for_drizzle, 0, drizzled_tests},
   {"cmdline", 0, 0, cmdline_tests},
   {"application", 0, 0, application_tests},
   {"http", check_for_curl, 0, http_tests},
index ccc32f392babb256a574ee629e7d174d3069ff52..4d81ecd4a9c94724f50814d01302991dfe3015b4 100644 (file)
@@ -227,7 +227,7 @@ void get_world(Framework *world)
   world->collection_startup= (test_callback_fn*)world_container_startup;
   world->collection_shutdown= (test_callback_fn*)world_container_shutdown;
 
-  world->set_runner(&defualt_libmemcached_runner);
+  world->set_runner(new LibmemcachedRunner);
 
   global_framework= world;
 }
index 6121e628a2ecf0c1c658c7add6640a2e67a9879b..5e2882c6d9d7109f5e015e315741614701454c0f 100644 (file)
@@ -96,7 +96,7 @@ void get_world(Framework *world)
   world->collection_startup= (test_callback_fn*)world_container_startup;
   world->collection_shutdown= (test_callback_fn*)world_container_shutdown;
 
-  world->set_runner(&defualt_libmemcached_runner);
+  world->set_runner(new LibmemcachedRunner);
 
   world->set_socket();
 }
index b9342cf3ff9e8d3a6b5cd7eec4d218d82ae32a87..6398c1eba41e4852f4677626412090f99638cd3e 100644 (file)
@@ -85,5 +85,5 @@ void get_world(Framework *world)
   world->collection_startup= (test_callback_fn*)world_container_startup;
   world->collection_shutdown= (test_callback_fn*)world_container_shutdown;
 
-  world->set_runner(&defualt_libmemcached_runner);
+  world->set_runner(new LibmemcachedRunner);
 }
index ad4483ed4df87e2f887fb9bb6834c801caadd9f1..23d6dd238cdbedefc8b2cc87f6d4fb48a4913986 100644 (file)
@@ -293,5 +293,5 @@ void get_world(Framework *world)
   world->collection_startup= (test_callback_fn*)world_container_startup;
   world->collection_shutdown= (test_callback_fn*)world_container_shutdown;
 
-  world->set_runner(&defualt_libmemcached_runner);
+  world->set_runner(new LibmemcachedRunner);
 }
index 5078f1f5583cea9c07ab32f5524eec8c3b5ed13c..5b3f7e8855a9318b27f6d01685fab5be70582756 100644 (file)
@@ -300,5 +300,5 @@ void get_world(Framework *world)
   world->collection_startup= reinterpret_cast<test_callback_fn*>(world_container_startup);
   world->collection_shutdown= reinterpret_cast<test_callback_fn*>(world_container_shutdown);
 
-  world->set_runner(&defualt_libmemcached_runner);
+  world->set_runner(new LibmemcachedRunner);
 }
index ee8b5e67166d649be03b3e642236f47e109ac6a2..bbf905d9716bfc5cf4bb232fdaf053dda65920fb 100644 (file)
@@ -115,7 +115,7 @@ void get_world(Framework *world)
   world->collection_startup= (test_callback_fn*)world_container_startup;
   world->collection_shutdown= (test_callback_fn*)world_container_shutdown;
 
-  world->set_runner(&defualt_libmemcached_runner);
+  world->set_runner(new LibmemcachedRunner);
 
   world->set_sasl("memcached", "memcached");
 }
index 34722053b6c500346485a40b2a650e838592dc99..c31b303fa911fae2221670f62fc5847d6fae0eff 100644 (file)
@@ -209,5 +209,3 @@ static bool world_destroy(void *object)
 typedef test_return_t (*libmemcached_test_callback_fn)(memcached_st *);
 
 #include "tests/runner.h"
-
-static LibmemcachedRunner defualt_libmemcached_runner;
index e2ff7e1d17abc6a46a14ea11dfa25ae23eff2f41..8016dba4ad6229dcafaf465d3f2b889ee39a42ba 100644 (file)
@@ -191,5 +191,3 @@ static bool world_destroy(void *object)
 typedef test_return_t (*libmemcached_test_callback_fn)(memcached_st *);
 
 #include "tests/runner.h"
-
-static LibmemcachedRunner defualt_libmemcached_runner;
index 713885fda2e39a3f714d765c5d67dddc77d6a08f..3a97d849c71db8f7e9e7f3fc3d6c8090a27ae0f0 100644 (file)
@@ -580,5 +580,5 @@ void get_world(Framework *world)
   world->collection_startup= (test_callback_fn*)world_container_startup;
   world->collection_shutdown= (test_callback_fn*)world_container_shutdown;
 
-  world->set_runner(&defualt_libmemcached_runner);
+  world->set_runner(new LibmemcachedRunner);
 }