Refactor memcapable test. Update m4 for append file.
authorBrian Aker <brian@tangent.org>
Thu, 2 May 2013 02:16:42 +0000 (22:16 -0400)
committerBrian Aker <brian@tangent.org>
Thu, 2 May 2013 02:16:42 +0000 (22:16 -0400)
m4/ax_append_to_file.m4
tests/memcapable.cc

index c88affb46caf15bfe110eff9f4dda7d41e2cd997..f9f54e088db1608746bfe926a7fd6b222e4ee549 100644 (file)
@@ -19,9 +19,9 @@
 #   and this notice are preserved. This file is offered as-is, without any
 #   warranty.
 
-#serial 7
+#serial 8
 
 AC_DEFUN([AX_APPEND_TO_FILE],[
 AC_REQUIRE([AX_FILE_ESCAPES])
-printf "$2" >> "$1"
+printf "$2\n" >> "$1"
 ])
index 04a7b34259182ac643b556b452fc0ee3fa31e08c..63a1d269251266cd6d7d41ca1e2a03e706efd9f2 100644 (file)
@@ -74,7 +74,7 @@ static test_return_t ascii_test(void *)
 {
   char buffer[1024];
   snprintf(buffer, sizeof(buffer), "%d", int(default_port()));
-  const char *args[]= { "-p", buffer, " -a ", 0 };
+  const char *args[]= { "-p", buffer, "-a", 0 };
 
   test_true(exec_cmdline(executable, args, true) <= EXIT_FAILURE);
 
@@ -85,7 +85,7 @@ static test_return_t binary_test(void *)
 {
   char buffer[1024];
   snprintf(buffer, sizeof(buffer), "%d", int(default_port()));
-  const char *args[]= { "-p", buffer, " -b ", 0 };
+  const char *args[]= { "-p", buffer, "-b", 0 };
 
   test_true(exec_cmdline(executable, args, true) <= EXIT_FAILURE);
 
@@ -107,16 +107,9 @@ collection_st collection[] ={
 
 static void *world_create(server_startup_st& servers, test_return_t& error)
 {
-  if (libtest::has_memcached() == false)
-  {
-    error= TEST_SKIPPED;
-    return NULL;
-  }
-
-  if (server_startup(servers, "memcached", libtest::default_port(), NULL) == false)
-  {
-    error= TEST_SKIPPED;
-  }
+  SKIP_UNLESS(libtest::has_memcached())
+
+  SKIP_UNLESS(server_startup(servers, "memcached", libtest::default_port(), NULL))
 
   return &servers;
 }