diff options
author | Willy Tarreau <w@1wt.eu> | 2021-11-18 15:05:45 +0100 |
---|---|---|
committer | Willy Tarreau <w@1wt.eu> | 2021-11-18 17:54:49 +0100 |
commit | 0b3eb81c6b67ebca09a8ec01c8125b17d3745ede (patch) | |
tree | 5dbd85916f3397fe42ea3e948260c8596080e841 | |
parent | 969e7afa0dd5241d4cf369698d121ffcddf60d3a (diff) | |
download | haproxy-0b3eb81c6b67ebca09a8ec01c8125b17d3745ede.tar.gz |
SCRIPT: run-regtests: avoid several calls to grep to test for features
grep is used in the arguments loops to check for features such as OPENSSL
or LUA or services like prometheus-exporter. Let's just look for the words
inside the list, which requires to prepend a delimitor at the beginning of
the list and add one at the end.
-rwxr-xr-x | scripts/run-regtests.sh | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/scripts/run-regtests.sh b/scripts/run-regtests.sh index 5acd5a15a..1af935075 100755 --- a/scripts/run-regtests.sh +++ b/scripts/run-regtests.sh @@ -197,7 +197,7 @@ _findtests() { IFS="|"; set -- $requiredoption; IFS=$OLDIFS; alternatives="$*" found= for alt in $alternatives; do - if echo "$FEATURES" | grep -qw "\+$alt"; then + if [ -z "${FEATURES_PATTERN##* +$alt *}" ]; then found=1; fi done @@ -211,7 +211,7 @@ _findtests() { IFS="|"; set -- $requiredservice; IFS=$OLDIFS; alternatives="$*" found= for alt in $alternatives; do - if echo "$SERVICES" | grep -qw "$alt"; then + if [ -z "${SERVICES_PATTERN##* $alt *}" ]; then found=1; fi done @@ -345,6 +345,9 @@ EOF HAPROXY_VERSION=$(echo $HAPROXY_VERSION | cut -d " " -f 3) echo "Testing with haproxy version: $HAPROXY_VERSION" +FEATURES_PATTERN=" $FEATURES " +SERVICES_PATTERN=" $SERVICES " + TESTRUNDATETIME="$(date '+%Y-%m-%d_%H-%M-%S')" mkdir -p "$TESTDIR" || exit 1 |