]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
tests/shell: special handle base path starting with "./"
authorThomas Haller <thaller@redhat.com>
Wed, 13 Sep 2023 17:05:07 +0000 (19:05 +0200)
committerFlorian Westphal <fw@strlen.de>
Fri, 15 Sep 2023 14:04:43 +0000 (16:04 +0200)
When we auto detect the tests with `tests/shell/run-tests.sh -L`, then
commonly the NFT_TEST_BASEDIR starts with a redundant "./". That's a bit
ugly.

Instead, special handle that case and remove the prefix. The effect is
that `tests/shell/run-tests.sh -L` shows

  tests/shell/testcases/bitwise/0040mark_binop_0

instead of

  ./tests/shell/testcases/bitwise/0040mark_binop_0

Signed-off-by: Thomas Haller <thaller@redhat.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
tests/shell/run-tests.sh

index 1501f90efb282005084261caac07e4fc86fff037..12901ab3bed08831fbd037c479967c15a3b6dafa 100755 (executable)
@@ -320,7 +320,9 @@ find_tests() {
 }
 
 if [ "${#TESTS[@]}" -eq 0 ] ; then
-       TESTS=( $(find_tests "$NFT_TEST_BASEDIR/testcases/") )
+       d="$NFT_TEST_BASEDIR/testcases/"
+       d="${d#./}"
+       TESTS=( $(find_tests "$d") )
        test "${#TESTS[@]}" -gt 0 || msg_error "Could not find tests"
        if [ -z "$NFT_TEST_SHUFFLE_TESTS" ] ; then
                NFT_TEST_SHUFFLE_TESTS=y