]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
REGTEST: run-regtests: implement #REQUIRE_BINARIES
authorWilliam Lallemand <wlallemand@haproxy.com>
Thu, 19 Dec 2019 13:30:00 +0000 (14:30 +0100)
committerWilliam Lallemand <wlallemand@haproxy.org>
Thu, 19 Dec 2019 13:36:46 +0000 (14:36 +0100)
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.

reg-tests/ssl/set_ssl_cert.vtc
scripts/run-regtests.sh

index 1cdbd423c6c436e0559c4b59966e4111f2e75bf4..9497be89c9f10df39834d65273166add47218d50 100644 (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
 
 
index c820d732c4c22b1c500d3db36bb36ccee151bfd7..7efc430077278465ea6be6fdd773a14cfe44502f 100755 (executable)
@@ -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"