From 90b70b61b154c68a98cf21d19225dc1dedb75ffb Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Tue, 16 Sep 2025 09:21:34 +0200 Subject: [PATCH] BUILD: makefile: implement support for running a command in range When running "make range", it would be convenient to support running reg tests or anything else such as "size", "pahole" or even benchmarks. Such commands are usually specific to the developer's environment, so let's just pass a generic variable TEST_CMD that is executed as-is if not empty. This way it becomes possible to run "make range RANGE=... TEST_CMD=...". --- Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile b/Makefile index 63df314ef..c710f3123 100644 --- a/Makefile +++ b/Makefile @@ -1283,6 +1283,8 @@ unit-tests: # options for all commits within RANGE. RANGE may be either a git range # such as ref1..ref2 or a single commit, in which case all commits from # the master branch to this one will be tested. +# Will execute TEST_CMD for each commit if defined, and will stop in case of +# failure. range: $(Q)[ -d .git/. ] || { echo "## Fatal: \"make $@\" may only be used inside a Git repository."; exit 1; } @@ -1308,6 +1310,7 @@ range: echo "[ $$index/$$count ] $$commit #############################"; \ git checkout -q $$commit || die 1; \ $(MAKE) all || die 1; \ + [ -z "$(TEST_CMD)" ] || $(TEST_CMD) || die 1; \ index=$$((index + 1)); \ done; \ echo;echo "Done! $${count} commit(s) built successfully for RANGE $${RANGE}" ; \