diff --git a/scripts/run-regtests.sh b/scripts/run-regtests.sh index da20ae3dd..e6cb0e6cf 100755 --- a/scripts/run-regtests.sh +++ b/scripts/run-regtests.sh @@ -56,9 +56,11 @@ _help() # Below option is required to complete this test successfully #REQUIRE_OPTION=OPENSSL, this test needs OPENSSL compiled in. - #REQUIRE_OPTIONS=ZLIB|SLZ,OPENSSL,LUA + #REQUIRE_SERVICE=prometheus-exporter + #REQUIRE_SERVICES=prometheus-exporter,foo + # To define a range of versions that a test can run with: #REQUIRE_VERSION=0.0 #REQUIRE_VERSION_BELOW=99.9 @@ -133,6 +135,7 @@ _findtests() { require_version="$(sed -ne 's/^#REQUIRE_VERSION=//p' "$i")" require_version_below="$(sed -ne 's/^#REQUIRE_VERSION_BELOW=//p' "$i")" require_options="$(sed -ne 's/^#REQUIRE_OPTIONS=//p' "$i" | sed -e 's/,/ /g')" + require_services="$(sed -ne 's/^#REQUIRE_SERVICES=//p' "$i" | sed -e 's/,/ /g')" exclude_targets="$(sed -ne 's/^#EXCLUDE_TARGETS=//p' "$i" | sed -e 's/,/ /g')" require_binaries="$(sed -ne 's/^#REQUIRE_BINARIES=//p' "$i" | sed -e 's/,/ /g')" if [ $any_test -ne 1 ] ; then @@ -151,6 +154,11 @@ _findtests() { require_options="$require_options $requiredoption" fi + requiredservice="$(sed -ne 's/^#REQUIRE_SERVICE=//p' "$i" | sed -e 's/,.*//')" + if [ -n "$requiredservice" ]; then + require_services="$require_services $requiredservice" + fi + excludedtarget="$(sed -ne 's/^#EXCLUDE_TARGET=//p' "$i" | sed -e 's/,.*//')" if [ -n "$excludedtarget" ]; then exclude_targets="$exclude_targets $excludedtarget" @@ -192,6 +200,20 @@ _findtests() { fi done + for requiredservice in $require_services; do + alternatives=$(echo "$requiredservice" | sed -e 's/|/ /g') + found= + for alt in $alternatives; do + if echo "$SERVICES" | grep -qw "\+$alt"; then + found=1; + fi + done + if [ -z $found ]; then + echo " Skip $i because haproxy is not compiled with the required service $requiredservice" + skiptest=1 + fi + done + for requiredbin in $require_binaries; do if ! command -v $requiredbin >/dev/null 2>&1 then @@ -322,8 +344,8 @@ if [ $preparefailed ]; then exit 1 fi -{ read HAPROXY_VERSION; read TARGET; read FEATURES; } << EOF -$($HAPROXY_PROGRAM $HAPROXY_ARGS -vv |grep 'HA-Proxy version\|TARGET.*=\|^Feature' | sed 's/.* [:=] //') +{ read HAPROXY_VERSION; read TARGET; read FEATURES; read SERVICES; } << EOF +$($HAPROXY_PROGRAM $HAPROXY_ARGS -vv | grep 'HA-Proxy version\|TARGET.*=\|^Feature\|^Available services' | sed 's/.* [:=] //') EOF HAPROXY_VERSION=$(echo $HAPROXY_VERSION | cut -d " " -f 3) @@ -342,6 +364,7 @@ fi echo "Target : $TARGET" echo "Options : $FEATURES" +echo "Services : $SERVICES" echo "########################## Gathering tests to run ##########################" # if htx is enable, but HAProxy version is lower to 1.9, disable it diff --git a/src/stream.c b/src/stream.c index 5e675b192..718eaa5c0 100644 --- a/src/stream.c +++ b/src/stream.c @@ -2791,10 +2791,8 @@ void list_services(FILE *out) fprintf(out, "Available services :"); list_for_each_entry(kw_list, &service_keywords, list) { for (i = 0; kw_list->kw[i].kw != NULL; i++) { - if (!found) - fputc('\n', out); found = 1; - fprintf(out, "\t%s\n", kw_list->kw[i].kw); + fprintf(out, " %s", kw_list->kw[i].kw); } } if (!found)