2018-11-29 20:41:42 +00:00
|
|
|
#!/bin/sh
|
2018-11-27 21:26:38 +00:00
|
|
|
|
2018-12-18 21:41:20 +00:00
|
|
|
_help()
|
|
|
|
{
|
2018-11-27 21:26:38 +00:00
|
|
|
cat << EOF
|
|
|
|
### run-regtests.sh ###
|
|
|
|
Running run-regtests.sh --help shows this information about how to use it
|
|
|
|
|
|
|
|
Run without parameters to run all tests in the current folder (including subfolders)
|
|
|
|
run-regtests.sh
|
|
|
|
|
|
|
|
Provide paths to run tests from (including subfolders):
|
|
|
|
run-regtests.sh ./tests1 ./tests2
|
|
|
|
|
|
|
|
Parameters:
|
2019-01-11 09:10:21 +00:00
|
|
|
--j <NUM>, To run vtest with multiple jobs / threads for a faster overall result
|
2018-11-27 21:26:38 +00:00
|
|
|
run-regtests.sh ./fasttest --j 16
|
|
|
|
|
|
|
|
--v, to run verbose
|
2019-01-11 09:10:21 +00:00
|
|
|
run-regtests.sh --v, disables the default vtest 'quiet' parameter
|
2018-11-27 21:26:38 +00:00
|
|
|
|
2020-04-16 18:51:34 +00:00
|
|
|
--debug to show test logs on standard output (implies --v)
|
2018-12-19 09:22:01 +00:00
|
|
|
run-regtests.sh --debug
|
|
|
|
|
2018-12-19 09:25:07 +00:00
|
|
|
--keep-logs to keep all log directories (by default kept if test fails)
|
|
|
|
run-regtests.sh --keep-logs
|
|
|
|
|
2019-01-11 09:10:21 +00:00
|
|
|
--vtestparams <ARGS>, passes custom ARGS to vtest
|
|
|
|
run-regtests.sh --vtestparams "-n 10"
|
2018-11-27 21:26:38 +00:00
|
|
|
|
2019-03-29 14:07:24 +00:00
|
|
|
--type <reg tests types> filter the types of the tests to be run, depending on
|
|
|
|
the commented REGTESTS_TYPE variable value in each VTC file.
|
2019-12-11 15:26:11 +00:00
|
|
|
The value of REGTESTS_TYPE supported are: default, slow, bug, broken, devel
|
|
|
|
and experimental. When not specified, it is set to 'default' as default value.
|
2019-03-29 14:07:24 +00:00
|
|
|
|
|
|
|
run-regtest.sh --type slow,default
|
|
|
|
|
2018-12-19 09:18:40 +00:00
|
|
|
--clean to cleanup previous reg-tests log directories and exit
|
|
|
|
run-regtests.sh --clean
|
|
|
|
|
2018-11-27 21:26:38 +00:00
|
|
|
Including text below into a .vtc file will check for its requirements
|
|
|
|
related to haproxy's target and compilation options
|
2019-05-16 21:15:31 +00:00
|
|
|
# Below targets are not capable of completing this test successfully
|
2018-11-27 21:26:38 +00:00
|
|
|
#EXCLUDE_TARGET=freebsd, abns sockets are not available on freebsd
|
|
|
|
|
|
|
|
#EXCLUDE_TARGETS=dos,freebsd,windows
|
|
|
|
|
2019-05-16 21:15:31 +00:00
|
|
|
# Below option is required to complete this test successfully
|
2018-11-27 21:26:38 +00:00
|
|
|
#REQUIRE_OPTION=OPENSSL, this test needs OPENSSL compiled in.
|
2018-12-21 14:18:02 +00:00
|
|
|
#REQUIRE_OPTIONS=ZLIB|SLZ,OPENSSL,LUA
|
2018-11-27 21:26:38 +00:00
|
|
|
|
2021-01-09 16:26:20 +00:00
|
|
|
#REQUIRE_SERVICE=prometheus-exporter
|
|
|
|
#REQUIRE_SERVICES=prometheus-exporter,foo
|
|
|
|
|
2018-11-27 21:26:38 +00:00
|
|
|
# To define a range of versions that a test can run with:
|
|
|
|
#REQUIRE_VERSION=0.0
|
|
|
|
#REQUIRE_VERSION_BELOW=99.9
|
|
|
|
|
2019-01-11 09:10:21 +00:00
|
|
|
Configure environment variables to set the haproxy and vtest binaries to use
|
2018-11-27 21:26:38 +00:00
|
|
|
setenv HAPROXY_PROGRAM /usr/local/sbin/haproxy
|
2019-01-11 09:10:21 +00:00
|
|
|
setenv VTEST_PROGRAM /usr/local/bin/vtest
|
2020-12-16 09:39:20 +00:00
|
|
|
setenv HAPROXY_ARGS "-dM -de -m 50"
|
2018-12-13 21:15:05 +00:00
|
|
|
or
|
|
|
|
export HAPROXY_PROGRAM=/usr/local/sbin/haproxy
|
2019-01-11 09:10:21 +00:00
|
|
|
export VTEST_PROGRAM=/usr/local/bin/vtest
|
2020-12-16 09:39:20 +00:00
|
|
|
export HAPROXY_ARGS="-dM -de -m 50"
|
2018-11-27 21:26:38 +00:00
|
|
|
EOF
|
2018-12-18 21:41:20 +00:00
|
|
|
exit 0
|
|
|
|
}
|
2018-11-27 21:26:38 +00:00
|
|
|
|
2018-12-13 21:15:05 +00:00
|
|
|
add_range_to_test_list()
|
|
|
|
{
|
|
|
|
level0="*.vtc"
|
|
|
|
level1="h*.vtc"
|
|
|
|
level2="s*.vtc"
|
|
|
|
level3="l*.vtc"
|
|
|
|
level4="b*.vtc"
|
|
|
|
level5="k*.vtc"
|
|
|
|
level6="e*.vtc"
|
|
|
|
|
|
|
|
new_range=$(echo $1 | tr '-' ' ')
|
|
|
|
non_digit=$(echo $new_range | grep '[^0-9 ]')
|
|
|
|
if [ -n "$non_digit" ] ; then
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
if [ "$new_range" = "$1" ] ; then
|
|
|
|
if [ $1 -gt 6 ] ; then
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
eval echo '$'level$1
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
if [ -z "$new_range" ] ; then
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
list=
|
|
|
|
for l in $(seq $new_range) ; do
|
|
|
|
if [ -n "l" ] ; then
|
|
|
|
if [ -z "$list" ] ; then
|
|
|
|
list="$(eval echo '$'level${l})"
|
|
|
|
else
|
|
|
|
list="$list $(eval echo '$'level${l})"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
echo $list
|
|
|
|
}
|
|
|
|
|
2018-11-27 21:26:38 +00:00
|
|
|
_startswith() {
|
|
|
|
_str="$1"
|
|
|
|
_sub="$2"
|
|
|
|
echo "$_str" | grep "^$_sub" >/dev/null 2>&1
|
|
|
|
}
|
|
|
|
|
|
|
|
_findtests() {
|
|
|
|
set -f
|
|
|
|
|
2021-02-05 10:27:54 +00:00
|
|
|
REGTESTS_TYPES="${REGTESTS_TYPES:-default,bug,devel,slow}"
|
2019-03-29 14:07:24 +00:00
|
|
|
any_test=$(echo $REGTESTS_TYPES | grep -cw "any")
|
|
|
|
for i in $( find "$1" -name *.vtc ); do
|
2018-11-27 21:26:38 +00:00
|
|
|
skiptest=
|
2021-11-18 12:49:01 +00:00
|
|
|
OLDIFS="$IFS"; IFS="$LINEFEED"
|
|
|
|
set -- $(grep '^#[0-9A-Z_]*=' "$i")
|
|
|
|
IFS="$OLDIFS"
|
|
|
|
|
|
|
|
require_version=""; require_version_below=""; require_options="";
|
|
|
|
require_services=""; exclude_targets=""; regtest_type=""
|
|
|
|
requiredoption=""; requiredservice=""; excludedtarget="";
|
|
|
|
|
|
|
|
while [ $# -gt 0 ]; do
|
|
|
|
v="$1"; v="${v#*=}"
|
|
|
|
case "$1" in
|
|
|
|
"#REQUIRE_VERSION="*) require_version="$v" ;;
|
|
|
|
"#REQUIRE_VERSION_BELOW="*) require_version_below="$v" ;;
|
|
|
|
"#REQUIRE_OPTIONS="*) require_options="$v" ;;
|
|
|
|
"#REQUIRE_SERVICES="*) require_services="$v" ;;
|
|
|
|
"#EXCLUDE_TARGETS="*) exclude_targets="$v" ;;
|
|
|
|
"#REGTEST_TYPE="*) regtest_type="$v" ;;
|
|
|
|
"#REQUIRE_OPTION="*) requiredoption="${v%,*}" ;;
|
|
|
|
"#REQUIRE_SERVICE="*) required_service="${v%,*}" ;;
|
|
|
|
"#EXCLUDE_TARGET="*) excludedtarget="${v%,*}" ;;
|
|
|
|
# Note: any new variable declared here must be initialized above.
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
2019-03-29 14:07:24 +00:00
|
|
|
if [ $any_test -ne 1 ] ; then
|
|
|
|
if [ -z $regtest_type ] ; then
|
|
|
|
regtest_type=default
|
|
|
|
fi
|
|
|
|
if ! $(echo $REGTESTS_TYPES | grep -wq $regtest_type) ; then
|
|
|
|
echo " Skip $i because its type '"$regtest_type"' is excluded"
|
|
|
|
skiptest=1
|
|
|
|
fi
|
|
|
|
fi
|
2018-12-21 14:18:02 +00:00
|
|
|
|
|
|
|
if [ -n "$requiredoption" ]; then
|
2021-11-18 12:49:01 +00:00
|
|
|
require_options="$require_options,$requiredoption"
|
2018-12-21 14:18:02 +00:00
|
|
|
fi
|
|
|
|
|
2021-01-09 16:26:20 +00:00
|
|
|
if [ -n "$requiredservice" ]; then
|
2021-11-18 12:49:01 +00:00
|
|
|
require_services="$require_services,$requiredservice"
|
2021-01-09 16:26:20 +00:00
|
|
|
fi
|
|
|
|
|
2018-12-21 14:18:02 +00:00
|
|
|
if [ -n "$excludedtarget" ]; then
|
2021-11-18 12:49:01 +00:00
|
|
|
exclude_targets="$exclude_targets,$excludedtarget"
|
2018-12-21 14:18:02 +00:00
|
|
|
fi
|
2018-11-27 21:26:38 +00:00
|
|
|
|
2021-11-18 12:49:01 +00:00
|
|
|
IFS=","; set -- $require_options; IFS=$OLDIFS; require_options="$*"
|
|
|
|
IFS=","; set -- $require_services; IFS=$OLDIFS; require_services="$*"
|
|
|
|
IFS=","; set -- $exclude_targets; IFS=$OLDIFS; exclude_targets="$*"
|
|
|
|
|
2018-11-27 21:26:38 +00:00
|
|
|
if [ -n "$require_version" ]; then
|
|
|
|
if [ $(_version "$HAPROXY_VERSION") -lt $(_version "$require_version") ]; then
|
|
|
|
echo " Skip $i because option haproxy is version: $HAPROXY_VERSION"
|
|
|
|
echo " REASON: this test requires at least version: $require_version"
|
|
|
|
skiptest=1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
if [ -n "$require_version_below" ]; then
|
|
|
|
if [ $(_version "$HAPROXY_VERSION") -ge $(_version "$require_version_below") ]; then
|
|
|
|
echo " Skip $i because option haproxy is version: $HAPROXY_VERSION"
|
|
|
|
echo " REASON: this test requires a version below: $require_version_below"
|
|
|
|
skiptest=1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2018-12-21 14:18:02 +00:00
|
|
|
for excludedtarget in $exclude_targets; do
|
|
|
|
if [ "$excludedtarget" = "$TARGET" ]; then
|
|
|
|
echo " Skip $i because haproxy is compiled for the excluded target $TARGET"
|
2018-11-27 21:26:38 +00:00
|
|
|
skiptest=1
|
|
|
|
fi
|
|
|
|
done
|
2018-12-21 14:18:02 +00:00
|
|
|
|
|
|
|
for requiredoption in $require_options; do
|
2021-11-18 12:49:01 +00:00
|
|
|
IFS="|"; set -- $requiredoption; IFS=$OLDIFS; alternatives="$*"
|
2018-12-21 14:18:02 +00:00
|
|
|
found=
|
|
|
|
for alt in $alternatives; do
|
2021-11-18 14:05:45 +00:00
|
|
|
if [ -z "${FEATURES_PATTERN##* +$alt *}" ]; then
|
2018-12-21 14:18:02 +00:00
|
|
|
found=1;
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
if [ -z $found ]; then
|
|
|
|
echo " Skip $i because haproxy is not compiled with the required option $requiredoption"
|
2018-11-27 21:26:38 +00:00
|
|
|
skiptest=1
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2021-01-09 16:26:20 +00:00
|
|
|
for requiredservice in $require_services; do
|
2021-11-18 12:49:01 +00:00
|
|
|
IFS="|"; set -- $requiredservice; IFS=$OLDIFS; alternatives="$*"
|
2021-01-09 16:26:20 +00:00
|
|
|
found=
|
|
|
|
for alt in $alternatives; do
|
2021-11-18 14:05:45 +00:00
|
|
|
if [ -z "${SERVICES_PATTERN##* $alt *}" ]; then
|
2021-01-09 16:26:20 +00:00
|
|
|
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
|
|
|
|
|
2018-11-27 21:26:38 +00:00
|
|
|
if [ -z $skiptest ]; then
|
|
|
|
echo " Add test: $i"
|
|
|
|
testlist="$testlist $i"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2018-12-19 09:18:40 +00:00
|
|
|
_cleanup()
|
|
|
|
{
|
|
|
|
DIRS=$(find "${TESTDIR}" -maxdepth 1 -type d -name "haregtests-*" -exec basename {} \; 2>/dev/null)
|
|
|
|
if [ -z "${DIRS}" ]; then
|
|
|
|
echo "No reg-tests log directory found"
|
|
|
|
else
|
|
|
|
echo "Cleanup following reg-tests log directories:"
|
|
|
|
for d in ${DIRS}; do
|
|
|
|
echo " o ${TESTDIR}/$d"
|
|
|
|
done
|
|
|
|
read -p "Continue (y/n)?" reply
|
|
|
|
case "$reply" in
|
|
|
|
y|Y)
|
|
|
|
for d in ${DIRS}; do
|
|
|
|
rm -r "${TESTDIR}/$d"
|
|
|
|
done
|
|
|
|
echo "done"
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "aborted"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-11-27 21:26:38 +00:00
|
|
|
_process() {
|
|
|
|
while [ ${#} -gt 0 ]; do
|
|
|
|
if _startswith "$1" "-"; then
|
|
|
|
case "${1}" in
|
|
|
|
--j)
|
|
|
|
jobcount="$2"
|
|
|
|
shift
|
|
|
|
;;
|
2019-01-11 09:10:21 +00:00
|
|
|
--vtestparams)
|
|
|
|
vtestparams="$2"
|
2018-11-27 21:26:38 +00:00
|
|
|
shift
|
|
|
|
;;
|
|
|
|
--v)
|
|
|
|
verbose=""
|
|
|
|
;;
|
2018-12-19 09:22:01 +00:00
|
|
|
--debug)
|
|
|
|
verbose=""
|
|
|
|
debug="-v"
|
|
|
|
;;
|
2018-12-19 09:25:07 +00:00
|
|
|
--keep-logs)
|
|
|
|
keep_logs="-L"
|
|
|
|
;;
|
2019-03-29 14:07:24 +00:00
|
|
|
--type)
|
|
|
|
REGTESTS_TYPES="$2"
|
|
|
|
shift
|
|
|
|
;;
|
2018-12-19 09:18:40 +00:00
|
|
|
--clean)
|
|
|
|
_cleanup
|
|
|
|
exit 0
|
|
|
|
;;
|
2018-12-18 21:41:20 +00:00
|
|
|
--help)
|
|
|
|
_help
|
|
|
|
;;
|
2018-11-27 21:26:38 +00:00
|
|
|
*)
|
|
|
|
echo "Unknown parameter : $1"
|
2018-12-18 21:41:20 +00:00
|
|
|
exit 1
|
2018-11-27 21:26:38 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
else
|
2018-12-18 21:41:20 +00:00
|
|
|
REGTESTS="${REGTESTS} $1"
|
2018-11-27 21:26:38 +00:00
|
|
|
fi
|
|
|
|
shift 1
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2021-11-18 14:32:16 +00:00
|
|
|
# compute a version from up to 4 sub-version components, each multiplied
|
|
|
|
# by a power of 1000, and padded left with 0, 1 or 2 zeroes.
|
2018-11-27 21:26:38 +00:00
|
|
|
_version() {
|
2021-11-18 14:32:16 +00:00
|
|
|
OLDIFS="$IFS"; IFS="."; set -- $*; IFS="$OLDIFS"
|
|
|
|
set -- ${1%%[!0-9]*} 000${2%%[!0-9]*} 000${3%%[!0-9]*} 000${4%%[!0-9]*}
|
|
|
|
prf2=${2%???}; prf3=${3%???}; prf4=${4%???}
|
|
|
|
echo ${1}${2#$prf2}${3#$prf3}${4#$prf4}
|
2018-11-27 21:26:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-11-29 20:41:42 +00:00
|
|
|
HAPROXY_PROGRAM="${HAPROXY_PROGRAM:-${PWD}/haproxy}"
|
2020-12-16 09:39:20 +00:00
|
|
|
HAPROXY_ARGS="${HAPROXY_ARGS--dM}"
|
2019-01-11 09:10:21 +00:00
|
|
|
VTEST_PROGRAM="${VTEST_PROGRAM:-vtest}"
|
2018-12-19 09:18:40 +00:00
|
|
|
TESTDIR="${TMPDIR:-/tmp}"
|
2018-12-18 21:41:20 +00:00
|
|
|
REGTESTS=""
|
2021-11-18 12:49:01 +00:00
|
|
|
LINEFEED="
|
|
|
|
"
|
2018-12-18 21:41:20 +00:00
|
|
|
|
|
|
|
jobcount=""
|
|
|
|
verbose="-q"
|
2018-12-19 09:22:01 +00:00
|
|
|
debug=""
|
2018-12-19 09:25:07 +00:00
|
|
|
keep_logs="-l"
|
2018-12-18 21:41:20 +00:00
|
|
|
testlist=""
|
|
|
|
|
|
|
|
_process "$@";
|
|
|
|
|
|
|
|
echo ""
|
|
|
|
echo "########################## Preparing to run tests ##########################"
|
2018-11-27 21:26:38 +00:00
|
|
|
|
|
|
|
preparefailed=
|
|
|
|
if ! [ -x "$(command -v $HAPROXY_PROGRAM)" ]; then
|
|
|
|
echo "haproxy not found in path, please specify HAPROXY_PROGRAM environment variable"
|
|
|
|
preparefailed=1
|
|
|
|
fi
|
2019-01-11 09:10:21 +00:00
|
|
|
if ! [ -x "$(command -v $VTEST_PROGRAM)" ]; then
|
|
|
|
echo "vtest not found in path, please specify VTEST_PROGRAM environment variable"
|
2018-11-27 21:26:38 +00:00
|
|
|
preparefailed=1
|
|
|
|
fi
|
|
|
|
if [ $preparefailed ]; then
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2021-01-09 16:26:20 +00:00
|
|
|
{ read HAPROXY_VERSION; read TARGET; read FEATURES; read SERVICES; } << EOF
|
2021-05-09 04:12:41 +00:00
|
|
|
$($HAPROXY_PROGRAM $HAPROXY_ARGS -vv | grep 'HA-\?Proxy version\|TARGET.*=\|^Feature\|^Available services' | sed 's/.* [:=] //')
|
2018-11-27 21:26:38 +00:00
|
|
|
EOF
|
|
|
|
|
|
|
|
HAPROXY_VERSION=$(echo $HAPROXY_VERSION | cut -d " " -f 3)
|
|
|
|
echo "Testing with haproxy version: $HAPROXY_VERSION"
|
|
|
|
|
SCRIPTS: run-regtests: add a version check
It happens from time to time while switching between branches and/or
updating after someone else's changes that regtests are run by accident
on the wrong binary, typically the one the tests were run on during
development and not with the latest adaptations. And obviously it's
when this happens that we break the CI. There are various causes to
this but they all come down to humans context-switching a lot, and
there's no real fix for this that doesn't add even more burden hence
increases the overhead. However we can help the human detect such
mistakes very easily.
This change here will compare the version of the haproxy binary to
the version of the tree, and will emit a warning in the regtest output
if they do not match, regardless of the outcome of the test. This is
sufficient in case of failures because these are quickly glanced over,
and is sufficient as well in case of accidental success because the
warning is the last message. E.g:
########################## Starting vtest ##########################
Testing with haproxy version: 2.7-dev10-cfcdbc-38
Warning: version does not match the current tree (2.7-dev10-111c78-39)
0 tests failed, 0 tests skipped, 182 tests passed
This should not affect builds made out of a git tree because the version
is retrieved using "make version", or exactly the same way as it's passd
to the haproxy binary. We just need to know what "make" command to run,
so $MAKE is used primarily, falling back to "make" then to "gmake". In
case all of these fail, we just ignore the version check. This should be
sufficient to catch human mistakes without affecting the CI.
2022-11-30 17:44:33 +00:00
|
|
|
PROJECT_VERSION=$(${MAKE:-make} version 2>&1 | grep '^VERSION:\|^SUBVERS:'|cut -f2 -d' '|tr -d '\012')
|
|
|
|
if [ -z "${PROJECT_VERSION}${MAKE}" ]; then
|
|
|
|
# try again with gmake, just in case
|
|
|
|
PROJECT_VERSION=$(gmake version 2>&1 | grep '^VERSION:\|^SUBVERS:'|cut -f2 -d' '|tr -d '\012')
|
|
|
|
fi
|
|
|
|
|
2021-11-18 14:05:45 +00:00
|
|
|
FEATURES_PATTERN=" $FEATURES "
|
|
|
|
SERVICES_PATTERN=" $SERVICES "
|
|
|
|
|
2018-11-27 21:26:38 +00:00
|
|
|
TESTRUNDATETIME="$(date '+%Y-%m-%d_%H-%M-%S')"
|
|
|
|
|
2018-11-29 20:41:42 +00:00
|
|
|
mkdir -p "$TESTDIR" || exit 1
|
2018-12-19 09:18:40 +00:00
|
|
|
TESTDIR=$(mktemp -d "$TESTDIR/haregtests-$TESTRUNDATETIME.XXXXXX") || exit 1
|
2018-11-27 21:26:38 +00:00
|
|
|
|
2018-11-29 20:41:42 +00:00
|
|
|
export TMPDIR="$TESTDIR"
|
|
|
|
export HAPROXY_PROGRAM="$HAPROXY_PROGRAM"
|
2020-12-16 09:39:20 +00:00
|
|
|
if [ -n "$HAPROXY_ARGS" ]; then
|
|
|
|
export HAPROXY_ARGS
|
|
|
|
fi
|
2018-11-27 21:26:38 +00:00
|
|
|
|
|
|
|
echo "Target : $TARGET"
|
2019-03-27 12:52:39 +00:00
|
|
|
echo "Options : $FEATURES"
|
2021-01-09 16:26:20 +00:00
|
|
|
echo "Services : $SERVICES"
|
2018-11-27 21:26:38 +00:00
|
|
|
|
|
|
|
echo "########################## Gathering tests to run ##########################"
|
2018-12-19 10:22:04 +00:00
|
|
|
|
2018-12-18 21:41:20 +00:00
|
|
|
if [ -z "$REGTESTS" ]; then
|
2019-04-23 14:09:50 +00:00
|
|
|
_findtests reg-tests/
|
2018-12-18 21:41:20 +00:00
|
|
|
else
|
|
|
|
for t in $REGTESTS; do
|
|
|
|
_findtests $t
|
|
|
|
done
|
|
|
|
fi
|
2018-11-27 21:26:38 +00:00
|
|
|
|
2019-01-11 09:10:21 +00:00
|
|
|
echo "########################## Starting vtest ##########################"
|
2018-11-27 21:26:38 +00:00
|
|
|
echo "Testing with haproxy version: $HAPROXY_VERSION"
|
SCRIPTS: run-regtests: add a version check
It happens from time to time while switching between branches and/or
updating after someone else's changes that regtests are run by accident
on the wrong binary, typically the one the tests were run on during
development and not with the latest adaptations. And obviously it's
when this happens that we break the CI. There are various causes to
this but they all come down to humans context-switching a lot, and
there's no real fix for this that doesn't add even more burden hence
increases the overhead. However we can help the human detect such
mistakes very easily.
This change here will compare the version of the haproxy binary to
the version of the tree, and will emit a warning in the regtest output
if they do not match, regardless of the outcome of the test. This is
sufficient in case of failures because these are quickly glanced over,
and is sufficient as well in case of accidental success because the
warning is the last message. E.g:
########################## Starting vtest ##########################
Testing with haproxy version: 2.7-dev10-cfcdbc-38
Warning: version does not match the current tree (2.7-dev10-111c78-39)
0 tests failed, 0 tests skipped, 182 tests passed
This should not affect builds made out of a git tree because the version
is retrieved using "make version", or exactly the same way as it's passd
to the haproxy binary. We just need to know what "make" command to run,
so $MAKE is used primarily, falling back to "make" then to "gmake". In
case all of these fail, we just ignore the version check. This should be
sufficient to catch human mistakes without affecting the CI.
2022-11-30 17:44:33 +00:00
|
|
|
|
|
|
|
if [ -n "$PROJECT_VERSION" -a "$PROJECT_VERSION" != "$HAPROXY_VERSION" ]; then
|
|
|
|
echo "Warning: version does not match the current tree ($PROJECT_VERSION)"
|
|
|
|
fi
|
|
|
|
|
2018-11-27 21:26:38 +00:00
|
|
|
_vtresult=0
|
|
|
|
if [ -n "$testlist" ]; then
|
|
|
|
if [ -n "$jobcount" ]; then
|
|
|
|
jobcount="-j $jobcount"
|
|
|
|
fi
|
2021-05-31 21:07:29 +00:00
|
|
|
cmd="$VTEST_PROGRAM -b $((2<<20)) -k -t 10 $keep_logs $verbose $debug $jobcount $vtestparams $testlist"
|
2018-12-18 21:47:23 +00:00
|
|
|
eval $cmd
|
2018-11-27 21:26:38 +00:00
|
|
|
_vtresult=$?
|
|
|
|
else
|
|
|
|
echo "No tests found that meet the required criteria"
|
|
|
|
fi
|
2018-12-19 09:25:07 +00:00
|
|
|
|
|
|
|
|
|
|
|
if [ $_vtresult -eq 0 ]; then
|
2019-05-16 21:15:31 +00:00
|
|
|
# all tests were successful, removing tempdir (the last part.)
|
2018-12-19 09:25:07 +00:00
|
|
|
# ignore errors is the directory is not empty or if it does not exist
|
|
|
|
rmdir "$TESTDIR" 2>/dev/null
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -d "${TESTDIR}" ]; then
|
|
|
|
echo "########################## Gathering results ##########################"
|
2018-11-29 20:41:42 +00:00
|
|
|
export TESTDIR
|
|
|
|
find "$TESTDIR" -type d -name "vtc.*" -exec sh -c 'for i; do
|
|
|
|
if [ ! -e "$i/LOG" ] ; then continue; fi
|
2018-12-19 09:25:07 +00:00
|
|
|
|
2018-11-29 20:41:42 +00:00
|
|
|
cat <<- EOF | tee -a "$TESTDIR/failedtests.log"
|
|
|
|
$(echo "###### $(cat "$i/INFO") ######")
|
|
|
|
$(echo "## test results in: \"$i\"")
|
2019-01-08 10:30:28 +00:00
|
|
|
$(grep -E -- "^(----|\* diag)" "$i/LOG")
|
2018-11-27 21:26:38 +00:00
|
|
|
EOF
|
2018-11-29 20:41:42 +00:00
|
|
|
done' sh {} +
|
2018-11-27 21:26:38 +00:00
|
|
|
fi
|
2018-12-19 09:25:07 +00:00
|
|
|
|
|
|
|
exit $_vtresult
|