From c43847fe14e6b32cc58b8e8168f78e72ef94316d Mon Sep 17 00:00:00 2001 From: Jeremy Kerr Date: Mon, 28 Jul 2014 16:20:04 +0800 Subject: autotools: Use non-recursive make With the current testing infrastructure, we don't have a strictly hierarchical set of dependencies. This causes problems with a recursive make, and means we have to hack around some of the dependencies. This change generates a single, top-level makefile from all of the Makefile.am fragments. We still need the po/ directory as a separate SUBDIR, but all others can be converted to non-recursive. Signed-off-by: Jeremy Kerr --- test/Makefile.am | 10 +-- test/lib/Makefile.am | 41 ++++------ test/parser/Makefile.am | 198 +++++++++++++++++++++++------------------------- test/urls/Makefile.am | 45 +++++------ 4 files changed, 134 insertions(+), 160 deletions(-) (limited to 'test') diff --git a/test/Makefile.am b/test/Makefile.am index 6562836..427041b 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -17,10 +17,8 @@ AM_LOG_FLAGS = --leak-check=full --error-exitcode=1 export LOG_COMPILER AM_LOG_FLAGS endif -SUBDIRS = lib parser urls +noinst_SCRIPTS = test/hotplug-device.sh +EXTRA_DIST += $(noinst_SCRIPTS) -noinst_SCRIPTS = hotplug-device.sh - -EXTRA_DIST = $(noinst_SCRIPTS) - -MAINTAINERCLEANFILES = Makefile.in +$(check_PROGRAMS): AM_CFLAGS = -O0 -g -Wall -Wextra -Werror +$(check_PROGRAMS): AM_CPPFLAGS = -DDEBUG -I$(top_srcdir)/lib diff --git a/test/lib/Makefile.am b/test/lib/Makefile.am index 23bee36..9636b08 100644 --- a/test/lib/Makefile.am +++ b/test/lib/Makefile.am @@ -11,30 +11,21 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -AUTOMAKE_OPTIONS = parallel-tests +lib_TESTS = \ + test/lib/list-test \ + test/lib/test-process-noargs \ + test/lib/test-process-sync \ + test/lib/test-process-sync-stdout \ + test/lib/test-process-stderr \ + test/lib/test-process-stderr-stdout \ + test/lib/test-process-async \ + test/lib/test-process-async-stdout \ + test/lib/test-process-parent-stdout \ + test/lib/test-process-both \ + test/lib/test-process-stdout-eintr \ + test/lib/test-fold -AM_CPPFLAGS = \ - -I$(top_srcdir) \ - -I$(top_srcdir)/lib \ - -DDEBUG +$(lib_TESTS): LIBS += $(core_lib) -AM_CFLAGS = -O0 -ggdb -Wall -Wextra -Werror - -LDADD = ../../lib/libpbcore.la - -check_PROGRAMS = list-test \ - test-process-noargs \ - test-process-sync \ - test-process-sync-stdout \ - test-process-stderr \ - test-process-stderr-stdout \ - test-process-async \ - test-process-async-stdout \ - test-process-parent-stdout \ - test-process-both \ - test-process-stdout-eintr \ - test-fold - -TESTS = $(check_PROGRAMS) - -MAINTAINERCLEANFILES = Makefile.in +check_PROGRAMS += $(lib_TESTS) +TESTS += $(lib_TESTS) diff --git a/test/parser/Makefile.am b/test/parser/Makefile.am index f0eff9e..685d7ac 100644 --- a/test/parser/Makefile.am +++ b/test/parser/Makefile.am @@ -11,117 +11,111 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -AUTOMAKE_OPTIONS = parallel-tests foreign - -AM_CPPFLAGS = \ - -I$(top_srcdir) \ - -I$(top_srcdir)/lib \ - -I$(top_srcdir)/discover \ - -DLOCAL_STATE_DIR='"$(localstatedir)"' \ - -DTEST_CONF_BASE='"$(srcdir)/data"' \ - -DDEBUG -DPETITBOOT_TEST - -AM_CFLAGS = -O0 -ggdb -Wall -Wextra -Werror - -LDADD = $(top_builddir)/lib/libpbcore.la libtest.ro - -TESTS = \ - test-null \ - test-grub2-single \ - test-grub2-default \ - test-grub2-empty \ - test-grub2-default-index \ - test-grub2-default-multiword \ - test-grub2-multiple-resolve \ - test-grub2-multiple-id \ - test-grub2-single-line-if \ - test-grub2-load-env \ - test-grub2-save-env \ - test-grub2-saved-default \ - test-grub2-nondefault-prefix \ - test-grub2-f18-ppc64 \ - test-grub2-f20-ppc64 \ - test-grub2-ubuntu-13_04-x86 \ - test-grub2-lexer-error \ - test-grub2-parser-error \ - test-kboot-single \ - test-yaboot-empty \ - test-yaboot-single \ - test-yaboot-partition \ - test-yaboot-partition-override \ - test-yaboot-external \ - test-yaboot-root-global \ - test-yaboot-root-override \ - test-yaboot-device-override \ - test-yaboot-global-state \ - test-yaboot-leftovers \ - test-yaboot-default \ - test-yaboot-rh8-ppc64 \ - test-pxe-empty \ - test-pxe-single \ - test-pxe-initrd-in-append \ - test-pxe-mac-without-conf \ - test-pxe-ip-without-conf \ - test-pxe-non-url-conf \ - test-pxe-local \ - test-pxe-pathprefix-with-conf \ - test-pxe-non-url-pathprefix-with-conf \ - test-pxe-pathprefix-discover \ - test-pxe-pathprefix-discover-mac \ - test-pxe-path-resolve-relative \ - test-pxe-path-resolve-absolute \ - test-pxe-discover-bootfile-root \ - test-pxe-discover-bootfile-subdir \ - test-pxe-discover-bootfile-pathprefix \ - test-pxe-discover-bootfile-relative-conffile \ - test-pxe-discover-bootfile-absolute-conffile \ - test-unresolved-remove - -$(TESTS): %: %.embedded-config.o -$(TESTS): LDADD += $@.embedded-config.o - -extract_config = $(srcdir)/extract-config.awk +parser_TESTS = \ + test/parser/test-null \ + test/parser/test-grub2-single \ + test/parser/test-grub2-default \ + test/parser/test-grub2-empty \ + test/parser/test-grub2-default-index \ + test/parser/test-grub2-default-multiword \ + test/parser/test-grub2-multiple-resolve \ + test/parser/test-grub2-multiple-id \ + test/parser/test-grub2-single-line-if \ + test/parser/test-grub2-load-env \ + test/parser/test-grub2-save-env \ + test/parser/test-grub2-saved-default \ + test/parser/test-grub2-nondefault-prefix \ + test/parser/test-grub2-f18-ppc64 \ + test/parser/test-grub2-f20-ppc64 \ + test/parser/test-grub2-ubuntu-13_04-x86 \ + test/parser/test-grub2-lexer-error \ + test/parser/test-grub2-parser-error \ + test/parser/test-kboot-single \ + test/parser/test-yaboot-empty \ + test/parser/test-yaboot-single \ + test/parser/test-yaboot-partition \ + test/parser/test-yaboot-partition-override \ + test/parser/test-yaboot-external \ + test/parser/test-yaboot-root-global \ + test/parser/test-yaboot-root-override \ + test/parser/test-yaboot-device-override \ + test/parser/test-yaboot-global-state \ + test/parser/test-yaboot-leftovers \ + test/parser/test-yaboot-default \ + test/parser/test-yaboot-rh8-ppc64 \ + test/parser/test-pxe-empty \ + test/parser/test-pxe-single \ + test/parser/test-pxe-initrd-in-append \ + test/parser/test-pxe-mac-without-conf \ + test/parser/test-pxe-ip-without-conf \ + test/parser/test-pxe-non-url-conf \ + test/parser/test-pxe-local \ + test/parser/test-pxe-pathprefix-with-conf \ + test/parser/test-pxe-non-url-pathprefix-with-conf \ + test/parser/test-pxe-pathprefix-discover \ + test/parser/test-pxe-pathprefix-discover-mac \ + test/parser/test-pxe-path-resolve-relative \ + test/parser/test-pxe-path-resolve-absolute \ + test/parser/test-pxe-discover-bootfile-root \ + test/parser/test-pxe-discover-bootfile-subdir \ + test/parser/test-pxe-discover-bootfile-pathprefix \ + test/parser/test-pxe-discover-bootfile-relative-conffile \ + test/parser/test-pxe-discover-bootfile-absolute-conffile \ + test/parser/test-unresolved-remove + +TESTS += $(parser_TESTS) +check_PROGRAMS += $(parser_TESTS) test/parser/libtest.ro + +check_DATA += \ + test/parser/data/grub2-f18-ppc64.conf \ + test/parser/data/grub2-f20-ppc.conf \ + test/parser/data/grub2-ubuntu-13_04-x86.conf \ + test/parser/data/yaboot-rh8-ppc64.conf + +$(parser_TESTS): AM_CPPFLAGS += \ + -I$(top_srcdir)/discover \ + -DLOCAL_STATE_DIR='"$(localstatedir)"' +$(parser_TESTS): LDADD += $@.embedded-config.o test/parser/libtest.ro $(core_lib) +$(parser_TESTS): %: %.embedded-config.o test/parser/libtest.ro + +extract_config = $(srcdir)/test/parser/extract-config.awk %.embedded-config.c: %.c $(extract_config) $(AWK) -f $(extract_config) $< > $@ # objects under test -parser_objs = \ - $(top_srcdir)/discover/yaboot-parser.c \ - $(top_srcdir)/discover/kboot-parser.c \ - $(top_srcdir)/discover/pxe-parser.c \ - $(top_srcdir)/discover/platform.c \ - $(top_srcdir)/discover/resource.c \ - $(top_srcdir)/discover/paths.c \ - $(top_srcdir)/discover/device-handler.c \ - $(top_srcdir)/discover/parser-conf.c \ - $(top_srcdir)/discover/user-event.c \ - $(top_srcdir)/discover/event.c - -libtest_ro_SOURCES = \ - main.c \ - utils.c \ - handler.c \ - parser-test.h \ - $(parser_objs) -libtest_ro_LDADD = \ - ../../discover/grub2/grub2-parser.ro +test_parser_libtest_ro_SOURCES = \ + test/parser/main.c \ + test/parser/utils.c \ + test/parser/handler.c \ + test/parser/parser-test.h \ + discover/yaboot-parser.c \ + discover/kboot-parser.c \ + discover/pxe-parser.c \ + discover/platform.c \ + discover/resource.c \ + discover/paths.c \ + discover/device-handler.c \ + discover/parser-conf.c \ + discover/user-event.c \ + discover/event.c \ + $(discover_grub2_grub2_parser_ro_SOURCES) + +test_parser_libtest_ro_CPPFLAGS = \ + $(AM_CPPFLAGS) \ + -I$(top_srcdir)/discover \ + -I$(top_srcdir)/discover/grub2 \ + -DPETITBOOT_TEST \ + -DLOCAL_STATE_DIR='"$(localstatedir)"' \ + -DTEST_CONF_BASE='"$(top_srcdir)/test/parser/data"' -libtest.ro$(EXEEXT): $(libtest_ro_OBJECTS) $(libtest_ro_LDADD) +test/parser/libtest.ro$(EXEEXT): $(test_parser_libtest_ro_OBJECTS) \ + $(test_parser_libtest_ro_LDADD) $(LD) -o $@ -r $^ -check_PROGRAMS = $(TESTS) libtest.ro - -check_DATA = \ - data/grub2-f18-ppc64.conf \ - data/grub2-f20-ppc.conf \ - data/grub2-ubuntu-13_04-x86.conf \ - data/yaboot-rh8-ppc64.conf - -EXTRA_DIST = $(check_DATA) $(extract_config) +EXTRA_DIST += $(check_DATA) $(extract_config) -CLEANFILES = \ +CLEANFILES += \ $(foreach f, $(TESTS), $(f).embedded-config.c $(f).embedded-config.o) -MAINTAINERCLEANFILES = Makefile.in diff --git a/test/urls/Makefile.am b/test/urls/Makefile.am index fbdf792..47040ae 100644 --- a/test/urls/Makefile.am +++ b/test/urls/Makefile.am @@ -11,32 +11,24 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -AUTOMAKE_OPTIONS = parallel-tests +check_PROGRAMS += test/urls/parse-url +check_SCRIPTS += test/urls/run-url-test -AM_CPPFLAGS = \ - -I$(top_srcdir) \ - -I$(top_srcdir)/lib \ - $(DEFAULT_CPPFLAGS) +test_urls_parse_url_SOURCES = test/urls/parse-url.c +test_urls_parse_url_LDADD = $(core_lib) -AM_CFLAGS = \ - $(DEFAULT_CFLAGS) +url_TESTS = \ + test/urls/data/double-slash.test \ + test/urls/data/http-simple.test \ + test/urls/data/join-full.test \ + test/urls/data/join-absolute.test \ + test/urls/data/join-relative.test \ + test/urls/data/localpath.test -parse_url_SOURCES = parse-url.c - -parse_url_LDADD = ../../lib/libpbcore.la - -check_PROGRAMS = parse-url -check_SCRIPTS = run-url-test - -TESTS = data/double-slash.test \ - data/http-simple.test \ - data/join-full.test \ - data/join-absolute.test \ - data/join-relative.test \ - data/localpath.test +TESTS += $(url_TESTS) TEST_EXTENSIONS = .test -TEST_LOG_COMPILER = $(builddir)/run-url-test +TEST_LOG_COMPILER = $(builddir)/test/urls/run-url-test if ENABLE_TEST_VALGRIND TEST_LOG_FLAGS = --valgrind @@ -46,18 +38,17 @@ edit = sed \ -e 's|@PACKAGE_NAME\@|$(PACKAGE_NAME)|g' \ -e 's|@PACKAGE_VERSION\@|$(PACKAGE_VERSION)|g' \ -e 's|@PACKAGE_BUGREPORT\@|$(PACKAGE_BUGREPORT)|g' \ - -e 's|@abs_srcdir\@|$(abs_srcdir)|g' \ - -e 's|@abs_builddir\@|$(abs_builddir)|g' \ + -e 's|@abs_srcdir\@|$(abs_srcdir)/test/urls|g' \ + -e 's|@abs_builddir\@|$(abs_builddir)/test/urls|g' \ -e 's|@prefix\@|$(prefix)|g' -EXTRA_DIST = $(TESTS) run-url-test.in +EXTRA_DIST += $(url_TESTS) test/urls/run-url-test.in -run-url-test: Makefile $(srcdir)/run-url-test.in +test/urls/run-url-test: $(srcdir)/test/urls/run-url-test.in rm -f $@ $@.tmp $(edit) $(srcdir)/$@.in >$@.tmp chmod +x $@.tmp mv $@.tmp $@ -CLEANFILES = run-url-test +CLEANFILES += test/urls/run-url-test -MAINTAINERCLEANFILES = Makefile.in -- cgit v1.2.1