Skip to content

Commit 978d12e

Browse files
committed
automated: linux: kunit: fix return code check
The check "$?" checks against a string, which isn't correct it should check against a return code. Rewrote the if-statement to do lsmod | grep. Reported-by: Yongqin Liu <yongqin.liu@linaro.org> Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
1 parent e955837 commit 978d12e

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

automated/linux/kunit/kunit.sh

+1-2
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,7 @@ rm /tmp/kunit_module_names_not_loaded.txt 2>/dev/null
6363
# find modules that isn't loaded
6464
while read -r module; do
6565
module_name=$(basename "${module}" ".ko")
66-
lsmod |grep "${module_name}"
67-
if [ $? != "${module_name}" ]; then
66+
if ! lsmod | grep "${module_name}"; then
6867
echo "${module_name}" | tee -a /tmp/kunit_module_names_not_loaded.txt
6968
fi
7069
done < "/tmp/kunit_modules.txt"

0 commit comments

Comments
 (0)