提交 8bd2d755 编写于 作者: H Hangbin Liu 提交者: Zheng Zengkai

selftests/bpf/test_lirc_mode2.sh: Exit with proper code

stable inclusion
from stable-v5.10.110
commit 75a4a97b7463029d95acb422d630a53ee3ff28f3
bugzilla: https://gitee.com/openeuler/kernel/issues/I574AL

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=75a4a97b7463029d95acb422d630a53ee3ff28f3

--------------------------------

[ Upstream commit ec80906b ]

When test_lirc_mode2_user exec failed, the test report failed but still
exit with 0. Fix it by exiting with an error code.

Another issue is for the LIRCDEV checking. With bash -n, we need to quote
the variable, or it will always be true. So if test_lirc_mode2_user was
not run, just exit with skip code.

Fixes: 6bdd533c ("bpf: add selftest for lirc_mode2 type program")
Signed-off-by: NHangbin Liu <liuhangbin@gmail.com>
Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20220321024149.157861-1-liuhangbin@gmail.comSigned-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NYu Liao <liaoyu15@huawei.com>
Reviewed-by: NWei Li <liwei391@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 8d00730a
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
# Kselftest framework requirement - SKIP code is 4. # Kselftest framework requirement - SKIP code is 4.
ksft_skip=4 ksft_skip=4
ret=$ksft_skip
msg="skip all tests:" msg="skip all tests:"
if [ $UID != 0 ]; then if [ $UID != 0 ]; then
...@@ -25,7 +26,7 @@ do ...@@ -25,7 +26,7 @@ do
fi fi
done done
if [ -n $LIRCDEV ]; if [ -n "$LIRCDEV" ];
then then
TYPE=lirc_mode2 TYPE=lirc_mode2
./test_lirc_mode2_user $LIRCDEV $INPUTDEV ./test_lirc_mode2_user $LIRCDEV $INPUTDEV
...@@ -36,3 +37,5 @@ then ...@@ -36,3 +37,5 @@ then
echo -e ${GREEN}"PASS: $TYPE"${NC} echo -e ${GREEN}"PASS: $TYPE"${NC}
fi fi
fi fi
exit $ret
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册