diff options
author | Thomas Haller <thaller@redhat.com> | 2023-09-06 13:52:06 +0200 |
---|---|---|
committer | Florian Westphal <fw@strlen.de> | 2023-09-07 19:35:20 +0200 |
commit | efca71b22f9e4b51ea5620eeeab84e52d3410f38 (patch) | |
tree | 289476957df0fc68974e16986acea292cb7805ce | |
parent | e69be63ca99b472872c2a213485c595d444cf0af (diff) |
tests/shell: check test names before start and support directories
Check for valid test names early. That's useful because we treat any
unrecognized options as test names. We should detect a mistake early.
While at it, also support specifying directory names instead of
executable files.
Signed-off-by: Thomas Haller <thaller@redhat.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
-rwxr-xr-x | tests/shell/run-tests.sh | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/shell/run-tests.sh b/tests/shell/run-tests.sh index 5f526dd8..34c3b324 100755 --- a/tests/shell/run-tests.sh +++ b/tests/shell/run-tests.sh @@ -109,6 +109,18 @@ if [ "${#TESTS[@]}" -eq 0 ] ; then test "${#TESTS[@]}" -gt 0 || msg_error "Could not find tests" fi +TESTSOLD=( "${TESTS[@]}" ) +TESTS=() +for t in "${TESTSOLD[@]}" ; do + if [ -f "$t" -a -x "$t" ] ; then + TESTS+=( "$t" ) + elif [ -d "$t" ] ; then + TESTS+=( $(find_tests "$t") ) + else + msg_error "Unknown test \"$t\"" + fi +done + if [ "$DO_LIST_TESTS" = y ] ; then printf '%s\n' "${TESTS[@]}" exit 0 |