]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: makefile: implement support for running a command in range
authorWilly Tarreau <w@1wt.eu>
Tue, 16 Sep 2025 07:21:34 +0000 (09:21 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 16 Sep 2025 07:23:46 +0000 (09:23 +0200)
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

index 63df314ef25ab5c29fc2233940fb7a5f08b3c9c7..c710f31237d69dea345bce19404f78419e62c9db 100644 (file)
--- 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}" ; \