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: 127208 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp724662ljc; Wed, 7 Feb 2018 10:15:46 -0800 (PST) X-Google-Smtp-Source: AH8x2277pveRdJMmm0gCphPf69wqta5TGjlkMxWzrBraLyUKZUByjF5nBfJe9BBcM57yAjYg2LVT X-Received: by 10.99.182.75 with SMTP id v11mr5507128pgt.158.1518027346342; Wed, 07 Feb 2018 10:15:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518027346; cv=none; d=google.com; s=arc-20160816; b=eiyFZKR99MFmyLtunPyUDZRGLXIJSBYoi+7y2hVtAYHKTOQqHpvOObH78X1wOoNvKs kx+g8eVnb0GGKm3izTyzlLCW+8uKjcWejHlMh8VnrTigvcqq2zH3q10UOjGsXrsanZXu Ny7IO8ENVAwlXI6o+hgNAlHLHxRQ41tGTEj+lep6fxs6SBT2p0ezJFCj8w0vqtPBIccX CmaAI8w7HaMTe7W0wAhyCX2vuS45KMsDTq5LP36gQ2jvq0jMlNZzWPTGRW/gufpw4uQ/ hmU7YE36mAdjGIt2YFxo86LhD0mjEB9z9MVLIm5WSemQn7Oxmzz85dE7RxY+LebVDBZY W66w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=mYuN2Qr7xd+1UZ20RoU4QuTsXh0CqvJxZYXuVZyBe/Q=; b=QlRy+J4jPONtG/r3cHCL2oHInblEVZWhVop4NnlxwBPqz+okW57D0CwIFfcU/Ho8/N FWhCUtc4fCumNCBGAsUvQdcLFa55A7w+tR669VEW5o0caKWRbCGVB1RZ5Hh9xOY2F2lb qOzxl88MLecSC4pe9FjRPXNoTfUq9LmXppvPMS8XljO1RuoEd1GUTYS84AVbpTv9gEby WSrlZ39qu9AK0L98/cqoLKHP0w9pudAZju/nlKJECi95JE8igfZi4suYxfIfA2yI44wb J+xaQ38Jsjn7eGHPMSLCjmzQxG1ceCxQIpgbP2M9LrESYbDmmWGKJswyVYY87mJr6w9t GYcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BBeDSec9; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z15-v6si1428458pll.744.2018.02.07.10.15.46; Wed, 07 Feb 2018 10:15:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BBeDSec9; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754089AbeBGSPn (ORCPT + 8 others); 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-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(-) -- 2.7.4 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