Skip to content

Commit

Permalink
autoconf: use include directives instead of recursing down tests (mos…
Browse files Browse the repository at this point in the history
…tly)

Only down to tests/zfs-tests/tests, but pull out C programs into the
main Makefile ‒ this means we get correct dependency tracking for all
programs (and parallelise across them)

dist diff:
  -zfs-2.1.99/tests/zfs-tests/tests/stress/
  -zfs-2.1.99/tests/zfs-tests/tests/stress/Makefile.am
  -zfs-2.1.99/tests/zfs-tests/tests/stress/Makefile.in

Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes openzfs#13316
  • Loading branch information
nabijaczleweli authored and behlendorf committed May 10, 2022
1 parent 48f4379 commit 0425d58
Show file tree
Hide file tree
Showing 19 changed files with 169 additions and 253 deletions.
3 changes: 1 addition & 2 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ include $(srcdir)/%D%/rpm/Makefile.am
endif

if CONFIG_USER
SUBDIRS += . tests
include $(srcdir)/%D%/cmd/Makefile.am
include $(srcdir)/%D%/contrib/Makefile.am
include $(srcdir)/%D%/etc/Makefile.am
include $(srcdir)/%D%/lib/Makefile.am
include $(srcdir)/%D%/man/Makefile.am
include $(srcdir)/%D%/scripts/Makefile.am
include $(srcdir)/%D%/tests/Makefile.am
if BUILD_LINUX
include $(srcdir)/%D%/udev/Makefile.am
endif
Expand Down Expand Up @@ -98,7 +98,6 @@ dist-hook:
PHONY += codecheck $(CHECKS)
codecheck: $(CHECKS)

SHELLCHECKDIRS = tests
SHELLCHECKSCRIPTS += autogen.sh

PHONY += checkstyle
Expand Down
2 changes: 1 addition & 1 deletion config/CppCheck.am
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ CPPCHECKDIRS =
CPPCHECKTARGETS =

cppcheck-recursive-%:
$(MAKE) -C $(subst ^,/,$(subst cppcheck-recursive-,,$@)) cppcheck
$(MAKE) -C $(subst cppcheck-recursive-,,$@) cppcheck

_CTGT = $(subst cppcheck-for-,,$@)
cppcheck-for-%:
Expand Down
14 changes: 4 additions & 10 deletions config/Shellcheck.am
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ JUST_SHELLCHECK_OPTS = $(addprefix shellcheck-here-,$(subst /,^,$(1)))
JUST_CHECKBASHISMS_OPTS = $(addprefix checkbashisms-here-,$(subst /,^,$(1)))
SHELLCHECK_OPTS = $(call JUST_SHELLCHECK_OPTS,$(1)) $(call JUST_CHECKBASHISMS_OPTS,$(1))

PHONY += shellcheck shellcheck-recursive

shellcheck-recursive:
@set -e; for dir in $(SHELLCHECKDIRS); do $(MAKE) -C $$dir shellcheck; done
PHONY += shellcheck

_STGT = $(subst ^,/,$(subst shellcheck-here-,,$@))
shellcheck-here-%:
Expand All @@ -25,13 +22,10 @@ else
@echo "skipping shellcheck of" $(_STGT) "because shellcheck is not installed"
endif

shellcheck: $(SHELLCHECKSCRIPTS) $(call JUST_SHELLCHECK_OPTS,$(SHELLCHECKSCRIPTS)) shellcheck-recursive

shellcheck: $(SHELLCHECKSCRIPTS) $(call JUST_SHELLCHECK_OPTS,$(SHELLCHECKSCRIPTS))

PHONY += checkbashisms checkbashisms-recursive

checkbashisms-recursive:
@set -e; for dir in $(SHELLCHECKDIRS); do $(MAKE) -C $$dir checkbashisms; done
PHONY += checkbashisms

# command -v *is* specified by POSIX and every shell in existence supports it
_BTGT = $(subst ^,/,$(subst checkbashisms-here-,,$@))
Expand All @@ -43,4 +37,4 @@ else
@echo "skipping checkbashisms of" $(_BTGT) "because checkbashisms is not installed"
endif

