From patchwork Wed Feb 7 18:15:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naresh Kamboju X-Patchwork-Id: 870574 X-Patchwork-Delegate: bpf@iogearbox.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="BBeDSec9"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3zc8dZ2091z9s4q for ; Thu, 8 Feb 2018 05:15:46 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754089AbeBGSPn (ORCPT ); Wed, 7 Feb 2018 13:15:43 -0500 Received: from mail-pg0-f68.google.com ([74.125.83.68]:41006 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753794AbeBGSPm (ORCPT ); Wed, 7 Feb 2018 13:15:42 -0500 Received: by mail-pg0-f68.google.com with SMTP id 141so601229pgd.8 for ; Wed, 07 Feb 2018 10:15:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=mYuN2Qr7xd+1UZ20RoU4QuTsXh0CqvJxZYXuVZyBe/Q=; b=BBeDSec9O0FKLP1owXVez4V0N2FMFTRu5C5JfDBUsAmJhMIyf1iKx3I5fqpDKf0tvt k6M9rb/nIFxh+JTCgDVv5+FT4XHp2Gb0EETI/EALAf9gW5euYDDys2VlPKsLNc7hfUyR m9H5/UF3NKvIcXENm6SiR1rEnuJUJKbAwI50Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=mYuN2Qr7xd+1UZ20RoU4QuTsXh0CqvJxZYXuVZyBe/Q=; b=swlSQeTyIFBKEdEen5JdNmlTtsZRovLAh09YiSUfuYa8qxR9/10NPYi8m/IxNEa/mi Q7OgeEXBjXkQGINJ5cIyS9i2G0zRhE9nK9j/lC7YRZWVlvOMdXFRn7XRjRiFHjWveNBj uqwYIoq4WAV80r21/yoAknmCNNIqRv4oFJBzKhYX7xnGfWxYl0IaM/zxlsflC2AJ7Ini bjDlvsCQZ7CszoRdrY4sZO92WCC7kovgESn2Ga+fhKfTX3E2nvw0/1L5xNX3gDjl59MX rzArFBDYfmNro1xrx3EOYBeM56ZlWf/KeDLjTqpjSxasx3ke5ML5CgqdHfbMcQabDun9 LnHA== X-Gm-Message-State: APf1xPC+KCpXGuNDn0Yb4Kfq+81YQNgrP45LKsVuTKTUCzlCCKw4LFFG lZ12t1bc/86pdIcJUcHeLXTmmw== X-Google-Smtp-Source: AH8x225ZjXDw4/yrhq4tDzo8Vg3cTfgQUapvxjYWiyqWFugSO/vIpgLhGdOB16JgOQV+8NGFH0HGeg== X-Received: by 10.98.144.79 with SMTP id a76mr6787074pfe.15.1518027341292; Wed, 07 Feb 2018 10:15:41 -0800 (PST) Received: from localhost.localdomain ([183.82.210.238]) by smtp.gmail.com with ESMTPSA id y13sm6895680pfj.96.2018.02.07.10.15.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 07 Feb 2018 10:15:39 -0800 (PST) From: Naresh Kamboju To: linux-kselftest@vger.kernel.org, netdev@vger.kernel.org Cc: shuahkh@osg.samsung.com, daniel@iogearbox.net, shuah@kernel.org, alexei.starovoitov@gmail.com, ast@kernel.org Subject: [PATCH v2] selftests: bpf: test_kmod.sh: check the module path before insmod Date: Wed, 7 Feb 2018 23:45:34 +0530 Message-Id: <1518027334-9814-1-git-send-email-naresh.kamboju@linaro.org> X-Mailer: git-send-email 2.7.4 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org test_kmod.sh reported false failure when module not present. Check test_bpf.ko is present in the path before loading it. Two cases to be addressed here, In the development process of test_bpf.c unit testing will be done by developers by using "insmod $SRC_TREE/lib/test_bpf.ko" On the other hand testers run full tests by installing modules on device under test (DUT) and followed by modprobe to insert the modules accordingly. Signed-off-by: Naresh Kamboju --- tools/testing/selftests/bpf/test_kmod.sh | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/bpf/test_kmod.sh b/tools/testing/selftests/bpf/test_kmod.sh index ed4774d..35669cc 100755 --- a/tools/testing/selftests/bpf/test_kmod.sh +++ b/tools/testing/selftests/bpf/test_kmod.sh @@ -10,9 +10,21 @@ test_run() echo "[ JIT enabled:$1 hardened:$2 ]" dmesg -C - insmod $SRC_TREE/lib/test_bpf.ko 2> /dev/null - if [ $? -ne 0 ]; then - rc=1 + if [ -f ${SRC_TREE}/lib/test_bpf.ko ]; then + insmod ${SRC_TREE}/lib/test_bpf.ko 2> /dev/null + if [ $? -ne 0 ]; then + rc=1 + fi + else + # Use modprobe dry run to check for missing test_bpf module + if ! /sbin/modprobe -q -n test_bpf; then + echo "test_bpf: [SKIP]" + elif /sbin/modprobe -q test_bpf; then + echo "test_bpf: ok" + else + echo "test_bpf: [FAIL]" + rc=1 + fi fi rmmod test_bpf 2> /dev/null dmesg | grep FAIL