From ecc40f2315d8ad2488ef5a9a601152100f346588 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Fri, 13 Feb 2015 18:02:09 +1100 Subject: [PATCH] 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. --- Makefile.am | 55 ++++++++++++++++++++++++++-- configure.ac | 3 +- test/Makefile.am | 47 ------------------------ test/{static.test => static.test.in} | 2 +- 4 files changed, 54 insertions(+), 53 deletions(-) delete mode 100644 test/Makefile.am rename test/{static.test => static.test.in} (70%) diff --git a/Makefile.am b/Makefile.am index bcbd1596..7ec7f5f5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 diff --git a/configure.ac b/configure.ac index 043d8ba9..9fcd43f8 100644 --- a/configure.ac +++ b/configure.ac @@ -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 diff --git a/test/Makefile.am b/test/Makefile.am deleted file mode 100644 index 3c4c517d..00000000 --- a/test/Makefile.am +++ /dev/null @@ -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 diff --git a/test/static.test b/test/static.test.in similarity index 70% rename from test/static.test rename to test/static.test.in index 85f738a2..bbed8344 100755 --- a/test/static.test +++ b/test/static.test.in @@ -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[@]}))