From mboxrd@z Thu Jan 1 00:00:00 1970 From: Quentin Monnet Subject: [PATCH bpf-next] selftests/bpf: fix return value comparison for tests in test_libbpf.sh Date: Sat, 20 Oct 2018 22:58:44 +0100 Message-ID: <1540072724-26002-1-git-send-email-quentin.monnet@netronome.com> Cc: netdev@vger.kernel.org, oss-drivers@netronome.com, Quentin Monnet To: Alexei Starovoitov , Daniel Borkmann Return-path: Received: from mail-wr1-f68.google.com ([209.85.221.68]:45913 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726554AbeJUGKu (ORCPT ); Sun, 21 Oct 2018 02:10:50 -0400 Received: by mail-wr1-f68.google.com with SMTP id f17-v6so9164321wrs.12 for ; Sat, 20 Oct 2018 14:58:56 -0700 (PDT) Sender: netdev-owner@vger.kernel.org List-ID: 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 Reviewed-by: Jakub Kicinski --- tools/testing/selftests/bpf/test_libbpf.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/bpf/test_libbpf.sh b/tools/testing/selftests/bpf/test_libbpf.sh index d97dc914cd49..156d89f1edcc 100755 --- a/tools/testing/selftests/bpf/test_libbpf.sh +++ b/tools/testing/selftests/bpf/test_libbpf.sh @@ -6,7 +6,7 @@ export TESTNAME=test_libbpf # Determine selftest success via shell exit code exit_handler() { - if (( $? == 0 )); then + if [ $? -eq 0 ]; then echo "selftests: $TESTNAME [PASS]"; else echo "$TESTNAME: failed at file $LAST_LOADED" 1>&2 -- 2.7.4