Maros Ondrejicka af004ddad1 hs-test: add option to unconfigure topology
Adding `UNCONFIGURE=true` argument when running `make test` will skip
test run and unconfigure existing topology for that test.

Type: test
Signed-off-by: Maros Ondrejicka <mondreji@cisco.com>
Change-Id: I197747a56ca68807f0b2c3f25b6f61c3dcc41ace
2023-02-28 16:36:41 +00:00

58 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
source vars
args=
single_test=0
persist_set=0
unconfigure_set=0
for i in "$@"
do
case "${i}" in
--persist=*)
persist="${i#*=}"
if [ $persist = "true" ]; then
args="$args -persist"
persist_set=1
fi
;;
--verbose=*)
verbose="${i#*=}"
if [ $verbose = "true" ]; then
args="$args -verbose"
fi
;;
--unconfigure=*)
unconfigure="${i#*=}"
if [ $unconfigure = "true" ]; then
args="$args -unconfigure"
unconfigure_set=1
fi
;;
--test=*)
tc_name="${i#*=}"
if [ $tc_name != "all" ]; then
single_test=1
args="$args -run $tc_name"
fi
esac
done
if [ $single_test -eq 0 ] && [ $persist_set -eq 1 ]; then
echo "persist flag is not supported while running all tests!"
exit 1
fi
if [ $unconfigure_set -eq 1 ] && [ $single_test -eq 0 ]; then
echo "a single test has to be specified when unconfigure is set"
exit 1
fi
if [ $persist_set -eq 1 ] && [ $unconfigure_set -eq 1 ]; then
echo "setting persist flag and unconfigure flag is not allowed"
exit 1
fi
sudo -E go test -buildvcs=false -v $args