First pass on sync with gearman yatl.
[awesomized/libmemcached] / libtest / main.cc
index d6c4ecbfa59e82c25cbda5802905c291c0632826..6231ba121f8d47a06af10f07c03f65e70ca415f5 100644 (file)
@@ -34,7 +34,7 @@
  *
  */
 
-#include <config.h>
+#include "libtest/yatlcon.h"
 #include <libtest/common.h>
 
 #include <cassert>
@@ -220,22 +220,24 @@ int main(int argc, char *argv[])
     is_massive(opt_massive);
   }
 
-  char tmp_directory[1024];
+  libtest::vchar_t tmp_directory;
+  tmp_directory.resize(1024);
   if (getenv("LIBTEST_TMP"))
   {
-    snprintf(tmp_directory, sizeof(tmp_directory), "%s", getenv("LIBTEST_TMP"));
+    snprintf(&tmp_directory[0], tmp_directory.size(), "%s", getenv("LIBTEST_TMP"));
   }
   else
   {
-    snprintf(tmp_directory, sizeof(tmp_directory), "%s", LIBTEST_TEMP);
+    snprintf(&tmp_directory[0], tmp_directory.size(), "%s", LIBTEST_TEMP);
   }
 
-  if (chdir(tmp_directory) == -1)
+  if (chdir(&tmp_directory[0]) == -1)
   {
-    char getcwd_buffer[1024];
-    char *dir= getcwd(getcwd_buffer, sizeof(getcwd_buffer));
+    libtest::vchar_t getcwd_buffer;
+    getcwd_buffer.resize(1024);
+    char *dir= getcwd(&getcwd_buffer[0], getcwd_buffer.size());
 
-    Error << "Unable to chdir() from " << dir << " to " << tmp_directory << " errno:" << strerror(errno);
+    Error << "Unable to chdir() from " << dir << " to " << &tmp_directory[0] << " errno:" << strerror(errno);
     return EXIT_FAILURE;
   }
 
@@ -292,7 +294,7 @@ int main(int argc, char *argv[])
           return EXIT_SKIP;
 
         case TEST_FAILURE:
-          std::cerr << __FILE__ << ":" <<  __LINE__ << ": " << "frame->create()" << std::endl;
+          std::cerr << "Could not call frame->create()" << std::endl;
           return EXIT_FAILURE;
         }
       }
@@ -329,7 +331,7 @@ int main(int argc, char *argv[])
 
       std::ofstream xml_file;
       std::string file_name;
-      file_name.append(tmp_directory);
+      file_name.append(&tmp_directory[0]);
       file_name.append(frame->name());
       file_name.append(".xml");
       xml_file.open(file_name.c_str(), std::ios::trunc);
@@ -340,27 +342,27 @@ int main(int argc, char *argv[])
   }
   catch (libtest::fatal& e)
   {
-    std::cerr << __FILE__ << ":" <<  __LINE__ << ": " << "FATAL:" << e.what() << std::endl;
+    std::cerr << "FATAL:" << e.what() << std::endl;
     exit_code= EXIT_FAILURE;
   }
   catch (libtest::disconnected& e)
   {
-    std::cerr << __FILE__ << ":" <<  __LINE__ << ": " << "Unhandled disconnection occurred:" << e.what() << std::endl;
+    std::cerr << "Unhandled disconnection occurred:" << e.what() << std::endl;
     exit_code= EXIT_FAILURE;
   }
   catch (std::exception& e)
   {
-    std::cerr << __FILE__ << ":" <<  __LINE__ << ": " << "std::exception:" << e.what() << std::endl;
+    std::cerr << "std::exception:" << e.what() << std::endl;
     exit_code= EXIT_FAILURE;
   }
   catch (char const*)
   {
-    std::cerr << __FILE__ << ":" <<  __LINE__ << ": " << "Exception:" << std::endl;
+    std::cerr << "Exception:" << std::endl;
     exit_code= EXIT_FAILURE;
   }
   catch (...)
   {
-    std::cerr << __FILE__ << ":" <<  __LINE__ << ": " << "Unknown exception halted execution." << std::endl;
+    std::cerr << "Unknown exception halted execution." << std::endl;
     exit_code= EXIT_FAILURE;
   }