Update from libtest
authorBrian Aker <brian@tangent.org>
Mon, 9 Apr 2012 10:23:18 +0000 (03:23 -0700)
committerBrian Aker <brian@tangent.org>
Mon, 9 Apr 2012 10:23:18 +0000 (03:23 -0700)
libtest/fatal.cc
libtest/fatal.hpp
libtest/http.cc
libtest/server.cc

index 4cef2047b5f4c06f0de5a61eca718871b903240d..0114635b0de2dee0f18a0a132c9587e2b51b8c95 100644 (file)
@@ -45,12 +45,12 @@ bool fatal::is_disabled()
   return _disabled;
 }
 
-bool fatal::disable()
+void fatal::disable()
 {
   _disabled= true;
 }
 
-bool fatal::enable()
+void fatal::enable()
 {
   _disabled= false;
 }
index c1c2b6838fbf929d6d0826e569c857fc8455629b..77050e517b4842a2fe445e129a54a5b6d3463995 100644 (file)
@@ -43,8 +43,8 @@ public:
 
   // The following are just for unittesting the exception class
   static bool is_disabled();
-  static bool disable();
-  static bool enable();
+  static void disable();
+  static void enable();
   static uint32_t disabled_counter();
   static void increment_disabled_counter();
 
index 920fd021d647f34d1a01d257adcecad100b5b892..8c36371d0827529aab2db90c5155e2908fc8a97c 100644 (file)
@@ -56,7 +56,7 @@ static pthread_once_t start_key_once= PTHREAD_ONCE_INIT;
 void initialize_curl(void)
 {
   int ret;
-  if (pthread_once(&start_key_once, initialize_curl_startup) != 0)
+  if ((ret= pthread_once(&start_key_once, initialize_curl_startup)) != 0)
   {
     fatal_message(strerror(ret));
   }
@@ -70,8 +70,6 @@ namespace http {
 extern "C" size_t
   http_get_result_callback(void *ptr, size_t size, size_t nmemb, void *data)
   {
-    size_t body_size= size * nmemb;
-
     vchar_t *_body= (vchar_t*)data;
 
     _body->resize(size * nmemb);
@@ -102,6 +100,8 @@ HTTP::HTTP(const std::string& url_arg) :
 
 bool GET::execute()
 {
+  (void)init;
+
   if (HAVE_LIBCURL)
   {
 #if defined(HAVE_LIBCURL) && HAVE_LIBCURL
index 6ff6fc3a3a24a50a3377f8640d9d332783de529c..99a9eeb960eb0614f90838bd90c02084e598a5a0 100644 (file)
@@ -205,17 +205,17 @@ bool Server::start()
         }
 
         char buf[PATH_MAX];
-        getcwd(buf, sizeof(buf));
+        char *getcwd_buf= getcwd(buf, sizeof(buf));
         throw libtest::fatal(LIBYATL_DEFAULT_PARAM,
                              "Unable to open pidfile in %s for: %s stderr:%s",
-                             buf,
+                             getcwd_buf ? getcwd_buf : "",
                              _running.c_str(),
                              _app.stderr_c_str());
       }
     }
   }
 
-  uint32_t this_wait;
+  uint32_t this_wait= 0;
   bool pinged= false;
   {
     uint32_t timeout= 20; // This number should be high enough for valgrind startup (which is slow)
@@ -247,7 +247,8 @@ bool Server::start()
       if (kill_file(pid_file()) == false)
       {
         throw libtest::fatal(LIBYATL_DEFAULT_PARAM,
-                             "Failed to kill off server after startup occurred, when pinging failed: %s stderr:%s",
+                             "Failed to kill off server, waited: %u after startup occurred, when pinging failed: %s stderr:%s",
+                             this_wait,
                              pid_file().c_str(),
                              _app.stderr_c_str());
       }
@@ -260,7 +261,8 @@ bool Server::start()
     else
     {
       throw libtest::fatal(LIBYATL_DEFAULT_PARAM,
-                           "Failed to ping() server started. exec: %s stderr:%s",
+                           "Failed to ping(), waited: %u server started. exec: %s stderr:%s",
+                           this_wait,
                            _running.c_str(),
                            _app.stderr_c_str());
     }