REGTEST: run-regtests: implement #REQUIRE_BINARIES

Implement #REQUIRE_BINARIES for vtc files.

The run-regtests.sh script will check if the binary is available in the
environment, if not, it wil disable the vtc.
This commit is contained in:
William Lallemand 2019-12-19 14:30:00 +01:00 committed by William Lallemand
parent 9c1aa0a2a1
commit d5b464bfee
2 changed files with 13 additions and 0 deletions

View File

@ -9,6 +9,7 @@
varnishtest "Test the 'set ssl cert' feature of the CLI"
#REQUIRE_OPTIONS=OPENSSL
#REQUIRE_BINARIES=socat,curl
feature ignore_unknown_macro

View File

@ -63,6 +63,9 @@ _help()
#REQUIRE_VERSION=0.0
#REQUIRE_VERSION_BELOW=99.9
# To define required binaries for a test:
#REQUIRE_BINARIES=socat,curl
Configure environment variables to set the haproxy and vtest binaries to use
setenv HAPROXY_PROGRAM /usr/local/sbin/haproxy
setenv VTEST_PROGRAM /usr/local/bin/vtest
@ -129,6 +132,7 @@ _findtests() {
require_version_below="$(sed -ne 's/^#REQUIRE_VERSION_BELOW=//p' "$i")"
require_options="$(sed -ne 's/^#REQUIRE_OPTIONS=//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
regtest_type="$(sed -ne 's/^#REGTEST_TYPE=//p' "$i")"
if [ -z $regtest_type ] ; then
@ -186,6 +190,14 @@ _findtests() {
fi
done
for requiredbin in $require_binaries; do
which $requiredbin >/dev/null 2>&1
if [ "$?" -eq "1" ]; then
echo " Skip $i because '"$requiredbin"' is not installed"
skiptest=1
fi
done
if [ -z $skiptest ]; then
echo " Add test: $i"
testlist="$testlist $i"