From: Brian Aker Date: Mon, 16 Apr 2012 07:48:35 +0000 (-0700) Subject: Update for to allow for generate to be cleaned up. X-Git-Tag: 1.0.7~7^2^2^2~2 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=a713b6d9ee850ae5805c05e8336256cea1f71138;p=m6w6%2Flibmemcached Update for to allow for generate to be cleaned up. --- diff --git a/clients/generator.cc b/clients/generator.cc index 011ed3a4..c62f9a32 100644 --- a/clients/generator.cc +++ b/clients/generator.cc @@ -44,7 +44,9 @@ static void get_random_string(char *buffer, size_t size) void pairs_free(pairs_st *pairs) { if (pairs == NULL) + { return; + } /* We free until we hit the null pair we stores during creation */ for (uint32_t x= 0; pairs[x].key; x++) diff --git a/tests/include.am b/tests/include.am index c6e59f99..ff5223fe 100644 --- a/tests/include.am +++ b/tests/include.am @@ -40,7 +40,14 @@ noinst_PROGRAMS+= tests/cycle include tests/libmemcached-1.0/include.am -tests_failure_SOURCES= tests/failure.cc +tests_failure_SOURCES= +tests_failure_SOURCES+= tests/failure.cc +tests_failure_SOURCES+= clients/execute.cc +tests_failure_SOURCES+= clients/generator.cc +tests_failure_SOURCES+= tests/libmemcached-1.0/callback_counter.cc +tests_failure_SOURCES+= tests/libmemcached-1.0/fetch_all_results.cc +tests_failure_SOURCES+= tests/libmemcached-1.0/generate.cc + tests_failure_CXXFLAGS = $(AM_CXXFLAGS) tests_failure_DEPENDENCIES= $(TESTS_LDADDS) tests_failure_LDADD= $(tests_failure_DEPENDENCIES) diff --git a/tests/libmemcached-1.0/generate.cc b/tests/libmemcached-1.0/generate.cc index 79caa5fb..9f677584 100644 --- a/tests/libmemcached-1.0/generate.cc +++ b/tests/libmemcached-1.0/generate.cc @@ -53,15 +53,15 @@ using namespace libtest; -static pairs_st *global_pairs; +static pairs_st *global_pairs= NULL; static const char *global_keys[GLOBAL_COUNT]; static size_t global_keys_length[GLOBAL_COUNT]; static size_t global_count= 0; -test_return_t cleanup_pairs(memcached_st *memc) +test_return_t cleanup_pairs(memcached_st*) { - (void)memc; pairs_free(global_pairs); + global_pairs= NULL; return TEST_SUCCESS; } diff --git a/tests/libmemcached-1.0/include.am b/tests/libmemcached-1.0/include.am index 186e655b..d4b3fc14 100644 --- a/tests/libmemcached-1.0/include.am +++ b/tests/libmemcached-1.0/include.am @@ -56,9 +56,11 @@ tests_libmemcached_1_0_testapp_CXXFLAGS = $(AM_CXXFLAGS) ${PTHREAD_CFLAGS} tests_libmemcached_1_0_testapp_CFLAGS= $(AM_CFLAGS) $(NO_CONVERSION) $(NO_STRICT_ALIASING) tests_libmemcached_1_0_testapp_SOURCES= tests_libmemcached_1_0_testapp_SOURCES+= tests/libmemcached-1.0/all_tests.cc +tests_libmemcached_1_0_testapp_SOURCES+= tests/libmemcached-1.0/callback_counter.cc +tests_libmemcached_1_0_testapp_SOURCES+= tests/libmemcached-1.0/fetch_all_results.cc +tests_libmemcached_1_0_testapp_SOURCES+= tests/libmemcached-1.0/generate.cc tests_libmemcached_1_0_testapp_SOURCES+= \ tests/libmemcached-1.0/basic.cc \ - tests/libmemcached-1.0/callback_counter.cc \ tests/libmemcached-1.0/callbacks.cc \ tests/libmemcached-1.0/debug.cc \ tests/libmemcached-1.0/deprecated.cc \ @@ -66,8 +68,6 @@ tests_libmemcached_1_0_testapp_SOURCES+= \ tests/libmemcached-1.0/encoding_key.cc \ tests/libmemcached-1.0/error_conditions.cc \ tests/libmemcached-1.0/exist.cc \ - tests/libmemcached-1.0/fetch_all_results.cc \ - tests/libmemcached-1.0/generate.cc \ tests/libmemcached-1.0/haldenbrand.cc \ tests/libmemcached-1.0/ketama.cc \ tests/libmemcached-1.0/mem_functions.cc \ @@ -106,7 +106,6 @@ tests_libmemcached_1_0_testsocket_CFLAGS= $(AM_CFLAGS) $(NO_CONVERSION) $(NO_STR tests_libmemcached_1_0_testsocket_SOURCES= \ tests/libmemcached-1.0/all_tests_socket.cc \ tests/libmemcached-1.0/basic.cc \ - tests/libmemcached-1.0/callback_counter.cc \ tests/libmemcached-1.0/callbacks.cc \ tests/libmemcached-1.0/debug.cc \ tests/libmemcached-1.0/deprecated.cc \ @@ -114,8 +113,6 @@ tests_libmemcached_1_0_testsocket_SOURCES= \ tests/libmemcached-1.0/encoding_key.cc \ tests/libmemcached-1.0/error_conditions.cc \ tests/libmemcached-1.0/exist.cc \ - tests/libmemcached-1.0/fetch_all_results.cc \ - tests/libmemcached-1.0/generate.cc \ tests/libmemcached-1.0/haldenbrand.cc \ tests/libmemcached-1.0/ketama.cc \ tests/libmemcached-1.0/mem_functions.cc \ @@ -131,7 +128,11 @@ tests_libmemcached_1_0_testsocket_SOURCES= \ tests/libmemcached-1.0/touch.cc \ tests/libmemcached-1.0/virtual_buckets.cc -tests_libmemcached_1_0_testsocket_SOURCES+= clients/generator.cc clients/execute.cc +tests_libmemcached_1_0_testsocket_SOURCES+= clients/generator.cc +tests_libmemcached_1_0_testsocket_SOURCES+= clients/execute.cc +tests_libmemcached_1_0_testsocket_SOURCES+= tests/libmemcached-1.0/generate.cc +tests_libmemcached_1_0_testsocket_SOURCES+= tests/libmemcached-1.0/callback_counter.cc +tests_libmemcached_1_0_testsocket_SOURCES+= tests/libmemcached-1.0/fetch_all_results.cc tests_libmemcached_1_0_testsocket_DEPENDENCIES= \ libmemcached/libmemcached.la \ libtest/libtest.la \ @@ -164,7 +165,12 @@ tests_libmemcached_1_0_sasl_SOURCES= \ tests/libmemcached-1.0/replication.cc \ tests/libmemcached-1.0/sasl.cc \ tests/libmemcached-1.0/virtual_buckets.cc -tests_libmemcached_1_0_sasl_SOURCES+= clients/generator.cc clients/execute.cc +tests_libmemcached_1_0_sasl_SOURCES+= clients/execute.cc +tests_libmemcached_1_0_sasl_SOURCES+= clients/generator.cc +tests_libmemcached_1_0_sasl_SOURCES+= tests/libmemcached-1.0/callback_counter.cc +tests_libmemcached_1_0_sasl_SOURCES+= tests/libmemcached-1.0/fetch_all_results.cc +tests_libmemcached_1_0_sasl_SOURCES+= tests/libmemcached-1.0/generate.cc + tests_libmemcached_1_0_sasl_DEPENDENCIES= \ libmemcached/libmemcached.la \ libtest/libtest.la @@ -188,7 +194,15 @@ tests_atomsmasher_LDADD= $(tests_atomsmasher_DEPENDENCIES) noinst_PROGRAMS+= tests/atomsmasher tests_testudp_CFLAGS= $(AM_CFLAGS) $(NO_CONVERSION) $(NO_STRICT_ALIASING) -tests_testudp_SOURCES= tests/mem_udp.cc +tests_testudp_SOURCES= + +tests_testudp_SOURCES+= tests/mem_udp.cc +tests_testudp_SOURCES+= clients/execute.cc +tests_testudp_SOURCES+= clients/generator.cc +tests_testudp_SOURCES+= tests/libmemcached-1.0/callback_counter.cc +tests_testudp_SOURCES+= tests/libmemcached-1.0/fetch_all_results.cc +tests_testudp_SOURCES+= tests/libmemcached-1.0/generate.cc + tests_testudp_DEPENDENCIES= $(TESTS_LDADDS) tests_testudp_LDADD= $(tests_testudp_DEPENDENCIES) check_PROGRAMS+= tests/testudp @@ -197,7 +211,15 @@ noinst_PROGRAMS+= tests/testudp test-udp: tests/testudp @tests/testudp -tests_testplus_SOURCES= tests/libmemcached-1.0/plus.cpp +tests_testplus_SOURCES= + +tests_testplus_SOURCES+= tests/libmemcached-1.0/plus.cpp +tests_testplus_SOURCES+= clients/execute.cc +tests_testplus_SOURCES+= clients/generator.cc +tests_testplus_SOURCES+= tests/libmemcached-1.0/callback_counter.cc +tests_testplus_SOURCES+= tests/libmemcached-1.0/fetch_all_results.cc +tests_testplus_SOURCES+= tests/libmemcached-1.0/generate.cc + tests_testplus_CXXFLAGS = $(AM_CXXFLAGS) $(NO_EFF_CXX) tests_testplus_DEPENDENCIES= $(TESTS_LDADDS) tests_testplus_LDADD= $(tests_testplus_DEPENDENCIES) diff --git a/tests/runner.h b/tests/runner.h index 82e69fda..0aacac92 100644 --- a/tests/runner.h +++ b/tests/runner.h @@ -38,6 +38,8 @@ #pragma once +#include "tests/libmemcached-1.0/generate.h" + class LibmemcachedRunner : public libtest::Runner { public: test_return_t run(test_callback_fn* func, void *object) @@ -92,6 +94,7 @@ private: test_return_t _post_runner_default(libmemcached_test_callback_fn func, libmemcached_test_container_st *container) { + cleanup_pairs(NULL); if (func) { return func(container->parent);