endif
endef
+######################################################################
+#
+# Ensure that tests in one directory run in sequence.
+#
+# If the magic macro is set: TEST.modules.foo.parallel=1
+# then the tests in that directory can be run in parallel.
+#
+# Each "foo/all.mk" file contains a horrible GNU Make thing which
+# automatically uses the correct name. This is so that we can just
+# copy the macro to a new file, and don't have to edit it for each
+# directory.
+#
+# If there's no macro defined for this subdirectory, then define it
+# to be the current test.
+#
+# Otherwise, make the current test depend on the previous one.
+# Then redefine the macro to be the current test.
+#
+# This creates a "chain" of dependencies for all tests in a
+# subdirectory, so that they run in series.
+#
+# We only do this if the module is explicitly marked as can
+# parallelize.
+#
+# Use $(eval $(call TEST_MODULES_DEPS))
+#
+######################################################################
+define TEST_MODULES_DEPS
+ifneq "$(TEST.modules.$(subst /,,$(dir $1)).parallel)" ""
+ifeq "$(OUTPUT.modules.$(dir $1))" ""
+OUTPUT.modules.$(dir $1) := $(OUTPUT)/$1
+else
+$(OUTPUT.modules.$(dir $1)): $(OUTPUT)/$1
+OUTPUT.modules.$(dir $1) := $(OUTPUT)/$1
+endif
+endif
+endef
+
#
# Ensure that "rlm_foo.a" is built when we run a module from directory "foo"
#
FILES := $(filter-out $(FILES_SKIP),$(FILES))
$(eval $(call TEST_BOOTSTRAP))
+$(foreach x,$(FILES),$(eval $(call TEST_MODULES_DEPS,$x)))
+
+
#
# For each output file, find the rlm_*.la module which it needs,
# and make the output file depend on the library. That way if the
#
# Test the "always" module
#
+TEST.modules.$(lastword $(subst /, ,$(dir $(lastword $(MAKEFILE_LIST))))).parallel := 1
#
# Test the "attr_filter" module
#
+TEST.modules.$(lastword $(subst /, ,$(dir $(lastword $(MAKEFILE_LIST))))).parallel := 1
#
# Test the "brotli" module
#
+TEST.modules.$(lastword $(subst /, ,$(dir $(lastword $(MAKEFILE_LIST))))).parallel := 1
#
# Test the "chap" module
#
+TEST.modules.$(lastword $(subst /, ,$(dir $(lastword $(MAKEFILE_LIST))))).parallel := 1
#
# Test the "crl" module
#
+TEST.modules.$(lastword $(subst /, ,$(dir $(lastword $(MAKEFILE_LIST))))).parallel := 1
#
# Test the "detail" module
#
+TEST.modules.$(lastword $(subst /, ,$(dir $(lastword $(MAKEFILE_LIST))))).parallel := 1
#
# Test the "dict" module
#
+TEST.modules.$(lastword $(subst /, ,$(dir $(lastword $(MAKEFILE_LIST))))).parallel := 1
#
# Test the "dpsk" module
#
+TEST.modules.$(lastword $(subst /, ,$(dir $(lastword $(MAKEFILE_LIST))))).parallel := 1
#
# Test the eap_sim module
#
+test.modules.$(lastword $(subst /, ,$(dir $(lastword $(makefile_list))))).parallel := 1
#
# Test the "exec" module
#
+TEST.modules.$(lastword $(subst /, ,$(dir $(lastword $(MAKEFILE_LIST))))).parallel := 1
#
# Test the "files" module
#
+TEST.modules.$(lastword $(subst /, ,$(dir $(lastword $(MAKEFILE_LIST))))).parallel := 1
#
# Test the "idn" module
#
+TEST.modules.$(lastword $(subst /, ,$(dir $(lastword $(MAKEFILE_LIST))))).parallel := 1
#
# Test the "json" module
#
+TEST.modules.$(lastword $(subst /, ,$(dir $(lastword $(MAKEFILE_LIST))))).parallel := 1
#
# Test the "linelog" module
#
+TEST.modules.$(lastword $(subst /, ,$(dir $(lastword $(MAKEFILE_LIST))))).parallel := 1
#
# Test the "lua" module
#
+TEST.modules.$(lastword $(subst /, ,$(dir $(lastword $(MAKEFILE_LIST))))).parallel := 1
LUA_PATH := $(top_builddir)/src/tests/modules/lua/
export LUA_PATH
#
# Test the "mruby" module
#
+TEST.modules.$(lastword $(subst /, ,$(dir $(lastword $(MAKEFILE_LIST))))).parallel := 1
#
# Test the "pap" module
#
+TEST.modules.$(lastword $(subst /, ,$(dir $(lastword $(MAKEFILE_LIST))))).parallel := 1
#
# Test the "perl" module
#
+TEST.modules.$(lastword $(subst /, ,$(dir $(lastword $(MAKEFILE_LIST))))).parallel := 1
#
# Test the "python" module
#
+TEST.modules.$(lastword $(subst /, ,$(dir $(lastword $(MAKEFILE_LIST))))).parallel := 1
PYTHONPATH := $(top_builddir)/src/tests/modules/python/
export PYTHONPATH
#
# Test the "trigger" module
#
+TEST.modules.$(lastword $(subst /, ,$(dir $(lastword $(MAKEFILE_LIST))))).parallel := 1
#
# Test the "totp" module
#
+TEST.modules.$(lastword $(subst /, ,$(dir $(lastword $(MAKEFILE_LIST))))).parallel := 1
#
# Test the "yubikey" module xlat
#
+TEST.modules.$(lastword $(subst /, ,$(dir $(lastword $(MAKEFILE_LIST))))).parallel := 1