From: Frederic Lecaille Date: Wed, 18 Nov 2026 16:30:52 +0000 (+0100) Subject: MINOR: reg-tests: add --extra to run tests needing optional tools X-Git-Url: https://git.kaiwu.me/web/%22data:,/doc/static/%7B@url%7D?a=commitdiff_plain;h=f3d7324944e2880770d1f67a7363bee5f3e9451e;p=haproxy.git MINOR: reg-tests: add --extra to run tests needing optional tools Some VTC files need helper programs that are not built with HAProxy, such as the Python QUIC client in reg-tests/quic/qclient/. They cannot simply be typed 'slow' or 'devel' instead: their type says what they check, and the CI jobs select tests by type. Add a new --extra option to run-regtests.sh. A VTC file declares the helper it needs: #REGTEST_EXTRA=qclient and is skipped unless that name is listed in the --extra option. From the Makefile, options are passed after '--': $ make reg-tests -- --extra qclient The filter only adds tests: files without the directive, and the selection made by --type/REGTESTS_TYPES, are unchanged. Not to be backported: this is development tooling. --- diff --git a/Makefile b/Makefile index 87cbb0349..b27e36ba1 100644 --- a/Makefile +++ b/Makefile @@ -1424,6 +1424,10 @@ reg-tests-help: @echo " experimental: for scripts which are experimental, typically used to" @echo " develop new scripts." @echo + @echo "Tests which declare '#REGTEST_EXTRA=' are skipped, and only run" + @echo "when is passed to the script with --extra:" + @echo " $$ make reg-tests -- --extra qclient" + @echo @echo "Note that 'reg-tests' target run '"$(REG_TEST_SCRIPT)"' script" @echo "(see --help option of this script for more information)." diff --git a/scripts/run-regtests.sh b/scripts/run-regtests.sh index d864ab198..ba006f903 100755 --- a/scripts/run-regtests.sh +++ b/scripts/run-regtests.sh @@ -35,6 +35,12 @@ _help() run-regtest.sh --type slow,default + --extra also run the tests whose #REGTEST_EXTRA= directives are all + listed here, comma separated. Such tests are skipped by default, so that + tests relying on an optional helper do not run unless requested. + + run-regtests.sh --extra qclient + --clean to cleanup previous reg-tests log directories and exit run-regtests.sh --clean @@ -74,13 +80,14 @@ _findtests() { set -- $(grep '^#[0-9A-Z_]*=' "$i") IFS="$OLDIFS" - exclude_targets=""; regtest_type=""; excludedtarget="" + exclude_targets=""; regtest_type=""; excludedtarget=""; regtest_extra="" while [ $# -gt 0 ]; do v="$1"; v="${v#*=}" case "$1" in "#EXCLUDE_TARGETS="*) exclude_targets="$v" ;; "#REGTEST_TYPE="*) regtest_type="$v" ;; + "#REGTEST_EXTRA="*) regtest_extra="$v" ;; "#EXCLUDE_TARGET="*) excludedtarget="${v%,*}" ;; # Note: any new variable declared here must be initialized above. esac @@ -97,6 +104,17 @@ _findtests() { fi fi + if [ -n "$regtest_extra" ] ; then + IFS=","; set -- $regtest_extra; IFS="$OLDIFS" + for extra in "$@"; do + if ! $(echo "$REGTESTS_EXTRA" | grep -wq "$extra") ; then + echo " Skipped $i because its extra '"$extra"' is not enabled" >> "${TESTDIR}/skipped.log" + skiptest=1 + break + fi + done + fi + if [ -n "$excludedtarget" ]; then exclude_targets="$exclude_targets,$excludedtarget" fi @@ -171,6 +189,10 @@ _process() { REGTESTS_TYPES="$2" shift ;; + --extra) + REGTESTS_EXTRA="$2" + shift + ;; --clean) _cleanup exit 0 @@ -197,6 +219,7 @@ VTEST_PROGRAM="${VTEST_PROGRAM:-vtest}" VTEST_TIMEOUT="${VTEST_TIMEOUT:-10}" TESTDIR="${TMPDIR:-/tmp}" REGTESTS="" +REGTESTS_EXTRA="${REGTESTS_EXTRA:-}" LINEFEED=" "