REGTEST: replace LEVEL option by a more human readable one.

This patch replaces LEVEL variable by REGTESTS_TYPES variable which is more
mnemonic and human readable. It is uses as a filter to run the reg tests scripts
where a commented #REGTEST_TYPE may be defined to designate their types.
Running the following command:

    $ REGTESTS_TYPES=slow,default

will start all the reg tests where REGTEST_TYPE is defines as 'slow' or 'default'.
Note that 'default' is also the default value of REGTEST_TYPE when not specified
dedicated to run all the current h*.vtc files. When REGTESTS_TYPES is not specified
there is no filter at all. All the tests are run.

This patches also defines REGTEST_TYPE with 'slow' value for all the s*.vtc files,
'bug' value for al the b*.vtc files, 'broken' value for all the k*.vtc files.
This commit is contained in:
Frdric Lcaille
2019-03-29 15:07:24 +01:00
committed by Willy Tarreau
parent 0bad840b4d
commit dc1a3bd999
23 changed files with 77 additions and 58 deletions

View File

@@ -28,6 +28,13 @@ _help()
--vtestparams <ARGS>, passes custom ARGS to vtest
run-regtests.sh --vtestparams "-n 10"
--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.
The value of REGTESTS_TYPE supported are: default, slow, bug, broken and
experimental. When not specified, it is set to 'default' as default value.
run-regtest.sh --type slow,default
--clean to cleanup previous reg-tests log directories and exit
run-regtests.sh --clean
@@ -105,39 +112,6 @@ add_range_to_test_list()
echo $list
}
build_test_list()
{
# Remove any spacing character
LEVEL="$(echo $LEVEL | tr -d ' ')"
# Replave any comma character by a space character
LEVEL="$(echo $LEVEL | tr ',' ' ')"
list=
for range in $LEVEL ; do
if [ -z "$list" ] ; then
list=$(add_range_to_test_list $range)
else
list="$list $(add_range_to_test_list $range)"
fi
done
echo $list
}
build_find_expr()
{
expr=
for i in $@; do
if [ -z "$expr" ] ; then
expr="-name \"$i\""
else
expr="$expr -o -name \"$i\""
fi
done
echo $expr
}
_startswith() {
_str="$1"
_sub="$2"
@@ -146,20 +120,25 @@ _startswith() {
_findtests() {
set -f
LEVEL=${LEVEL:-0};
list=$(build_test_list "$LEVEL")
if [ -z "$list" ] ; then
echo "Invalid level specification '"$LEVEL"' or no file was found."
exit 1
fi
EXPR=$(build_find_expr $list)
for i in $( find "$1" $(eval echo $EXPR) ); do
REGTESTS_TYPES="${REGTESTS_TYPES:-any}"
any_test=$(echo $REGTESTS_TYPES | grep -cw "any")
for i in $( find "$1" -name *.vtc ); do
skiptest=
require_version="$(sed -ne 's/^#REQUIRE_VERSION=//p' "$i")"
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')"
if [ $any_test -ne 1 ] ; then
regtest_type="$(sed -ne 's/^#REGTEST_TYPE=//p' "$i")"
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
requiredoption="$(sed -ne 's/^#REQUIRE_OPTION=//p' "$i" | sed -e 's/,.*//')"
if [ -n "$requiredoption" ]; then
@@ -264,10 +243,10 @@ _process() {
--keep-logs)
keep_logs="-L"
;;
--LEVEL)
LEVEL="$2"
shift
;;
--type)
REGTESTS_TYPES="$2"
shift
;;
--use-htx)
no_htx=""
;;