提交 570c0537 编写于 作者: Q Quentin Monnet 提交者: Greg Kroah-Hartman

selftests/bpf: fix return value comparison for tests in test_libbpf.sh

[ Upstream commit c5fa5d602221362f8341ecd9e32d83194abf5bd9 ]

The return value for each test in test_libbpf.sh is compared with

    if (( $? == 0 )) ; then ...

This works well with bash, but not with dash, that /bin/sh is aliased to
on some systems (such as Ubuntu).

Let's replace this comparison by something that works on both shells.
Signed-off-by: NQuentin Monnet <quentin.monnet@netronome.com>
Reviewed-by: NJakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
Signed-off-by: NSasha Levin <sashal@kernel.org>
上级 3173e226
...@@ -6,7 +6,7 @@ export TESTNAME=test_libbpf ...@@ -6,7 +6,7 @@ export TESTNAME=test_libbpf
# Determine selftest success via shell exit code # Determine selftest success via shell exit code
exit_handler() exit_handler()
{ {
if (( $? == 0 )); then if [ $? -eq 0 ]; then
echo "selftests: $TESTNAME [PASS]"; echo "selftests: $TESTNAME [PASS]";
else else
echo "$TESTNAME: failed at file $LAST_LOADED" 1>&2 echo "$TESTNAME: failed at file $LAST_LOADED" 1>&2
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册