hs-test: support running multiple specific tests
- make test TEST=[test1],[test2] runs those two tests in random order Type: test Change-Id: I1a1af7c99ef7867ca94cec4175605f428dcd58fd Signed-off-by: Adrian Villin <avillin@cisco.com>
This commit is contained in:
@ -27,7 +27,7 @@ Anatomy of a test case
|
|||||||
**Action flow when running a test case**:
|
**Action flow when running a test case**:
|
||||||
|
|
||||||
#. It starts with running ``make test``. Optional arguments are VERBOSE, PERSIST (topology configuration isn't cleaned up after test run, use ``make cleanup-hst`` to clean up),
|
#. It starts with running ``make test``. Optional arguments are VERBOSE, PERSIST (topology configuration isn't cleaned up after test run, use ``make cleanup-hst`` to clean up),
|
||||||
TEST=<test-name> to run a specific test and PARALLEL=[n-cpus].
|
TEST=<test-name> to run a specific test and PARALLEL=[n-cpus]. If you want to run multiple specific tests, separate their names with a comma.
|
||||||
#. ``make list-tests`` (or ``make help``) shows all tests.
|
#. ``make list-tests`` (or ``make help``) shows all tests.
|
||||||
#. ``Ginkgo`` looks for a spec suite in the current directory and then compiles it to a .test binary.
|
#. ``Ginkgo`` looks for a spec suite in the current directory and then compiles it to a .test binary.
|
||||||
#. The Ginkgo test framework runs each function that was registered manually using ``Register[SuiteName]Test()``. Each of these functions correspond to a suite.
|
#. The Ginkgo test framework runs each function that was registered manually using ``Register[SuiteName]Test()``. Each of these functions correspond to a suite.
|
||||||
|
@ -3,14 +3,14 @@
|
|||||||
source vars
|
source vars
|
||||||
|
|
||||||
args=
|
args=
|
||||||
single_test=0
|
focused_test=0
|
||||||
persist_set=0
|
persist_set=0
|
||||||
unconfigure_set=0
|
unconfigure_set=0
|
||||||
debug_set=0
|
debug_set=0
|
||||||
leak_check_set=0
|
leak_check_set=0
|
||||||
debug_build=
|
debug_build=
|
||||||
ginkgo_args=
|
ginkgo_args=
|
||||||
tc_name=
|
tc_names=()
|
||||||
|
|
||||||
for i in "$@"
|
for i in "$@"
|
||||||
do
|
do
|
||||||
@ -55,13 +55,12 @@ case "${i}" in
|
|||||||
args="$args -vppsrc ${i#*=}"
|
args="$args -vppsrc ${i#*=}"
|
||||||
;;
|
;;
|
||||||
--test=*)
|
--test=*)
|
||||||
tc_name="${i#*=}"
|
tc_list="${i#*=}"
|
||||||
if [ "$tc_name" != "all" ]; then
|
|
||||||
single_test=1
|
|
||||||
ginkgo_args="$ginkgo_args --focus $tc_name -vv"
|
|
||||||
args="$args -verbose"
|
|
||||||
else
|
|
||||||
ginkgo_args="$ginkgo_args -v"
|
ginkgo_args="$ginkgo_args -v"
|
||||||
|
if [ "$tc_list" != "all" ]; then
|
||||||
|
focused_test=1
|
||||||
|
IFS=',' read -r -a tc_names <<< "$tc_list"
|
||||||
|
args="$args -verbose"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
--parallel=*)
|
--parallel=*)
|
||||||
@ -86,12 +85,16 @@ case "${i}" in
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ $single_test -eq 0 ] && [ $persist_set -eq 1 ]; then
|
for name in "${tc_names[@]}"; do
|
||||||
|
ginkgo_args="$ginkgo_args --focus $name"
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ $focused_test -eq 0 ] && [ $persist_set -eq 1 ]; then
|
||||||
echo "persist flag is not supported while running all tests!"
|
echo "persist flag is not supported while running all tests!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $unconfigure_set -eq 1 ] && [ $single_test -eq 0 ]; then
|
if [ $unconfigure_set -eq 1 ] && [ $focused_test -eq 0 ]; then
|
||||||
echo "a single test has to be specified when unconfigure is set"
|
echo "a single test has to be specified when unconfigure is set"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@ -101,13 +104,13 @@ if [ $persist_set -eq 1 ] && [ $unconfigure_set -eq 1 ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $single_test -eq 0 ] && [ $debug_set -eq 1 ]; then
|
if [ $focused_test -eq 0 ] && [ $debug_set -eq 1 ]; then
|
||||||
echo "VPP debug flag is not supported while running all tests!"
|
echo "VPP debug flag is not supported while running all tests!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $leak_check_set -eq 1 ]; then
|
if [ $leak_check_set -eq 1 ]; then
|
||||||
if [ $single_test -eq 0 ]; then
|
if [ $focused_test -eq 0 ]; then
|
||||||
echo "a single test has to be specified when leak_check is set"
|
echo "a single test has to be specified when leak_check is set"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
Reference in New Issue
Block a user