mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-04-26 04:48:03 +00:00
REGTEST: script: Add support of alternatives in requited options list
It is now possible to specify a list of "alternatives" for a required option. This must be done by separating options by a pipe ('|'). A test will be executed if at least one of them is available. For instance: #REQUIRED_OPTIONS=ZLIB|SLZ,LUA,OPENSSL The function _findtest() has also been sligthly simplified.
This commit is contained in:
parent
a8f6b43b07
commit
7e245dfaca
@ -48,7 +48,7 @@ _help()
|
|||||||
# Below option is required to complete this test succesfully
|
# Below option is required to complete this test succesfully
|
||||||
#REQUIRE_OPTION=OPENSSL, this test needs OPENSSL compiled in.
|
#REQUIRE_OPTION=OPENSSL, this test needs OPENSSL compiled in.
|
||||||
|
|
||||||
#REQUIRE_OPTIONS=ZLIB,OPENSSL,LUA
|
#REQUIRE_OPTIONS=ZLIB|SLZ,OPENSSL,LUA
|
||||||
|
|
||||||
# To define a range of versions that a test can run with:
|
# To define a range of versions that a test can run with:
|
||||||
#REQUIRE_VERSION=0.0
|
#REQUIRE_VERSION=0.0
|
||||||
@ -156,8 +156,18 @@ _findtests() {
|
|||||||
skiptest=
|
skiptest=
|
||||||
require_version="$(sed -ne 's/^#REQUIRE_VERSION=//p' "$i")"
|
require_version="$(sed -ne 's/^#REQUIRE_VERSION=//p' "$i")"
|
||||||
require_version_below="$(sed -ne 's/^#REQUIRE_VERSION_BELOW=//p' "$i")"
|
require_version_below="$(sed -ne 's/^#REQUIRE_VERSION_BELOW=//p' "$i")"
|
||||||
require_options="$(sed -ne 's/^#REQUIRE_OPTIONS=//p' "$i")"
|
require_options="$(sed -ne 's/^#REQUIRE_OPTIONS=//p' "$i" | sed -e 's/,/ /g')"
|
||||||
exclude_targets=",$(sed -ne 's/^#EXCLUDE_TARGETS=//p' "$i"),"
|
exclude_targets="$(sed -ne 's/^#EXCLUDE_TARGETS=//p' "$i" | sed -e 's/,/ /g')"
|
||||||
|
|
||||||
|
requiredoption="$(sed -ne 's/^#REQUIRE_OPTION=//p' "$i" | sed -e 's/,.*//')"
|
||||||
|
if [ -n "$requiredoption" ]; then
|
||||||
|
require_options="$require_options $requiredoption"
|
||||||
|
fi
|
||||||
|
|
||||||
|
excludedtarget="$(sed -ne 's/^#EXCLUDE_TARGET=//p' "$i" | sed -e 's/,.*//')"
|
||||||
|
if [ -n "$excludedtarget" ]; then
|
||||||
|
exclude_targets="$exclude_targets $excludedtarget"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -n "$require_version" ]; then
|
if [ -n "$require_version" ]; then
|
||||||
if [ $(_version "$HAPROXY_VERSION") -lt $(_version "$require_version") ]; then
|
if [ $(_version "$HAPROXY_VERSION") -lt $(_version "$require_version") ]; then
|
||||||
@ -174,46 +184,26 @@ _findtests() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$( echo "$exclude_targets" | grep ",$TARGET," )" ]; then
|
for excludedtarget in $exclude_targets; do
|
||||||
echo " Skip $i because exclude_targets"
|
if [ "$excludedtarget" = "$TARGET" ]; then
|
||||||
echo " REASON: exclude_targets '$exclude_targets' contains '$TARGET'"
|
echo " Skip $i because haproxy is compiled for the excluded target $TARGET"
|
||||||
skiptest=1
|
skiptest=1
|
||||||
fi
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
#echo "REQUIRE_OPTIONS : $require_options"
|
for requiredoption in $require_options; do
|
||||||
for requiredoption in $(echo $require_options | tr "," "\012" ); do
|
alternatives=$(echo "$requiredoption" | sed -e 's/|/ /g')
|
||||||
if [ -z "$( echo "$OPTIONS" | grep "USE_$requiredoption=1" )" ]
|
found=
|
||||||
then
|
for alt in $alternatives; do
|
||||||
echo " Skip $i because option $requiredoption not found"
|
if [ -n "$( echo "$OPTIONS" | grep "USE_$alt=1" )" ]; then
|
||||||
echo -n " REASON: "
|
found=1;
|
||||||
echo -n "$required" | sed -e 's/.*,//' -e 's/^[[:space:]]//'
|
fi
|
||||||
echo
|
done
|
||||||
|
if [ -z $found ]; then
|
||||||
|
echo " Skip $i because haproxy is not compiled with the required option $requiredoption"
|
||||||
skiptest=1
|
skiptest=1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
for required in "$(grep "#REQUIRE_OPTION=" "$i")";
|
|
||||||
do
|
|
||||||
if [ -z "$required" ]
|
|
||||||
then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
requiredoption=$(echo "$required" | sed -e 's/.*=//' -e 's/,.*//')
|
|
||||||
if [ -z "$( echo "$OPTIONS" | grep "USE_$requiredoption=1" )" ]
|
|
||||||
then
|
|
||||||
echo " Skip $i because option $requiredoption not found"
|
|
||||||
echo -n " REASON: "
|
|
||||||
echo "$required" | sed -e 's/.*,//' -e 's/^[[:space:]]//'
|
|
||||||
skiptest=1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
testtarget=$(grep "#EXCLUDE_TARGET=" "$i")
|
|
||||||
if [ "$( echo "$testtarget" | grep "#EXCLUDE_TARGET=$TARGET," )" ]
|
|
||||||
then
|
|
||||||
echo " Skip $i because: TARGET = $TARGET"
|
|
||||||
echo -n " REASON: "
|
|
||||||
echo "$testtarget" | sed -e 's/.*,//' -e 's/^[[:space:]]//'
|
|
||||||
skiptest=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z $skiptest ]; then
|
if [ -z $skiptest ]; then
|
||||||
echo " Add test: $i"
|
echo " Add test: $i"
|
||||||
|
Loading…
Reference in New Issue
Block a user