]> git.kaiwu.me - haproxy.git/commitdiff
MINOR: reg-tests: add --extra to run tests needing optional tools
authorFrederic Lecaille <flecaille@haproxy.com>
Wed, 18 Nov 2026 16:30:52 +0000 (17:30 +0100)
committerFrederic Lecaille <flecaille@haproxy.com>
Wed, 18 Nov 2026 17:00:24 +0000 (18:00 +0100)
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.

Makefile
scripts/run-regtests.sh

index 87cbb0349c171601797b039fcab09b90a2ec29f4..b27e36ba15cef9bffda4771f0356c002da75d7e3 100644 (file)
--- 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=<name>' are skipped, and only run"
+       @echo "when <name> 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)."
 
index d864ab198f8ddda58c41f52f1fc26dcb2288cddf..ba006f9036d20dbc3e820a380202d5c4ff92aad3 100755 (executable)
@@ -35,6 +35,12 @@ _help()
 
       run-regtest.sh --type slow,default
 
+    --extra <names> 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="
 "