Updated test framework.
[m6w6/libmemcached] / tests / include.am
index 32f044c9c828e6f53131156b2577a68a5228f9ff..259da130cfd70f9d475ab0aae161e55c98d7bcbc 100644 (file)
@@ -4,36 +4,41 @@
 
 TESTS_LDADDS = libmemcached/libmemcached.la
 
+VALGRIND_COMMAND= $(LIBTOOL) --mode=execute valgrind --leak-check=yes --show-reachable=yes
+
+DEBUG_COMMAND= $(LIBTOOL) --mode=execute gdb
+
 if BUILD_LIBMEMCACHEDUTIL
 TESTS_LDADDS+= libmemcached/libmemcachedutil.la
 endif
 
 EXTRA_DIST+= \
-       tests/r/memcat.res \
-       tests/r/memcp.res \
-       tests/r/memrm.res \
-       tests/r/memslap.res \
-       tests/r/memstat.res \
-       tests/t/memcat.test \
-       tests/t/memcp.test \
-       tests/t/memrm.test \
-       tests/t/memslap.test \
-       tests/t/memstat.test
+            tests/r/memcat.res \
+            tests/r/memcp.res \
+            tests/r/memrm.res \
+            tests/r/memslap.res \
+            tests/r/memstat.res \
+            tests/t/memcat.test \
+            tests/t/memcp.test \
+            tests/t/memrm.test \
+            tests/t/memslap.test \
+            tests/t/memstat.test
 
 noinst_HEADERS+= \
-       tests/hash_results.h \
-       tests/ketama_test_cases.h \
-       tests/ketama_test_cases_spy.h \
-       tests/libmemcached_world.h \
-       tests/server.h \
-       tests/test.h
+                tests/hash_results.h \
+                tests/ketama_test_cases.h \
+                tests/ketama_test_cases_spy.h \
+                tests/libmemcached_world.h \
+                tests/server.h \
+                tests/test.h
 
 noinst_PROGRAMS+= \
-       tests/atomsmasher \
-       tests/startservers \
-       tests/testapp \
-       tests/testplus \
-       tests/udptest
+                 tests/atomsmasher \
+                 tests/startservers \
+                 tests/testapp \
+                 tests/testhashkit \
+                 tests/testplus \
+                 tests/udptest
 
 noinst_LTLIBRARIES+= tests/libserver.la
 tests_libserver_la_SOURCES= tests/server.c
@@ -42,18 +47,22 @@ noinst_LTLIBRARIES+= tests/libtest.la
 tests_libtest_la_SOURCES= tests/test.c
 
 tests_testapp_CFLAGS= $(AM_CFLAGS) $(NO_CONVERSION) $(NO_STRICT_ALIASING)
-tests_testapp_SOURCES= tests/function.c
+tests_testapp_SOURCES= tests/mem_functions.c
 tests_testapp_LDADD= \
        clients/libgenexec.la \
        tests/libserver.la \
        tests/libtest.la \
+       libmemcached/libmemcachedinternal.la \
        $(TESTS_LDADDS)
+tests_testapp_DEPENDENCIES= $(tests_testapp_LDADD)
 
 tests_testplus_SOURCES= tests/plus.cpp
 tests_testplus_LDADD= tests/libtest.la tests/libserver.la $(TESTS_LDADDS)
+tests_testplus_DEPENDENCIES= $(tests_testplus_LDADD)
 
 tests_udptest_SOURCES= tests/udp.c
 tests_udptest_LDADD= tests/libtest.la tests/libserver.la $(TESTS_LDADDS)
+tests_udptest_DEPENDENCIES= $(tests_udptest_LDADD)
 
 tests_atomsmasher_SOURCES= tests/atomsmasher.c
 tests_atomsmasher_LDADD= \
@@ -61,9 +70,15 @@ tests_atomsmasher_LDADD= \
        tests/libserver.la \
        tests/libtest.la \
        $(TESTS_LDADDS)
+tests_atomsmasher_DEPENDENCIES= $(tests_atomsmasher_LDADD)
 
 tests_startservers_SOURCES= tests/start.c
 tests_startservers_LDADD= tests/libserver.la $(TESTS_LDADDS)
+tests_startservers_DEPENDENCIES= $(tests_startservers_LDADD)
+
+tests_testhashkit_SOURCES = tests/hashkit_functions.c
+tests_testhashkit_LDADD = tests/libtest.la libhashkit/libhashkit.la
+tests_testhashkit_DEPENDENCIES = $(tests_testhashkit_LDADD)
 
 client-record:
        sh tests/t/memcat.test > tests/r/memcat.res
@@ -72,12 +87,14 @@ client-record:
        sh tests/t/memslap.test > tests/r/memslap.res
        sh tests/t/memstat.test > tests/r/memstat.res
 
-test: tests/testapp tests/testplus library_test memcapable
+test: test-docs tests/testplus library_test memcapable libmhashkit_test
        echo "Tests completed"
 
-library_test:
+library_test: tests/testapp
        tests/testapp
-#      tests/testplus
+
+libmhashkit_test: libhashkit
+       tests/testhashkit
 
 memcapable: clients/memcapable
        @MEMC_BINARY@ -d -P `pwd`/tests/Xumemc.pid -p 12555
@@ -102,9 +119,31 @@ clients:
        cat tests/Xumemc.pid | xargs kill
        rm tests/Xumemc.pid
 
+MEM_COMMAND= tests/testapp $(COLLECTION) $(SUITE)
+
+HASH_COMMAND= tests/testhashkit $(COLLECTION) $(SUITE)
+
+test-mem:
+       $(MEM_COMMAND)
+
+test-hash:
+       $(HASH_COMMAND)
+
+gdb-mem:
+       $(DEBUG_COMMAND)  $(MEM_COMMAND)
+
+gdb-hash:
+       $(DEBUG_COMMAND) $(HASH_COMMAND)
+
+valgrind-mem:
+       $(VALGRIND_COMMAND)  $(MEM_COMMAND)
+
+valgrind-hash:
+       $(VALGRIND_COMMAND) $(HASH_COMMAND)
+
+
 PHONY += valgrind
-valgrind:
-       $(LIBTOOL) --mode=execute valgrind --leak-check=yes --show-reachable=yes  tests/testapp
+valgrind: tests/testapp tests/testhashkit valgrind-mem valgrind-hash 
 
 PHONY += cachegrind
 CLEANFILES += tests/cachegrind.out