selftests: kselftest_deps: fix l5_test() empty variable
authorLu Dai <dai.lu@exordes.com>
Sat, 4 May 2024 15:01:06 +0000 (18:01 +0300)
committerShuah Khan <skhan@linuxfoundation.org>
Wed, 8 May 2024 22:46:41 +0000 (16:46 -0600)
In the function l5_test(), variable $tests is empty when there is no .mk
file in the subsystem to be tested. It causes the following grep operation
get stuck.

This fix check the variable $tests, return when it is empty.

Signed-off-by: Lu Dai <dai.lu@exordes.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
tools/testing/selftests/kselftest_deps.sh

index de59cc8f03c3f1ad9867a1e19505b657cdfc1d7d..487e49fdf2a62ec9550a0a8a2a6850d1082dc1e0 100755 (executable)
@@ -244,6 +244,7 @@ l4_test()
 l5_test()
 {
        tests=$(find $(dirname "$test") -type f -name "*.mk")
+       [[ -z "${tests// }" ]] && return
        test_libs=$(grep "^IOURING_EXTRA_LIBS +\?=" $tests | \
                        cut -d "=" -f 2)