Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Quentin Monnet <quentin.monnet@netronome.com>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>

authored by

Quentin Monnet and committed by
Alexei Starovoitov
c5fa5d60 76b5e303

+1 -1
+1 -1
tools/testing/selftests/bpf/test_libbpf.sh
··· 6 6 # Determine selftest success via shell exit code 7 7 exit_handler() 8 8 { 9 - if (( $? == 0 )); then 9 + if [ $? -eq 0 ]; then 10 10 echo "selftests: $TESTNAME [PASS]"; 11 11 else 12 12 echo "$TESTNAME: failed at file $LAST_LOADED" 1>&2