diff options
author | Mike Frysinger <vapier@gentoo.org> | 2021-10-23 01:12:47 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2021-10-23 01:12:47 -0400 |
commit | 8cda01a02f00f271050050823e6facae0a730da6 (patch) | |
tree | 34ac6b38424226b6aa6ad3b9cc277b0ba6acada2 | |
parent | build: hoist -Itop_srcdir to common AM_CPPFLAGS (diff) | |
download | sandbox-8cda01a02f00f271050050823e6facae0a730da6.tar.gz sandbox-8cda01a02f00f271050050823e6facae0a730da6.tar.bz2 sandbox-8cda01a02f00f271050050823e6facae0a730da6.zip |
tests: merge into top level makefile too
This kills off recursive make entirely.
Closes: https://bugs.gentoo.org/819411
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
-rw-r--r-- | .gitignore | 4 | ||||
-rw-r--r-- | Makefile.am | 9 | ||||
-rw-r--r-- | configure.ac | 1 | ||||
-rw-r--r-- | tests/Makefile | 4 | ||||
-rw-r--r-- | tests/Makefile.am | 134 | ||||
-rw-r--r-- | tests/local.mk | 140 |
6 files changed, 151 insertions, 141 deletions
@@ -8,8 +8,7 @@ a.out .libs .dirstamp /Makefile -/tests/Makefile -Makefile.in +/Makefile.in f f2 @@ -43,7 +42,6 @@ core /ltmain.sh /missing /stamp-h1 -/test.sh /m4/libtool.m4 /m4/ltoptions.m4 diff --git a/Makefile.am b/Makefile.am index cd5e3b3..07b1c6d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4,12 +4,13 @@ AM_CPPFLAGS = \ $(SANDBOX_DEFINES) \ -I$(top_srcdir) -SUBDIRS = tests - confdir = $(sysconfdir) confddir = $(sysconfdir)/sandbox.d bin_PROGRAMS = +check_PROGRAMS = +check_SCRIPTS = +dist_check_SCRIPTS = dist_conf_DATA = etc/sandbox.conf confd_DATA = etc/sandbox.d/00default dist_pkgdata_DATA = data/sandbox.bashrc @@ -17,6 +18,7 @@ lib_LTLIBRARIES = noinst_LTLIBRARIES = CLEANFILES = +DISTCLEANFILES = EXTRA_DIST = \ headers.h \ @@ -47,5 +49,6 @@ dist-hook: include libsandbox/local.mk include libsbutil/local.mk include src/local.mk +include tests/local.mk -DISTCLEANFILES = $(CLEANFILES) +DISTCLEANFILES += $(CLEANFILES) diff --git a/configure.ac b/configure.ac index 96c602f..0f2b0ea 100644 --- a/configure.ac +++ b/configure.ac @@ -471,7 +471,6 @@ AC_CONFIG_FILES([ Makefile etc/sandbox.d/00default tests/atlocal - tests/Makefile tests/package.m4 ]) AC_OUTPUT diff --git a/tests/Makefile b/tests/Makefile new file mode 100644 index 0000000..2eed23e --- /dev/null +++ b/tests/Makefile @@ -0,0 +1,4 @@ +# Helper for developers. +all: tests ; +clean: clean-checkPROGRAMS ; rm -f *.o *.l[ao] .libs/* +%: ; $(MAKE) -C .. $@ diff --git a/tests/Makefile.am b/tests/Makefile.am deleted file mode 100644 index 5bb476d..0000000 --- a/tests/Makefile.am +++ /dev/null @@ -1,134 +0,0 @@ -AT_FILES = $(wildcard $(srcdir)/*.at) -TESTSUITE = $(srcdir)/testsuite -DISTCLEANFILES = atconfig -EXTRA_DIST = atlocal.in package.m4.in $(AT_FILES) $(TESTSUITE) \ - test-skel-0.c \ - tests.h \ - xattr-0 - -AM_CPPFLAGS = -I$(top_srcdir) $(SANDBOX_DEFINES) - -check_PROGRAMS = \ - get-group \ - get-user \ - sb_true \ - sb_true_static \ - \ - access-0 \ - chmod-0 \ - chown-0 \ - creat-0 \ - creat64-0 \ - execv-0 \ - execvp-0 \ - faccessat-0 \ - fchmodat-0 \ - fchownat-0 \ - fopen-0 \ - fopen64-0 \ - futimesat-0 \ - lchown-0 \ - link-0 \ - linkat-0 \ - linkat_static-0 \ - lremovexattr-0 \ - lsetxattr-0 \ - lutimes-0 \ - mkdtemp-0 \ - mkdir-0 \ - mkdir_static-0 \ - mkdirat-0 \ - mkfifo-0 \ - mkfifoat-0 \ - mknod-0 \ - mknodat-0 \ - mkostemp-0 \ - mkostemp64-0 \ - mkostemps-0 \ - mkostemps64-0 \ - mkstemp-0 \ - mkstemp64-0 \ - mkstemps-0 \ - mkstemps64-0 \ - open-0 \ - open_static-0 \ - open64-0 \ - openat-0 \ - openat_static-0 \ - openat64-0 \ - opendir-0 \ - remove-0 \ - removexattr-0 \ - rename-0 \ - renameat-0 \ - renameat2-0 \ - rmdir-0 \ - setxattr-0 \ - signal_static-0 \ - symlink-0 \ - symlinkat-0 \ - truncate-0 \ - truncate64-0 \ - unlink-0 \ - unlink_static-0 \ - unlinkat-0 \ - utime-0 \ - utimensat-0 \ - utimensat_static-0 \ - utimes-0 \ - vfork-0 \ - \ - getcwd-gnulib_tst \ - libsigsegv_tst \ - malloc_hooked_tst \ - malloc_mmap_tst \ - pipe-fork_tst \ - pipe-fork_static_tst \ - sb_printf_tst \ - sigsuspend-zsh_tst \ - sigsuspend-zsh_static_tst \ - trace-memory_static_tst - -dist_check_SCRIPTS = \ - $(wildcard $(srcdir)/*-[0-9]*.sh) \ - malloc-0 \ - script-0 \ - trace-0 - -AM_LDFLAGS = `expr $@ : .*_static >/dev/null && echo -all-static` - -sb_printf_tst_CFLAGS = -I$(top_srcdir)/libsbutil -I$(top_srcdir)/libsbutil/include -sb_printf_tst_LDADD = $(top_builddir)/libsbutil/libsbutil.la - -malloc_hooked_tst_LDFLAGS = $(AM_LDFLAGS) -pthread - -libsigsegv_tst_CPPFLAGS = ${AM_CPPFLAGS} -if HAVE_LIBSIGSEGV -libsigsegv_tst_CPPFLAGS += -DHAVE_LIBSIGSEGV -libsigsegv_tst_LDADD = -lsigsegv -endif - -TESTSUITEFLAGS = --jobs=`getconf _NPROCESSORS_ONLN || echo 1` - -# Helper target for devs to precompile. -tests: $(check_PROGRAMS) - -check-local: atconfig atlocal $(TESTSUITE) - $(SHELL) '$(TESTSUITE)' AUTOTEST_PATH='src:tests' $(TESTSUITEFLAGS) - -installcheck-local: atconfig atlocal $(TESTSUITE) - $(SHELL) '$(TESTSUITE)' AUTOTEST_PATH='src:tests:$(bindir)' $(TESTSUITEFLAGS) - -clean-local: - test ! -f '$(TESTSUITE)' || \ - $(SHELL) '$(TESTSUITE)' --clean - -AUTOTEST = $(AUTOM4TE) --language=autotest -$(TESTSUITE): $(AT_FILES) testsuite.list.at - $(AUTOTEST) -I '$(srcdir)' -o $@.tmp $@.at - mv $@.tmp $@ - -testsuite.list.at: $(AT_FILES) - ( echo "dnl DO NOT EDIT: GENERATED BY MAKEFILE.AM"; \ - $(GREP) -l -e '^SB_CHECK' -e '^AT_CHECK' $(AT_FILES) | LC_ALL=C sort | \ - $(SED) -e 's:^[.]/:sb_inc([:' -e 's:[.]at$$:]):' ) > $@ diff --git a/tests/local.mk b/tests/local.mk new file mode 100644 index 0000000..0aac4f1 --- /dev/null +++ b/tests/local.mk @@ -0,0 +1,140 @@ +AT_FILES = $(wildcard $(top_srcdir)/%D%/*.at) +TESTSUITE = $(abs_top_srcdir)/%D%/testsuite +DISTCLEANFILES += %D%/atconfig + +EXTRA_DIST += \ + $(AT_FILES) \ + %D%/atlocal.in \ + %D%/package.m4.in \ + %D%/testsuite \ + %D%/test-skel-0.c \ + %D%/tests.h \ + %D%/xattr-0 + +check_PROGRAMS += \ + %D%/get-group \ + %D%/get-user \ + %D%/sb_true \ + %D%/sb_true_static \ + \ + %D%/access-0 \ + %D%/chmod-0 \ + %D%/chown-0 \ + %D%/creat-0 \ + %D%/creat64-0 \ + %D%/execv-0 \ + %D%/execvp-0 \ + %D%/faccessat-0 \ + %D%/fchmodat-0 \ + %D%/fchownat-0 \ + %D%/fopen-0 \ + %D%/fopen64-0 \ + %D%/futimesat-0 \ + %D%/lchown-0 \ + %D%/link-0 \ + %D%/linkat-0 \ + %D%/linkat_static-0 \ + %D%/lremovexattr-0 \ + %D%/lsetxattr-0 \ + %D%/lutimes-0 \ + %D%/mkdtemp-0 \ + %D%/mkdir-0 \ + %D%/mkdir_static-0 \ + %D%/mkdirat-0 \ + %D%/mkfifo-0 \ + %D%/mkfifoat-0 \ + %D%/mknod-0 \ + %D%/mknodat-0 \ + %D%/mkostemp-0 \ + %D%/mkostemp64-0 \ + %D%/mkostemps-0 \ + %D%/mkostemps64-0 \ + %D%/mkstemp-0 \ + %D%/mkstemp64-0 \ + %D%/mkstemps-0 \ + %D%/mkstemps64-0 \ + %D%/open-0 \ + %D%/open_static-0 \ + %D%/open64-0 \ + %D%/openat-0 \ + %D%/openat_static-0 \ + %D%/openat64-0 \ + %D%/opendir-0 \ + %D%/remove-0 \ + %D%/removexattr-0 \ + %D%/rename-0 \ + %D%/renameat-0 \ + %D%/renameat2-0 \ + %D%/rmdir-0 \ + %D%/setxattr-0 \ + %D%/signal_static-0 \ + %D%/symlink-0 \ + %D%/symlinkat-0 \ + %D%/truncate-0 \ + %D%/truncate64-0 \ + %D%/unlink-0 \ + %D%/unlink_static-0 \ + %D%/unlinkat-0 \ + %D%/utime-0 \ + %D%/utimensat-0 \ + %D%/utimensat_static-0 \ + %D%/utimes-0 \ + %D%/vfork-0 \ + \ + %D%/getcwd-gnulib_tst \ + %D%/libsigsegv_tst \ + %D%/malloc_hooked_tst \ + %D%/malloc_mmap_tst \ + %D%/pipe-fork_tst \ + %D%/pipe-fork_static_tst \ + %D%/sb_printf_tst \ + %D%/sigsuspend-zsh_tst \ + %D%/sigsuspend-zsh_static_tst \ + %D%/trace-memory_static_tst + +dist_check_SCRIPTS += \ + $(wildcard $(top_srcdir)/%D%/*-[0-9]*.sh) \ + %D%/malloc-0 \ + %D%/script-0 \ + %D%/trace-0 + +# This will be used by all programs, not just tests/ ... +AM_LDFLAGS = `expr $@ : .*_static >/dev/null && echo -all-static` + +%C%_sb_printf_tst_CFLAGS = -I$(top_srcdir)/libsbutil -I$(top_srcdir)/libsbutil/include +%C%_sb_printf_tst_LDADD = libsbutil/libsbutil.la + +%C%_malloc_hooked_tst_LDFLAGS = $(AM_LDFLAGS) -pthread + +%C%_libsigsegv_tst_CPPFLAGS = ${AM_CPPFLAGS} +if HAVE_LIBSIGSEGV +%C%_libsigsegv_tst_CPPFLAGS += -DHAVE_LIBSIGSEGV +%C%_libsigsegv_tst_LDADD = -lsigsegv +endif + +TESTSUITEFLAGS = --jobs=`getconf _NPROCESSORS_ONLN || echo 1` + +# Helper target for devs to precompile. +tests: $(check_PROGRAMS) $(TESTSUITE) + +check-local: %D%/atconfig %D%/atlocal $(TESTSUITE) + cd %D% && $(SHELL) '$(TESTSUITE)' AUTOTEST_PATH='src:tests' $(TESTSUITEFLAGS) + +installcheck-local: %D%/atconfig %D%/atlocal $(TESTSUITE) + cd %D% && $(SHELL) '$(TESTSUITE)' AUTOTEST_PATH='src:tests:$(bindir)' $(TESTSUITEFLAGS) + +clean-local: + test ! -f '$(TESTSUITE)' || { cd %D% && $(SHELL) '$(TESTSUITE)' --clean; } + +TESTSUITE_LIST = $(top_srcdir)/%D%/testsuite.list.at +AUTOTEST = $(AUTOM4TE) --language=autotest +$(TESTSUITE): $(AT_FILES) $(TESTSUITE_LIST) + @$(MKDIR_P) $(abs_top_srcdir)/%D% + $(AM_V_GEN)cd $(abs_top_srcdir)/%D% && $(AUTOTEST) -I. -o $@.tmp $@.at + $(AM_V_at)mv $@.tmp $@ + +$(TESTSUITE_LIST): $(AT_FILES) + @$(MKDIR_P) $(abs_top_srcdir)/%D% + $(AM_V_GEN)( echo "dnl DO NOT EDIT: GENERATED BY MAKEFILE.AM"; \ + $(GREP) -l -e '^SB_CHECK' -e '^AT_CHECK' $(AT_FILES) | LC_ALL=C sort | \ + $(SED) -e 's:^[^/]*/%D%/:sb_inc([:' -e 's:[.]at$$:]):' ) > $@ |