Commit c5fa5d60 authored by Quentin Monnet's avatar Quentin Monnet Committed by Alexei Starovoitov

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

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>
parent 76b5e303
...@@ -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