diff options
author | Brian Aker <brian@tangent.org> | 2013-05-04 05:20:42 -0400 |
---|---|---|
committer | Brian Aker <brian@tangent.org> | 2013-05-04 05:20:42 -0400 |
commit | 20f6e0da77fac9e8975774854a7a07341bd8b0b2 (patch) | |
tree | 304944860431c1f9d3cd7e2de1f25d828fd77ecd /tests | |
parent | 979aeab103387877cb5687ec79d2c7ed26041ca7 (diff) | |
parent | da8d9551f1c0fd5e9381357f6253cb125f336c68 (diff) | |
download | libmemcached-20f6e0da77fac9e8975774854a7a07341bd8b0b2.tar.gz |
Mergre 1.0 tree.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/cli.am | 6 | ||||
-rw-r--r-- | tests/include.am | 9 | ||||
-rw-r--r-- | tests/libmemcached_world.h | 18 | ||||
-rw-r--r-- | tests/memcapable.cc | 25 | ||||
-rw-r--r-- | tests/memcp.cc | 13 |
5 files changed, 39 insertions, 32 deletions
diff --git a/tests/cli.am b/tests/cli.am index 573be2af..df206e5c 100644 --- a/tests/cli.am +++ b/tests/cli.am @@ -99,6 +99,12 @@ tests_memdump_LDADD= libtest/libtest.la $(TESTS_LDADDS) check_PROGRAMS+= tests/memdump noinst_PROGRAMS+= tests/memdump +test-memcp: tests/memcp + tests/memcp + +gdb-memcp: tests/memcp + @$(GDB_COMMAND) tests/memcp + test-memstat: tests/memstat tests/memstat diff --git a/tests/include.am b/tests/include.am index 44fdbfa3..414b143b 100644 --- a/tests/include.am +++ b/tests/include.am @@ -98,6 +98,9 @@ valgrind-memcapable: tests/memcapable pahole-mem: tests/testapp @$(PAHOLE_COMMAND) tests/testapp +pahole-hash: tests/testhashkit + @$(PAHOLE_COMMAND) tests/testhashkit + gdb-mem: tests/libmemcached-1.0/testapp @$(GDB_COMMAND) tests/libmemcached-1.0/testapp @@ -148,3 +151,9 @@ helgrind-hash: tests/testhashkit helgrind-hashplus: tests/hash_plus @$(HELGRIND_COMMAND) tests/hash_plus + +drd-mem: tests/libmemcached-1.0/testapp + @$(DRD_COMMAND) tests/libmemcached-1.0/testapp + +drd-cycle: tests/cycle + @$(DRD_COMMAND) tests/cycle diff --git a/tests/libmemcached_world.h b/tests/libmemcached_world.h index 3dda2d8a..6bed25a9 100644 --- a/tests/libmemcached_world.h +++ b/tests/libmemcached_world.h @@ -43,26 +43,12 @@ static void *world_create(libtest::server_startup_st& servers, test_return_t& error) { - if (libtest::has_memcached() == false) - { - error= TEST_SKIPPED; - return NULL; - } + SKIP_UNLESS(libtest::has_libmemcached()); if (servers.sasl()) { - if (LIBMEMCACHED_WITH_SASL_SUPPORT == 0) - { - error= TEST_SKIPPED; - return NULL; - } + SKIP_UNLESS(libtest::has_libmemcached_sasl()); - if (HAVE_MEMCACHED_SASL_BINARY == 0) - { - error= TEST_SKIPPED; - return NULL; - } - // Assume we are running under valgrind, and bail if (getenv("TESTS_ENVIRONMENT")) { diff --git a/tests/memcapable.cc b/tests/memcapable.cc index 054342c3..f43c1acb 100644 --- a/tests/memcapable.cc +++ b/tests/memcapable.cc @@ -47,14 +47,16 @@ using namespace libtest; #ifndef __INTEL_COMPILER -#pragma GCC diagnostic ignored "-Wstrict-aliasing" +# pragma GCC diagnostic ignored "-Wstrict-aliasing" #endif static std::string executable; static test_return_t quiet_test(void *) { - const char *args[]= { "-q", 0 }; + char buffer[1024]; + snprintf(buffer, sizeof(buffer), "%d", int(get_free_port())); + const char *args[]= { "-p", buffer, "-q", 0 }; test_compare(EXIT_FAILURE, exec_cmdline(executable, args, true)); @@ -74,7 +76,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 +87,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); @@ -105,18 +107,11 @@ collection_st collection[] ={ {0, 0, 0, 0} }; -static void *world_create(server_startup_st& servers, test_return_t& error) +static void *world_create(server_startup_st& servers, test_return_t&) { - 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; } diff --git a/tests/memcp.cc b/tests/memcp.cc index 9c9f4d62..4139437b 100644 --- a/tests/memcp.cc +++ b/tests/memcp.cc @@ -44,6 +44,8 @@ #include <libtest/test.hpp> #include <libmemcached-1.2/memcached.h> +#include <sys/stat.h> + using namespace libtest; #ifndef __INTEL_COMPILER @@ -63,11 +65,20 @@ static test_return_t help_test(void *) static test_return_t server_test(void *) { + int fd; + std::string tmp_file= create_tmpfile("memcp", fd); + ASSERT_TRUE(tmp_file.c_str()); + struct stat buf; + ASSERT_EQ(fstat(fd, &buf), 0); + ASSERT_EQ(buf.st_size, 0); + char buffer[1024]; snprintf(buffer, sizeof(buffer), "--servers=localhost:%d", int(default_port())); - const char *args[]= { buffer, 0 }; + const char *args[]= { buffer, tmp_file.c_str(), 0 }; test_compare(EXIT_SUCCESS, exec_cmdline(executable, args, true)); + close(fd); + unlink(tmp_file.c_str()); return TEST_SUCCESS; } |