run-tests: fix CLI

Restore the original behavior that was accidentally changed:
When no args are given, run the basic test suite.
Otherwise, run the given command with default scenario 'default'.
Previously, `run-tests.sh build` ran the basic test suite instead of
building the default scenario.
This commit is contained in:
Erik Arvstedt 2020-12-11 13:26:03 +01:00
parent b2a7158c4e
commit 8cbdef8bf6
No known key found for this signature in database
GPG Key ID: 33312B944DD97846
1 changed files with 13 additions and 11 deletions

View File

@ -185,20 +185,22 @@ all() {
scenario=netnsRegtest buildTest "$@" scenario=netnsRegtest buildTest "$@"
} }
# An alias for buildTest
build() { build() {
if [[ $scenario ]]; then buildTest "$@"
buildTest "$@"
else
basic "$@"
fi
} }
command="${1:-build}" if [[ $# > 0 && $1 != -* ]]; then
shift || true # An explicit command was provided
if [[ $command != build ]]; then command=$1
shift
if [[ $command == eval ]]; then
command=evalTest
fi
: ${scenario:=default} : ${scenario:=default}
fi elif [[ $scenario ]]; then
if [[ $command == eval ]]; then command=buildTest
command=evalTest else
command=basic
fi fi
$command "$@" $command "$@"