# vim:ft=automake
-# Copyright (C) 2011 Data Differential (http://datadifferential.com/)
-# All rights reserved.
-#
-# Use and distribution licensed under the BSD license. See
-# the COPYING file in the parent directory for full text.
#
# included from Top Level Makefile.am
# All paths should be given relative to the root
#
-LIBUTEST_TMP = ${abs_top_builddir}/tests/var/tmp/
-
-VALGRIND_COMMAND= $(LIBTOOL) --mode=execute valgrind --error-exitcode=1 --leak-check=yes --show-reachable=yes --track-fds=yes --malloc-fill=A5 --free-fill=DE
-HELGRIND_COMMAND= $(LIBTOOL) --mode=execute valgrind --tool=helgrind --read-var-info=yes --error-exitcode=1
-DRD_COMMAND= $(LIBTOOL) --mode=execute valgrind --tool=drd
-GDB_COMMAND= $(LIBTOOL) --mode=execute gdb
-
-CLEANFILES+= \
- tests/var/log/* \
- tests/var/run/* \
- tests/var/tmp/*
-
-noinst_HEADERS+= \
- libtest/callbacks.h \
- libtest/cmdline.h \
- libtest/collection.h \
- libtest/common.h \
- libtest/core.h \
- libtest/error.h \
- libtest/failed.h \
- libtest/framework.h \
- libtest/gearmand.h \
- libtest/get.h \
- libtest/killpid.h \
- libtest/memcached.h \
- libtest/runner.h \
- libtest/server.h \
- libtest/signal.h \
- libtest/stats.h \
- libtest/strerror.h \
- libtest/test.h \
- libtest/test.hpp \
- libtest/visibility.h \
- libtest/wait.h
+LIBTOOL_COMMAND= ${abs_top_builddir}/libtool --mode=execute
+VALGRIND_EXEC_COMMAND= $(LIBTOOL_COMMAND) valgrind --error-exitcode=1 --leak-check=yes --show-reachable=yes --track-fds=yes --malloc-fill=A5 --free-fill=DE --xml-file=./tmp_chroot/var/tmp/yatl-\%p.xml --xml=yes
+VALGRIND_COMMAND= TESTS_ENVIRONMENT="valgrind" $(VALGRIND_EXEC_COMMAND)
+HELGRIND_COMMAND= $(LIBTOOL_COMMAND) valgrind --tool=helgrind --read-var-info=yes --error-exitcode=1 --read-var-info=yes
+DRD_COMMAND= $(LIBTOOL_COMMAND) valgrind --tool=drd
+GDB_COMMAND= $(LIBTOOL_COMMAND) gdb -f -x libtest/run.gdb
+PTRCHECK_COMMAND= $(LIBTOOL_COMMAND) valgrind --tool=exp-ptrcheck --error-exitcode=1
+
+export LIBTOOL_COMMAND
+export VALGRIND_COMMAND
+export HELGRIND_COMMAND
+export DRD_COMMAND
+export GDB_COMMAND
+
+valgrind:
+ @echo make check TESTS_ENVIRONMENT="\"$(VALGRIND_EXEC_COMMAND)\""
+
+gdb:
+ @echo make check TESTS_ENVIRONMENT="\"$(GDB_COMMAND)\""
+
+helgrind:
+ @echo make check TESTS_ENVIRONMENT="\"$(HELGRIND_COMMAND)\""
+
+drd:
+ @echo make check TESTS_ENVIRONMENT="\"$(DRD_COMMAND)\""
+
+EXTRA_DIST+= libtest/run.gdb
+
+CLEANFILES+= tmp_chroot/etc/*
+CLEANFILES+= tmp_chroot/var/drizzle/*
+CLEANFILES+= tmp_chroot/var/log/*
+CLEANFILES+= tmp_chroot/var/run/*
+CLEANFILES+= tmp_chroot/var/tmp/*
+
+.PHONY: distclean-libtest-check
+distclean-libtest-check:
+ -rm -rf tmp_chroot
+
+noinst_HEADERS+= libtest/timer.hpp
+noinst_HEADERS+= libtest/binaries.h
+noinst_HEADERS+= libtest/cpu.hpp
+noinst_HEADERS+= libtest/blobslap_worker.h
+noinst_HEADERS+= libtest/callbacks.h
+noinst_HEADERS+= libtest/cmdline.h
+noinst_HEADERS+= libtest/collection.h
+noinst_HEADERS+= libtest/common.h
+noinst_HEADERS+= libtest/comparison.hpp
+noinst_HEADERS+= libtest/core.h
+noinst_HEADERS+= libtest/dream.h
+noinst_HEADERS+= libtest/error.h
+noinst_HEADERS+= libtest/failed.h
+noinst_HEADERS+= libtest/fatal.hpp
+noinst_HEADERS+= libtest/framework.h
+noinst_HEADERS+= libtest/gearmand.h
+noinst_HEADERS+= libtest/drizzled.h
+noinst_HEADERS+= libtest/get.h
+noinst_HEADERS+= libtest/has.hpp
+noinst_HEADERS+= libtest/http.hpp
+noinst_HEADERS+= libtest/is_pid.hpp
+noinst_HEADERS+= libtest/is_local.hpp
+noinst_HEADERS+= libtest/killpid.h
+noinst_HEADERS+= libtest/libtool.hpp
+noinst_HEADERS+= libtest/memcached.h
+noinst_HEADERS+= libtest/port.h
+noinst_HEADERS+= libtest/runner.h
+noinst_HEADERS+= libtest/server.h
+noinst_HEADERS+= libtest/server_container.h
+noinst_HEADERS+= libtest/signal.h
+noinst_HEADERS+= libtest/socket.hpp
+noinst_HEADERS+= libtest/stream.h
+noinst_HEADERS+= libtest/strerror.h
+noinst_HEADERS+= libtest/string.hpp
+noinst_HEADERS+= libtest/test.h
+noinst_HEADERS+= libtest/test.hpp
+noinst_HEADERS+= libtest/tmpfile.hpp
+noinst_HEADERS+= libtest/vchar.hpp
+noinst_HEADERS+= libtest/visibility.h
+noinst_HEADERS+= libtest/wait.h
noinst_LTLIBRARIES+= libtest/libtest.la
-libtest_libtest_la_SOURCES= \
- libtest/cmdline.cc \
- libtest/framework.cc \
- libtest/killpid.cc \
- libtest/runner.cc \
- libtest/server.cc \
- libtest/signal.cc \
- libtest/test.cc
-
-libtest_libtest_la_CFLAGS= ${AM_CFLAGS} ${NO_CONVERSION} -DBUILDING_LIBTEST
-libtest_libtest_la_CXXFLAGS= ${AM_CXXFLAGS} ${NO_CONVERSION} -DBUILDING_LIBTEST
-libtest_libtest_la_LIBADD=
-LIBTEST_LDADD= libtest/libtest.la
+libtest_libtest_la_CXXFLAGS=
+libtest_libtest_la_DEPENDENCIES=
+libtest_libtest_la_LIBADD=
+libtest_libtest_la_SOURCES=
+
+libtest_libtest_la_SOURCES+= libtest/binaries.cc
+libtest_libtest_la_SOURCES+= libtest/cmdline.cc
+libtest_libtest_la_SOURCES+= libtest/comparison.cc
+libtest_libtest_la_SOURCES+= libtest/collection.cc
+libtest_libtest_la_SOURCES+= libtest/core.cc
+libtest_libtest_la_SOURCES+= libtest/cpu.cc
+libtest_libtest_la_SOURCES+= libtest/dream.cc
+libtest_libtest_la_SOURCES+= libtest/fatal.cc
+libtest_libtest_la_SOURCES+= libtest/framework.cc
+libtest_libtest_la_SOURCES+= libtest/has.cc
+libtest_libtest_la_SOURCES+= libtest/drizzled.cc
+libtest_libtest_la_SOURCES+= libtest/http.cc
+libtest_libtest_la_SOURCES+= libtest/is_local.cc
+libtest_libtest_la_SOURCES+= libtest/killpid.cc
+libtest_libtest_la_SOURCES+= libtest/libtool.cc
+libtest_libtest_la_SOURCES+= libtest/main.cc
+libtest_libtest_la_SOURCES+= libtest/port.cc
+libtest_libtest_la_SOURCES+= libtest/runner.cc
+libtest_libtest_la_SOURCES+= libtest/server.cc
+libtest_libtest_la_SOURCES+= libtest/server_container.cc
+libtest_libtest_la_SOURCES+= libtest/signal.cc
+libtest_libtest_la_SOURCES+= libtest/socket.cc
+libtest_libtest_la_SOURCES+= libtest/strerror.cc
+libtest_libtest_la_SOURCES+= libtest/timer.cc
+libtest_libtest_la_SOURCES+= libtest/tmpfile.cc
+libtest_libtest_la_SOURCES+= libtest/vchar.cc
+
+libtest_libtest_la_CXXFLAGS+= -DBUILDING_LIBTEST
+libtest_libtest_la_CXXFLAGS+= $(PTHREAD_CFLAGS)
+libtest_libtest_la_CXXFLAGS+= -DLIBTEST_TEMP="\"tmp_chroot\""
+libtest_libtest_la_CXXFLAGS+= $(CURL_CFLAGS)
+
+libtest_libtest_la_LIBADD+= $(PTHREAD_LIBS)
+libtest_libtest_la_LIBADD+= $(CURL_LIBS)
+
+libtest_libtest_la_DEPENDENCIES+= libtest_tmp_dir
+libtest_libtest_la_DEPENDENCIES+=libtest/abort
+libtest_libtest_la_DEPENDENCIES+=libtest/wait
+
+# Declare unittest so that we can append to it
+libtest_unittest_CXXFLAGS=
+libtest_unittest_LDADD=
+libtest_unittest_DEPENDENCIES=
+
+# We are either building in tree, or with
+if BUILDING_LIBMEMCACHED
+libtest_libtest_la_DEPENDENCIES+= libmemcached/libmemcached.la
+libtest_libtest_la_DEPENDENCIES+= libmemcached/libmemcachedutil.la
+libtest_libtest_la_LIBADD+= libmemcached/libmemcached.la
+libtest_libtest_la_LIBADD+= libmemcached/libmemcachedutil.la
+libtest_libtest_la_SOURCES+= libtest/memcached.cc
+libtest_libtest_la_CXXFLAGS+= -DHAVE_LIBMEMCACHED
+libtest_unittest_CXXFLAGS+= -DHAVE_LIBMEMCACHED
+libtest_unittest_LDADD+= libmemcached/libmemcached.la
+libtest_unittest_LDADD+= libmemcached/libmemcachedutil.la
+libtest_unittest_DEPENDENCIES+= libmemcached/libmemcached.la
+libtest_unittest_DEPENDENCIES+= libmemcached/libmemcachedutil.la
+else
if HAVE_LIBMEMCACHED
-if BUILD_LIBMEMCACHEDUTIL
-LIBTEST_LDADD+= libmemcached/libmemcached.la
-LIBTEST_LDADD+= libmemcached/libmemcachedutil.la
+libtest_libtest_la_LIBADD+= $(libmemcached_LIBS)
+libtest_libtest_la_SOURCES+= libtest/memcached.cc
else
-LIBTEST_LDADD+= $(libmemcached_LIBS)
+libtest_libtest_la_CXXFLAGS+= -DHAVE_LIBMEMCACHED=0
+libtest_unittest_CXXFLAGS+= -DHAVE_LIBMEMCACHED=0
endif
-libtest_libtest_la_SOURCES+= libtest/memcached.cc
endif
+if HAVE_LIBDRIZZLE
+
+libtest_libtest_la_LIBADD+= $(libdrizzle_LIBS)
+libtest_libtest_la_CXXFLAGS+= $(libdrizzle_CFLAGS)
+
+endif
+
+if BUILDING_GEARMAN
+libtest_libtest_la_DEPENDENCIES+= libgearman/libgearman.la
+libtest_libtest_la_LIBADD+= libgearman/libgearman.la
+libtest_libtest_la_SOURCES+= libtest/blobslap_worker.cc
+libtest_libtest_la_SOURCES+= libtest/gearmand.cc
+libtest_libtest_la_SOURCES+= util/instance.cc
+libtest_libtest_la_SOURCES+= util/operation.cc
+
+libtest_unittest_LDADD+= libgearman/libgearman.la
+libtest_unittest_DEPENDENCIES+= libgearman/libgearman.la
+libtest_unittest_DEPENDENCIES+= gearmand/gearmand
+else
if HAVE_LIBGEARMAN
-LIBTEST_LDADD+= libgearman/libgearman.la
+libtest_libtest_la_DEPENDENCIES+= libgearman/libgearman.la
+libtest_libtest_la_LIBADD+= $(libgearman_LIBS)
+libtest_libtest_la_SOURCES+= libtest/blobslap_worker.cc
libtest_libtest_la_SOURCES+= libtest/gearmand.cc
libtest_libtest_la_SOURCES+= util/instance.cc
+libtest_libtest_la_SOURCES+= util/operation.cc
endif
+endif
+
+libtest_tmp_dir: tmp_chroot/var/log tmp_chroot/var/tmp tmp_chroot/var/run tmp_chroot/var/drizzle
-clearn-var:
- @rm -f tests/var/log/*
- @rm -f tests/var/run/*
- @rm -f tests/var/tmp/*
+tmp_chroot: tmp_chroot/etc
+ @$(mkdir_p) tmp_chroot
+tmp_chroot/etc:
+ @$(mkdir_p) tmp_chroot/etc
-tests/var: tests/var/log tests/var/tmp tests/var/run clearn-var
- $(mkdir_p) tests/var
+tmp_chroot/var: tmp_chroot
+ @$(mkdir_p) tmp_chroot/var
-tests/var/log:
- $(mkdir_p) tests/var/log
+tmp_chroot/var/log: tmp_chroot/var
+ @$(mkdir_p) tmp_chroot/var/log
-tests/var/tmp:
- $(mkdir_p) tests/var/tmp
+tmp_chroot/var/tmp: tmp_chroot/var
+ @$(mkdir_p) tmp_chroot/var/tmp
-tests/var/run:
- $(mkdir_p) tests/var/run
+tmp_chroot/var/drizzle: tmp_chroot/var
+ @$(mkdir_p) tmp_chroot/var/drizzle
+tmp_chroot/var/run: tmp_chroot/var
+ @$(mkdir_p) tmp_chroot/var/run
-libtest_unittest_CFLAGS=
-libtest_unittest_LDADD= ${LIBTEST_LDADD}
-libtest_unittest_DEPENDENCIES= ${LIBTEST_LDADD}
+
+libtest_unittest_DEPENDENCIES+= libtest/libtest.la
+libtest_unittest_LDADD+= libtest/libtest.la
libtest_unittest_SOURCES= libtest/unittest.cc
check_PROGRAMS+= libtest/unittest
noinst_PROGRAMS+= libtest/unittest
@libtest/unittest
valgrind-unittest: libtest/unittest
- @$(VALGRIND_COMMAND) libtest/unittest
+ @$(VALGRIND_COMMAND) libtest/unittest TESTS_ENVIRONMENT="valgrind"
gdb-unittest: libtest/unittest
@$(GDB_COMMAND) libtest/unittest
drd-unittest: libtest/unittest
@$(DRD_COMMAND) libtest/unittest
-libtest_wait_SOURCES= libtest/wait.cc
+libtest_skiptest_LDADD= libtest/libtest.la
+libtest_skiptest_SOURCES= libtest/skiptest.cc
+check_PROGRAMS+= libtest/skiptest
+noinst_PROGRAMS+= libtest/skiptest
+
+libtest_wait_SOURCES=
+libtest_wait_SOURCES+= libtest/wait.cc
+libtest_wait_SOURCES+= libtest/dream.cc
noinst_PROGRAMS+= libtest/wait
+libtest_abort_SOURCES= libtest/abort.cc
+noinst_PROGRAMS+= libtest/abort