Просмотр исходного кода

Cleaned up calling method for server.

Brian Aker 14 лет назад
Родитель
Сommit
ef250275a6
3 измененных файлов с 10 добавлено и 22 удалено
  1. 7 19
      libtest/server.cc
  2. 1 1
      libtest/server.h
  3. 2 2
      tests/include.am

+ 7 - 19
libtest/server.cc

@@ -7,7 +7,7 @@
  * the COPYING file in the parent directory for full text.
  */
 
-#include "config.h"
+#include <config.h>
 
 #if defined(NDEBUG)
 # undef NDEBUG
@@ -98,24 +98,18 @@ pid_t test_gearmand_start(in_port_t port, const char *queue_type,
     buffer << "libtool --mode=execute valgrind --log-file=tests/var/tmp/valgrind.out --leak-check=full  --show-reachable=yes ";
   }
 
+  snprintf(file_buffer, sizeof(file_buffer), "tests/var/tmp/gearmand.pidXXXXXX");
+  if (mkstemp(file_buffer) == -1)
+  {
+    perror("mkstemp");
+    return -1;
+  }
   if (getenv("GEARMAN_MANUAL_GDB"))
   {
-    snprintf(file_buffer, sizeof(file_buffer), "tests/var/tmp/gearmand.pidXXXXXX");
-    if (mkstemp(file_buffer) == -1)
-    {
-      perror("mkstemp");
-      return -1;
-    }
     buffer << std::endl << "run --pid-file=" << file_buffer << " -vvvvvv --port=" << port;
   }
   else if (getenv("GEARMAN_LOG"))
   {
-    snprintf(file_buffer, sizeof(file_buffer), "tests/var/tmp/gearmand.pidXXXXXX");
-    if (mkstemp(file_buffer) == -1)
-    {
-      perror("mkstemp");
-      return -1;
-    }
     snprintf(log_buffer, sizeof(log_buffer), "tests/var/log/gearmand.logXXXXXX");
     if (mkstemp(log_buffer) == -1)
     {
@@ -126,12 +120,6 @@ pid_t test_gearmand_start(in_port_t port, const char *queue_type,
   }
   else
   {
-    snprintf(file_buffer, sizeof(file_buffer), "tests/var/tmp/gearmand.pidXXXXXX");
-    if (mkstemp(file_buffer) == -1)
-    {
-      perror("mkstemp");
-      return -1;
-    }
     buffer << "./gearmand/gearmand --pid-file=" << file_buffer << " --daemon --port=" << port;
   }
 

+ 1 - 1
libtest/server.h

@@ -7,7 +7,7 @@
  * the COPYING file in the parent directory for full text.
  */
 
-#include "config.h"
+#include <config.h>
 
 #include "libtest/visibility.h"
 

+ 2 - 2
tests/include.am

@@ -80,9 +80,9 @@ GEARADMIN_TOOL= bin/gearadmin
 test-shutdown: bin/gearadmin
 	$(GEARADMIN_TOOL) --port 32123 --shutdown 2>&1 > /dev/null
 
-check-local: tests/var gearmand-test-args client-test tests/var test-shutdown libtest-tests
+check-local: tests/var gearmand-test-args client-test test-shutdown libtest-tests
 
-libtest-tests: tests/var test-client test-round-robin test-worker test-internals test-libmemcached test-sqlite test-tokyocabinet test-burnin queue-regression
+libtest-tests: test-client test-round-robin test-worker test-internals test-libmemcached test-sqlite test-tokyocabinet test-burnin queue-regression
 
 gdb-client: ${noinst_PROGRAMS}
 	$(LIBTOOL) --mode=execute gdb tests/client_test