Commit 570c0537 authored by Quentin Monnet's avatar Quentin Monnet Committed by Greg Kroah-Hartman

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

[ Upstream commit c5fa5d60 ]

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: default avatarQuentin Monnet <quentin.monnet@netronome.com>
Reviewed-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 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%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment