Browse Source

Merge lp:~tangent-org/gearmand/1.2-build/ Build: jenkins-Gearmand-466

Continuous Integration 12 years ago
parent
commit
31e370b7a3
10 changed files with 49 additions and 46 deletions
  1. 1 1
      ChangeLog
  2. 1 0
      configure.ac
  3. 1 1
      libtest/alarm.cc
  4. 20 5
      libtest/cmdline.cc
  5. 4 4
      libtest/cmdline.h
  6. 1 1
      libtest/common.h
  7. 1 1
      libtest/dream.cc
  8. 3 2
      libtest/include.am
  9. 3 30
      libtest/lite.h
  10. 14 1
      libtest/main.cc

+ 1 - 1
ChangeLog

@@ -24,7 +24,7 @@
 1.1.0 Wed Sep  5 08:33:37 PDT 2012
 * Fix for ABI compatibility issues.
 
-1.0.5
+1.0.5 Mon Apr 15 06:36:05 EDT 2013
 * Fix for log_fn
 
 1.0.4 Never Released

+ 1 - 0
configure.ac

@@ -98,6 +98,7 @@ AC_PROG_INSTALL
 AC_PROG_LN_S
 AC_PROG_MAKE_SET
 AX_PROG_SPHINX_BUILD
+AX_PROG_MEMCACHED
 
 # Checks for header files.
 AC_HEADER_STDC

+ 1 - 1
libtest/alarm.cc

@@ -76,7 +76,7 @@ void set_alarm(long tv_sec, long tv_usec)
     }
   }
 
-#if defined(TARGET_OS_OSX) && TARGET_OS_OSX
+#ifdef __APPLE__
   struct timeval it_value= { time_t(tv_sec), suseconds_t(tv_usec) };
 #else
   struct timeval it_value= { tv_sec, tv_usec };

+ 20 - 5
libtest/cmdline.cc

@@ -435,6 +435,7 @@ bool Application::slurp()
 Application::error_t Application::join()
 {
   pid_t waited_pid= waitpid(_pid, &_status, 0);
+  slurp();
   if (waited_pid == _pid and WIFEXITED(_status) == false)
   {
     /*
@@ -449,7 +450,12 @@ Application::error_t Application::join()
       std::string error_string("posix_spawn() failed pid:");
       error_string+= _pid;
       error_string+= " name:";
-      error_string+= _exectuble_name;
+      error_string+= print_argv(built_argv);
+      if (stderr_result_length())
+      {
+        error_string+= " stderr: ";
+        error_string+= stderr_c_str();
+      }
       throw std::logic_error(error_string);
     }
     else if (WIFSIGNALED(_status))
@@ -458,14 +464,22 @@ Application::error_t Application::join()
       {
         slurp();
         _app_exit_state= Application::INVALID_POSIX_SPAWN;
-        std::string error_string(_exectuble_name);
+        std::string error_string(print_argv(built_argv));
         error_string+= " was killed by signal ";
         error_string+= strsignal(WTERMSIG(_status));
-        if (stderr_c_str())
+
+        if (stdout_result_length())
         {
-          error_string+= " stderr:";
+          error_string+= " stdout: ";
+          error_string+= stdout_c_str();
+        }
+
+        if (stderr_result_length())
+        {
+          error_string+= " stderr: ";
           error_string+= stderr_c_str();
         }
+
         throw std::runtime_error(error_string);
       }
 
@@ -606,7 +620,8 @@ bool Application::Pipe::read(libtest::vchar_t& arg)
 void Application::Pipe::nonblock()
 {
   int flags;
-  do {
+  do 
+  {
     flags= fcntl(_pipe_fd[READ], F_GETFL, 0);
   } while (flags == -1 and (errno == EINTR or errno == EAGAIN));
 

+ 4 - 4
libtest/cmdline.h

@@ -146,14 +146,14 @@ public:
     return _stdout_buffer;
   }
 
-  const char* stdout_c_str() const
+  size_t stdout_result_length() const
   {
-    return &_stderr_buffer[0];
+    return _stdout_buffer.size();
   }
 
-  size_t stdout_result_length() const
+  const char* stdout_c_str() const
   {
-    return _stdout_buffer.size();
+    return &_stdout_buffer[0];
   }
 
   libtest::vchar_t stderr_result() const

+ 1 - 1
libtest/common.h

@@ -69,7 +69,7 @@
 # include <arpa/inet.h>
 #endif
 
-#if defined(WIN32) || defined(__MINGW32__)
+#if defined(WIN32)
 # include "win32/wrappers.h"
 # define get_socket_errno() WSAGetLastError()
 #else

+ 1 - 1
libtest/dream.cc

@@ -41,7 +41,7 @@ namespace libtest {
 
 void dream(time_t tv_sec, long tv_nsec)
 {
-#ifdef WIN32
+#if defined(WIN32)
   if (tv_sec == 0 and tv_nsec)
   {
     tv_sec++;

+ 3 - 2
libtest/include.am

@@ -102,6 +102,7 @@ noinst_HEADERS+= libtest/test.hpp
 noinst_HEADERS+= libtest/thread.hpp
 noinst_HEADERS+= libtest/tmpfile.hpp
 noinst_HEADERS+= libtest/lite.h
+noinst_HEADERS+= libtest/valgrind.h
 noinst_HEADERS+= libtest/vchar.hpp
 noinst_HEADERS+= libtest/version.h
 noinst_HEADERS+= libtest/visibility.h
@@ -159,8 +160,8 @@ libtest_libtest_la_LIBADD+= $(CURL_LIBS)
 libtest_libtest_la_LIBADD+= @RT_LIB@
 
 EXTRA_libtest_libtest_la_DEPENDENCIES+= libtest_tmp_dir
-EXTRA_libtest_libtest_la_DEPENDENCIES+=libtest/abort
-EXTRA_libtest_libtest_la_DEPENDENCIES+=libtest/wait
+EXTRA_libtest_libtest_la_DEPENDENCIES+= libtest/abort
+EXTRA_libtest_libtest_la_DEPENDENCIES+= libtest/wait
 
 # Declare unittest so that we can append to it
 libtest_unittest_CXXFLAGS=

+ 3 - 30
libtest/lite.h

@@ -51,11 +51,7 @@
 # include <string.h>
 #endif
 
-#if defined(HAVE_VALGRIND_VALGRIND_H) && HAVE_VALGRIND_VALGRIND_H
-# include <valgrind/valgrind.h>
-#endif
-
-#ifdef _WIN32
+#if defined(WIN32)
 # include <malloc.h>
 #else
 # include <alloca.h>
@@ -81,30 +77,7 @@
 # define SKIP(__message_format, ...)
 #endif
 
-static inline bool valgrind_is_caller(void)
-{
-#if defined(HAVE_VALGRIND_VALGRIND_H) && HAVE_VALGRIND_VALGRIND_H
-  if (RUNNING_ON_VALGRIND)
-  {
-    return true;
-  }
-#endif
-
-  if (getenv("TESTS_ENVIRONMENT")  && strstr(getenv("TESTS_ENVIRONMENT"), "valgrind"))
-  {
-    if (strstr(getenv("TESTS_ENVIRONMENT"), "--tool") == NULL)
-    {
-      return true;
-    }
-
-    if (strstr(getenv("TESTS_ENVIRONMENT"), "--tool=memcheck"))
-    {
-      return true;
-    }
-  }
-
-  return false;
-}
+#include <libtest/valgrind.h>
 
 static inline size_t yatl_strlen(const char *s)
 {
@@ -367,7 +340,7 @@ do \
   } \
 } while (0)
 
-#define ASSERT_NEQ(__expected, __actual, ...) \
+#define ASSERT_NEQ(__expected, __actual) \
 do \
 { \
   if ((__expected) == (__actual)) { \

+ 14 - 1
libtest/main.cc

@@ -158,7 +158,13 @@ int main(int argc, char *argv[])
         break;
 
       case OPT_LIBYATL_REPEAT:
+        errno= 0;
         opt_repeat= strtoul(optarg, (char **) NULL, 10);
+        if (errno != 0)
+        {
+          Error << "unknown value passed to --repeat: `" << optarg << "`";
+          exit(EXIT_FAILURE);
+        }
         break;
 
       case OPT_LIBYATL_MATCH_COLLECTION:
@@ -186,9 +192,16 @@ int main(int argc, char *argv[])
 
   srandom((unsigned int)time(NULL));
 
-  if (bool(getenv("YATL_REPEAT")) and (strtoul(getenv("YATL_REPEAT"), (char **) NULL, 10) > 1))
+  errno= 0;
+  if (bool(getenv("YATL_REPEAT")))
   {
+    errno= 0;
     opt_repeat= strtoul(getenv("YATL_REPEAT"), (char **) NULL, 10);
+    if (errno != 0)
+    {
+      Error << "ENV YATL_REPEAT passed an invalid value: `" << getenv("YATL_REPEAT") << "`";
+      exit(EXIT_FAILURE);
+    }
   }
 
   if ((bool(getenv("YATL_QUIET")) and (strcmp(getenv("YATL_QUIET"), "0") == 0)) or opt_quiet)

Some files were not shown because too many files changed in this diff