X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=tests%2Fmemrm.cc;h=1f5f722ac8faf034044ddacb873d7f305225dbcc;hb=2569efffe16042f47dc5d2c34528a9ec22fc18b0;hp=8ca4445e2a586b7b8e131184f39f6d6b25310b11;hpb=9c5fa1db34c5fb1ffed88742caeffa5a9afd0a9e;p=awesomized%2Flibmemcached diff --git a/tests/memrm.cc b/tests/memrm.cc index 8ca4445e..1f5f722a 100644 --- a/tests/memrm.cc +++ b/tests/memrm.cc @@ -42,7 +42,7 @@ #include #include -#include +#include using namespace libtest; @@ -50,7 +50,7 @@ using namespace libtest; #pragma GCC diagnostic ignored "-Wstrict-aliasing" #endif -static std::string executable; +static std::string executable("./clients/memrm"); static test_return_t quiet_test(void *) { @@ -95,7 +95,7 @@ static test_return_t rm_test(void *) return TEST_SUCCESS; } -static test_return_t NOT_FOUND_test(void *) +static test_return_t NOT_FOUND_TEST(void *) { char buffer[1024]; snprintf(buffer, sizeof(buffer), "--server=localhost:%d", int(default_port())); @@ -118,11 +118,24 @@ static test_return_t NOT_FOUND_test(void *) return TEST_SUCCESS; } +static test_return_t multiple_NOT_FOUND_TEST(void *) +{ + char buffer[1024]; + snprintf(buffer, sizeof(buffer), "--server=localhost:%d", int(default_port())); + const char *args[]= { buffer, "protocols", "foo", "mine", "bar", "dog", "cat", "foo", "mine", + "eye", "for", "the", "to", "not", "know", "what", "I", "should", "be", "doing", 0 }; + + test_compare(EXIT_SUCCESS, exec_cmdline(executable, args, true)); + + return TEST_SUCCESS; +} + test_st memrm_tests[] ={ {"--quiet", true, quiet_test }, {"--help", true, help_test }, {"rm(FOUND)", true, rm_test }, - {"rm(NOT_FOUND)", true, NOT_FOUND_test }, + {"rm(NOT_FOUND)", true, NOT_FOUND_TEST }, + {"multiple rm(NOT_FOUND)", true, multiple_NOT_FOUND_TEST }, {0, 0, 0} }; @@ -133,14 +146,13 @@ collection_st collection[] ={ static void *world_create(server_startup_st& servers, test_return_t& error) { - if (HAVE_MEMCACHED_BINARY == 0) + if (libtest::has_memcached() == false) { error= TEST_SKIPPED; return NULL; } - const char *argv[1]= { "memrm" }; - if (not server_startup(servers, "memcached", libtest::default_port(), 1, argv)) + if (server_startup(servers, "memcached", libtest::default_port(), 0, NULL) == false) { error= TEST_FAILURE; } @@ -149,10 +161,9 @@ static void *world_create(server_startup_st& servers, test_return_t& error) } -void get_world(Framework *world) +void get_world(libtest::Framework* world) { - executable= "./clients/memrm"; - world->collections= collection; - world->_create= world_create; + world->collections(collection); + world->create(world_create); }