checkbashisms: $(SHELLCHECKSCRIPTS) $(call JUST_CHECKBASHISMS_OPTS,$(SHELLCHECKSCRIPTS)) checkbashisms-recursive
checkbashisms: $(SHELLCHECKSCRIPTS) $(call JUST_CHECKBASHISMS_OPTS,$(SHELLCHECKSCRIPTS))
11 changes: 0 additions & 11 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,6 @@ AC_CONFIG_FILES([
rpm/redhat/zfs-dkms.spec
rpm/redhat/zfs-kmod.spec
rpm/redhat/zfs.spec
tests/Makefile
tests/runfiles/Makefile
tests/test-runner/Makefile
tests/test-runner/bin/Makefile
tests/test-runner/include/Makefile
tests/zfs-tests/Makefile
tests/zfs-tests/callbacks/Makefile
tests/zfs-tests/cmd/Makefile
tests/zfs-tests/include/Makefile
tests/zfs-tests/tests/Makefile
tests/zfs-tests/tests/functional/Makefile
tests/zfs-tests/tests/functional/acl/Makefile
Expand Down Expand Up @@ -196,7 +187,6 @@ AC_CONFIG_FILES([
tests/zfs-tests/tests/functional/features/large_dnode/Makefile
tests/zfs-tests/tests/functional/grow/Makefile
tests/zfs-tests/tests/functional/history/Makefile
tests/zfs-tests/tests/functional/hkdf/Makefile
tests/zfs-tests/tests/functional/inheritance/Makefile
tests/zfs-tests/tests/functional/inuse/Makefile
tests/zfs-tests/tests/functional/io/Makefile
Expand Down Expand Up @@ -264,7 +254,6 @@ AC_CONFIG_FILES([
tests/zfs-tests/tests/perf/fio/Makefile
tests/zfs-tests/tests/perf/regression/Makefile
tests/zfs-tests/tests/perf/scripts/Makefile
tests/zfs-tests/tests/stress/Makefile
zfs.release
])

Expand Down
32 changes: 27 additions & 5 deletions tests/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,8 +1,30 @@
PHONY =
include $(top_srcdir)/config/Shellcheck.am
include $(srcdir)/%D%/zfs-tests/Makefile.am

SUBDIRS = runfiles test-runner zfs-tests

EXTRA_DIST = README.md
scripts_test_runner_bindir = $(datadir)/$(PACKAGE)/test-runner/bin
scripts_test_runner_bin_SCRIPTS = \
%D%/test-runner/bin/test-runner.py \
%D%/test-runner/bin/zts-report.py

SHELLCHECKSCRIPTS += $(shell find $(srcdir) -name '*.sh')
SUBSTFILES += $(scripts_test_runner_bin_SCRIPTS)


scripts_test_runner_includedir = $(datadir)/$(PACKAGE)/test-runner/include
dist_scripts_test_runner_include_DATA = \
%D%/test-runner/include/logapi.shlib


scripts_runfilesdir = $(datadir)/$(PACKAGE)/runfiles
dist_scripts_runfiles_DATA = \
%D%/runfiles/common.run \
%D%/runfiles/freebsd.run \
%D%/runfiles/linux.run \
%D%/runfiles/longevity.run \
%D%/runfiles/perf-regression.run \
%D%/runfiles/sanity.run \
%D%/runfiles/sunos.run


EXTRA_DIST += $(addprefix %D%/,README.md)

SHELLCHECKSCRIPTS += $(shell find $(srcdir)/%D% -name '*.sh')
9 changes: 0 additions & 9 deletions tests/runfiles/Makefile.am

This file was deleted.

1 change: 0 additions & 1 deletion tests/test-runner/Makefile.am

This file was deleted.

10 changes: 0 additions & 10 deletions tests/test-runner/bin/Makefile.am

This file was deleted.

4 changes: 0 additions & 4 deletions tests/test-runner/include/Makefile.am

This file was deleted.

49 changes: 48 additions & 1 deletion tests/zfs-tests/Makefile.am
Original file line number Diff line number Diff line change
@@ -1 +1,48 @@
SUBDIRS = cmd include tests callbacks
SUBDIRS += %D%/tests

include $(srcdir)/%D%/cmd/Makefile.am


scripts_zfs_tests_functional_libzfsdir = $(datadir)/$(PACKAGE)/zfs-tests/tests/functional/libzfs
scripts_zfs_tests_functional_libzfs_PROGRAMS = %D%/tests/functional/libzfs/many_fds
%C%_tests_functional_libzfs_many_fds_LDADD = \
libzfs.la

scripts_zfs_tests_functional_hkdfdir = $(datadir)/$(PACKAGE)/zfs-tests/tests/functional/hkdf
scripts_zfs_tests_functional_hkdf_PROGRAMS = %D%/tests/functional/hkdf/hkdf_test
%C%_tests_functional_hkdf_hkdf_test_LDADD = \
libzpool.la

if BUILD_LINUX
scripts_zfs_tests_functional_tmpfiledir = $(datadir)/$(PACKAGE)/zfs-tests/tests/functional/tmpfile
scripts_zfs_tests_functional_tmpfile_PROGRAMS = \
%D%/tests/functional/tmpfile/tmpfile_001_pos \
%D%/tests/functional/tmpfile/tmpfile_002_pos \
%D%/tests/functional/tmpfile/tmpfile_003_pos \
%D%/tests/functional/tmpfile/tmpfile_stat_mode \
%D%/tests/functional/tmpfile/tmpfile_test
endif


scripts_zfs_tests_callbacksdir = $(datadir)/$(PACKAGE)/zfs-tests/callbacks
dist_scripts_zfs_tests_callbacks_SCRIPTS = \
%D%/callbacks/zfs_dbgmsg.ksh \
%D%/callbacks/zfs_dmesg.ksh \
%D%/callbacks/zfs_failsafe.ksh \
%D%/callbacks/zfs_mmp.ksh


scripts_zfs_tests_includedir = $(datadir)/$(PACKAGE)/zfs-tests/include
dist_scripts_zfs_tests_include_DATA = \
%D%/include/blkdev.shlib \
%D%/include/commands.cfg \
%D%/include/libtest.shlib \
%D%/include/math.shlib \
%D%/include/properties.shlib \
%D%/include/tunables.cfg \
%D%/include/zpool_script.shlib

nodist_scripts_zfs_tests_include_DATA = \
%D%/include/default.cfg

SUBSTFILES += $(nodist_scripts_zfs_tests_include_DATA)
6 changes: 0 additions & 6 deletions tests/zfs-tests/callbacks/Makefile.am

This file was deleted.

Loading

0 comments on commit 0425d58

Please sign in to comment.