]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
allow some module tests to be run in parallel
authorAlan T. DeKok <aland@freeradius.org>
Wed, 31 Dec 2025 12:23:10 +0000 (07:23 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Wed, 31 Dec 2025 12:25:17 +0000 (07:25 -0500)
23 files changed:
src/tests/modules/all.mk
src/tests/modules/always/all.mk
src/tests/modules/attr_filter/all.mk
src/tests/modules/brotli/all.mk
src/tests/modules/chap/all.mk
src/tests/modules/crl/all.mk
src/tests/modules/detail/all.mk
src/tests/modules/dict/all.mk
src/tests/modules/dpsk/all.mk
src/tests/modules/eap_sim/all.mk
src/tests/modules/exec/all.mk
src/tests/modules/files/all.mk
src/tests/modules/idn/all.mk
src/tests/modules/json/all.mk
src/tests/modules/linelog/all.mk
src/tests/modules/lua/all.mk
src/tests/modules/mruby/all.mk
src/tests/modules/pap/all.mk
src/tests/modules/perl/all.mk
src/tests/modules/python/all.mk
src/tests/modules/test/all.mk
src/tests/modules/totp/all.mk
src/tests/modules/yubikey/all.mk

index bba4e982ef73b7e86d5c98c71f55b39cc5bc722c..3fc9821402cb58edde13b8d9945283ec84825293 100644 (file)
@@ -72,6 +72,44 @@ else
 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"
 #
@@ -79,6 +117,9 @@ $(foreach x,$(FILES),$(eval $(call MODULE_FILTER,$(firstword $(subst /, ,$x)),$x
 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
index 8f1127f1ecd76efa22c9bb996d04a5c8a05ba1dc..d98ba1c6a510a16951f67a22e7f5678f89a4bedb 100644 (file)
@@ -1,3 +1,4 @@
 #
 #  Test the "always" module
 #
+TEST.modules.$(lastword $(subst /, ,$(dir $(lastword $(MAKEFILE_LIST))))).parallel := 1
index dd6ddf85f0becfa48176e995b615fdee8d38f2cd..c99de382df9c8b150801d9597b6db294c2925f35 100644 (file)
@@ -1,3 +1,4 @@
 #
 #  Test the "attr_filter" module
 #
+TEST.modules.$(lastword $(subst /, ,$(dir $(lastword $(MAKEFILE_LIST))))).parallel := 1
index 709a7f40136097ac3e6b87af8d41fd5cb120bb72..a2e603726713fb4e6ebf5b063e139ee7487581bb 100644 (file)
@@ -1,3 +1,4 @@
 #
 #  Test the "brotli" module
 #
+TEST.modules.$(lastword $(subst /, ,$(dir $(lastword $(MAKEFILE_LIST))))).parallel := 1
index 71f527e55f15af648348debb4bda7fb52638aa1e..fc41305fd1a3cdf80931f2f44b4139d237229757 100644 (file)
@@ -1,3 +1,4 @@
 #
 #  Test the "chap" module
 #
+TEST.modules.$(lastword $(subst /, ,$(dir $(lastword $(MAKEFILE_LIST))))).parallel := 1
index 6d2146c75c7b7494ff0fbfef398aeb63dbfa792d..b7d0e11166e0212b3ecfd54c0ed7ac3ac284c12e 100644 (file)
@@ -1,3 +1,4 @@
 #
 #  Test the "crl" module
 #
+TEST.modules.$(lastword $(subst /, ,$(dir $(lastword $(MAKEFILE_LIST))))).parallel := 1
index 64e7964b2807e6a38547b2e6f3f882eede2d29b5..30ef870aa0e7217753bbe5832c881b929d056a03 100644 (file)
@@ -1,3 +1,4 @@
 #
 #  Test the "detail" module
 #
+TEST.modules.$(lastword $(subst /, ,$(dir $(lastword $(MAKEFILE_LIST))))).parallel := 1
index 79779c1963cb06875dcc9c74e760e5d9f58eaf25..ad5f4ab97c4eb8824921a050dd3f2e9334c111df 100644 (file)
@@ -1,3 +1,4 @@
 #
 #  Test the "dict" module
 #
+TEST.modules.$(lastword $(subst /, ,$(dir $(lastword $(MAKEFILE_LIST))))).parallel := 1
index 8bb0750536182a0772b706335e18dad74c6a789f..7837bf4f5ddf38bd41f26fa7e344e450a604ccd2 100644 (file)
@@ -1,3 +1,4 @@
 #
 #  Test the "dpsk" module
 #
+TEST.modules.$(lastword $(subst /, ,$(dir $(lastword $(MAKEFILE_LIST))))).parallel := 1
index ec75fd4f960504971df1b63772aebf7686c2745a..ec1c1f060e79b8b62a7c9a63788800d7cfca625f 100644 (file)
@@ -1,3 +1,4 @@
 #
 #  Test the eap_sim module
 #
+test.modules.$(lastword $(subst /, ,$(dir $(lastword $(makefile_list))))).parallel := 1
index 744ddb008cf99a3d9ef48cc2325783cb40ed196b..f738ebd983daaafddbbc3d950cef6dbc44477702 100644 (file)
@@ -1,3 +1,4 @@
 #
 #  Test the "exec" module
 #
+TEST.modules.$(lastword $(subst /, ,$(dir $(lastword $(MAKEFILE_LIST))))).parallel := 1
index 07449dba6546f4eb074fbbb953e6cf8799cb2bf7..0585fb60cfffd21a50ff6fd84b9f861779b4410b 100644 (file)
@@ -1,3 +1,4 @@
 #
 #  Test the "files" module
 #
+TEST.modules.$(lastword $(subst /, ,$(dir $(lastword $(MAKEFILE_LIST))))).parallel := 1
index 758d36f9be2bc5bf9ed6ccfff8939aa578cd3ac0..e48a71ba2eef60063f13a464907b3e92c72356bb 100644 (file)
@@ -1,3 +1,4 @@
 #
 #  Test the "idn" module
 #
+TEST.modules.$(lastword $(subst /, ,$(dir $(lastword $(MAKEFILE_LIST))))).parallel := 1
index 4d3197d3c498c29a2c8b460c6d34270dd6bfb8ae..d7f04f3b31a801dddbbea195d5d871369de40989 100644 (file)
@@ -1,3 +1,4 @@
 #
 #  Test the "json" module
 #
+TEST.modules.$(lastword $(subst /, ,$(dir $(lastword $(MAKEFILE_LIST))))).parallel := 1
index f3dbbc91ee420881f5b84f648c68ee4ac7945abd..24e49cca486a14d317429eb79fb81f7438f16e66 100644 (file)
@@ -1,3 +1,4 @@
 #
 #  Test the "linelog" module
 #
+TEST.modules.$(lastword $(subst /, ,$(dir $(lastword $(MAKEFILE_LIST))))).parallel := 1
index cd5fe28d7630ad760721fec7d384909cb6d17f15..7a1a00f35f1bf7b42627f09fbf15f602662af106 100644 (file)
@@ -1,6 +1,7 @@
 #
 #  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
index 33f1a0a3f94d61ce3679979511b3e74dbed99638..dd21394e7641698bf4ae31bc2c4a49a001abad5f 100644 (file)
@@ -1,3 +1,4 @@
 #
 #  Test the "mruby" module
 #
+TEST.modules.$(lastword $(subst /, ,$(dir $(lastword $(MAKEFILE_LIST))))).parallel := 1
index 5c1de6f39ebec6f2ae033472d9637528534e7abb..0aad5b7718d12d710f44fb7d58bc9c9f411d5d3b 100644 (file)
@@ -1,3 +1,4 @@
 #
 #  Test the "pap" module
 #
+TEST.modules.$(lastword $(subst /, ,$(dir $(lastword $(MAKEFILE_LIST))))).parallel := 1
index 1484ba8d9f8c8bf205b5d88a07921d080e5df9b7..664ed81beceec4a6c8a0f19c096b6fdb4337d870 100644 (file)
@@ -1,3 +1,4 @@
 #
 #  Test the "perl" module
 #
+TEST.modules.$(lastword $(subst /, ,$(dir $(lastword $(MAKEFILE_LIST))))).parallel := 1
index bd84bdb7ce008c1b1ef291b9f3f8a05f6c9694ed..4153732052e78212b2b1bce18a77a0fed0093d58 100644 (file)
@@ -1,6 +1,7 @@
 #
 #  Test the "python" module
 #
+TEST.modules.$(lastword $(subst /, ,$(dir $(lastword $(MAKEFILE_LIST))))).parallel := 1
 
 PYTHONPATH := $(top_builddir)/src/tests/modules/python/
 export PYTHONPATH
index ca38a222281c392bc28b12cc1469c6e600683e9b..f780b74417cc0ee7e56b16576be94264a16945f4 100644 (file)
@@ -1,3 +1,4 @@
 #
 # Test the "trigger" module
 #
+TEST.modules.$(lastword $(subst /, ,$(dir $(lastword $(MAKEFILE_LIST))))).parallel := 1
index 4c81981a4db8945ac7b3fdf86ad1eea82ee5f704..43618dfbbec76cdd8e94f67b26837584dc049621 100644 (file)
@@ -1,3 +1,4 @@
 #
 #  Test the "totp" module
 #
+TEST.modules.$(lastword $(subst /, ,$(dir $(lastword $(MAKEFILE_LIST))))).parallel := 1
index b62dbc2d266bcffae69cf5f1eacda9877e196849..15242383ba26a15a06b4a61d69d144d378ce26b7 100644 (file)
@@ -1,3 +1,4 @@
 #
 #  Test the "yubikey" module xlat
 #
+TEST.modules.$(lastword $(subst /, ,$(dir $(lastword $(MAKEFILE_LIST))))).parallel := 1