REGTEST: Reg testing improvements.
Add a new target to the Makefile named "reg-tests-help" to have an idea about how to run the reg tests from haproxy Makefile. Handle list of levels and lists of level range passed to make with LEVEL variable. New supported syntax: LEVEL=1,4 make reg-tests LEVEL=1-2,5-6 make reg-tests Add two new levels 5 and 6. 5 is for broken script, 6 for experimental scripts. Signed-off-by: Frdric Lcaille <flecaille@haproxy.com>
This commit is contained in:
parent
44d59146a6
commit
d4f36e3eaa
34
Makefile
34
Makefile
|
@ -1093,10 +1093,34 @@ opts:
|
|||
@echo 'OBJS="$(strip $(OBJS))"'
|
||||
|
||||
# Target to run the regression testing script files.
|
||||
# LEVEL 1 scripts are dedicated to pure haproxy compliance tests (prefixed with 'h' letter).
|
||||
# LEVEL 2 scripts are slow scripts (prefixed with 's' letter).
|
||||
# LEVEL 3 scripts are low interest scripts (prefixed with 'l' letter).
|
||||
# LEVEL 4 scripts are in relation with bugs they help to reproduce (prefixed with 'b' letter).
|
||||
reg-tests:
|
||||
./scripts/run-regtests.sh --LEVEL "$$LEVEL" $(REG_TEST_FILES)
|
||||
.PHONY: reg-tests
|
||||
|
||||
reg-tests-help:
|
||||
@echo
|
||||
@echo "To launch the reg tests for haproxy, first export to your environment VARNISHTEST_PROGRAM variable to point to your varnishtest program:"
|
||||
@echo " $$ export VARNISHTEST_PROGRAM=/opt/local/bin/varnishtest"
|
||||
@echo "or"
|
||||
@echo " $$ setenv VARNISHTEST_PROGRAM /opt/local/bin/varnishtest"
|
||||
@echo
|
||||
@echo "The same thing may be done to set your haproxy program with HAPROXY_PROGRAM but with ./haproxy as default value."
|
||||
@echo
|
||||
@echo "To run all the tests:"
|
||||
@echo " $$ make reg-tests"
|
||||
@echo
|
||||
@echo "You can also set the programs to be used on the command line:"
|
||||
@echo " $$ VARNISHTEST_PROGRAM=<...> HAPROXY_PROGRAM=<...> make reg-tests"
|
||||
@echo
|
||||
@echo "To run tests with specific levels:"
|
||||
@echo " $$ LEVEL=1,3,4 make reg-tests #list of levels"
|
||||
@echo " $$ LEVEL=1-3,5-6 make reg-tests #list of range of levels"
|
||||
@echo
|
||||
@echo "About the levels:"
|
||||
@echo " LEVEL 1 scripts are dedicated to pure haproxy compliance tests (prefixed with 'h' letter)."
|
||||
@echo " LEVEL 2 scripts are slow scripts (prefixed with 's' letter)."
|
||||
@echo " LEVEL 3 scripts are low interest scripts (prefixed with 'l' letter)."
|
||||
@echo " LEVEL 4 scripts are in relation with bugs they help to reproduce (prefixed with 'b' letter)."
|
||||
@echo " LEVEL 5 scripts are broken scripts, typically used to fastly disable broken scripts (prefixed with 'k' letter)."
|
||||
@echo " LEVEL 6 scripts are experimental, typically used to develop new scripts (prefixed with 'e' lettre)."
|
||||
|
||||
.PHONY: reg-tests reg-tests-help
|
||||
|
|
|
@ -40,10 +40,85 @@ if [ "$1" = "--help" ]; then
|
|||
Configure environment variables to set the haproxy and varnishtest binaries to use
|
||||
setenv HAPROXY_PROGRAM /usr/local/sbin/haproxy
|
||||
setenv VARNISHTEST_PROGRAM /usr/local/bin/varnishtest
|
||||
or
|
||||
export HAPROXY_PROGRAM=/usr/local/sbin/haproxy
|
||||
export VARNISHTEST_PROGRAM=/usr/local/bin/varnishtest
|
||||
EOF
|
||||
return
|
||||
fi
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
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"
|
||||
|
@ -53,18 +128,14 @@ _startswith() {
|
|||
_findtests() {
|
||||
set -f
|
||||
LEVEL=${LEVEL:-0};
|
||||
EXPR='*.vtc'
|
||||
if [ $LEVEL = 1 ] ; then
|
||||
EXPR='h*.vtc';
|
||||
elif [ $LEVEL = 2 ] ; then
|
||||
EXPR='s*.vtc';
|
||||
elif [ $LEVEL = 3 ] ; then
|
||||
EXPR='l*.vtc';
|
||||
elif [ $LEVEL = 4 ] ; then
|
||||
EXPR='b*.vtc';
|
||||
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" -name "$EXPR" ); do
|
||||
for i in $( find "$1" $(eval echo $EXPR) ); do
|
||||
skiptest=
|
||||
require_version="$(sed -ne 's/^#REQUIRE_VERSION=//p' "$i")"
|
||||
require_version_below="$(sed -ne 's/^#REQUIRE_VERSION_BELOW=//p' "$i")"
|
||||
|
|
Loading…
Reference in New Issue