build: fold test makefile into primary makefile

Moving the subdir makefile into the main one lets us more easily track
dependencies for reliable builds. Previously we tended to build against
old versions of the static library when running the tests.
This commit is contained in:
Danny Robson 2015-02-13 18:02:09 +11:00
parent 331f185160
commit ecc40f2315
4 changed files with 54 additions and 53 deletions

View File

@ -5,8 +5,6 @@ ACLOCAL_AMFLAGS = -I m4
AM_CXXFLAGS = $(BOOST_CPPFLAGS) $(ZLIB_CFLAGS)
SUBDIRS = test
###############################################################################
## Source definitions
@ -209,7 +207,6 @@ libutil_a_CXXFLAGS = $(AM_CXXFLAGS)
AM_DEFAULT_SOURCE_EXT = .cpp
AM_LDFLAGS = $(BOOST_LDFLAGS)
LDADD = $(top_builddir)/libutil.a $(BOOST_FILESYSTEM_LIB) $(BOOST_SYSTEM_LIB) $(ZLIB_LIBS)
bin_PROGRAMS = \
tools/hash \
@ -217,4 +214,54 @@ bin_PROGRAMS = \
tools/json-validate \
tools/json-schema
tools_hash_LDADD = $(top_builddir)/libutil.a $(BOOST_FILESYSTEM_LIB) $(BOOST_SYSTEM_LIB) $(ZLIB_LIBS)
LDADD = $(top_builddir)/libutil.a $(BOOST_FILESYSTEM_LIB) $(BOOST_SYSTEM_LIB) $(ZLIB_LIBS)
##-----------------------------------------------------------------------------
## Tests
AM_LDFLAGS += $(BOOST_LDFLAGS) $(BOOST_FILESYSTEM_LIB) $(BOOST_SYSTEM_LIB)
AM_CXXFLAGS += -I$(top_srcdir)
TEST_BIN = \
test/backtrace \
test/bezier \
test/bitwise \
test/checksum \
test/colour \
test/extent \
test/fixed \
test/float \
test/hton \
test/ip \
test/json_types \
test/maths \
test/maths_matrix \
test/matrix \
test/md2 \
test/md4 \
test/md5 \
test/options \
test/point \
test/polynomial \
test/pool \
test/rand \
test/range \
test/region \
test/ripemd \
test/sha1 \
test/sha2 \
test/signal \
test/stringid \
test/uri \
test/version
if PLATFORM_WIN32
test_hton_LDFLAGS = -lws2_32
endif
TEST_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) $(top_srcdir)/build-aux/tap-driver.sh
TESTS = $(top_builddir)/test/static.test $(top_builddir)/test/json.test
check_PROGRAMS = $(TEST_BIN)
EXTRA_DIST += static.test json.test json

View File

@ -108,5 +108,6 @@ AC_CONFIG_FILES([
Makefile
test/Makefile
])
AC_CONFIG_FILES([test/json.test], [chmod a+x test/json.test])
AC_CONFIG_FILES([test/json.test], [chmod a+x test/json.test])
AC_CONFIG_FILES([test/static.test], [chmod a+x test/static.test])
AC_OUTPUT

View File

@ -1,47 +0,0 @@
AM_LDFLAGS = $(COMMON_LDFLAGS) $(BOOST_LDFLAGS) $(BOOST_FILESYSTEM_LIB) $(BOOST_SYSTEM_LIB)
AM_CXXFLAGS = $(COMMON_CXXFLAGS) -I$(top_srcdir)
TEST_BIN = \
backtrace \
bezier \
bitwise \
checksum \
colour \
extent \
fixed \
float \
hton \
ip \
json_types \
maths \
maths_matrix \
matrix \
md2 \
md4 \
md5 \
options \
point \
polynomial \
pool \
rand \
range \
region \
ripemd \
sha1 \
sha2 \
signal \
stringid \
uri \
version
AM_DEFAULT_SOURCE_EXT = .cpp
LDADD = $(builddir)/../libutil.a
if PLATFORM_WIN32
hton_LDFLAGS = -lws2_32
endif
TEST_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) $(top_srcdir)/build-aux/tap-driver.sh
TESTS = static.test json.test
check_PROGRAMS = $(TEST_BIN)
EXTRA_DIST = static.test json.test json

View File

@ -1,6 +1,6 @@
#!/bin/sh
tests=($(find . -type f -executable | grep -v test))
tests=($(find "@abs_top_builddir@/test/" -type f -executable | grep -v ".test$"))
echo 1..$((${#tests[@]}))