Received: by 10.192.165.148 with SMTP id m20csp682294imm; Fri, 4 May 2018 18:17:04 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrwGa5CWsNVPMfD/a6enODQuE3QHEvz4dYIGSuUrKPg4qjBEiwSX0WURzvWWOvgAx0Cpsl0 X-Received: by 2002:a17:902:5a5:: with SMTP id f34-v6mr29513658plf.288.1525483024414; Fri, 04 May 2018 18:17:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525483024; cv=none; d=google.com; s=arc-20160816; b=bGd6Zf19d6UZ3iEYZerZu0N55iQYGZQkz/Wc4KDtPJaBqqJGwhJp3qESJXOsHH80q7 vJaNgzBvfs0T8ymgca+EKWMHuQMq8Drp4F7tLhQBCrJCfMcfKi44DtW+xoEJht5U4S+J aO+LCNlwzZEDnTtZCWi4ClK28Admv8z+bAG3EBuA4vwY1od6ugoj6Zyd+AjDD/RgPVYL KHKZEnfDPniiBH15MSaop4MhIyzymULyoeTBMII3vhU5j4JI3nJtqFNdcV+W1N9L05s8 Ma4m0DfId3gTBGGAQ5p+w9sDucC6WRtUdNVSpz2E0YDVizDoIO/INJz2bMfMHOKcC42T VAxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=NrZ+wrF8Ur4jclrWagqHm7zy+enlvm587/hJH2f1h2w=; b=tu3+ZXoE2xXmEuj57DvhkLn9XZSdrRSunZ/kkomTi/mFULYEnJuyi4PNTRSx2b5fXe CHOOds9nD50PK5qTcMYJ038TGBs2ucRP/TWzTjftudYjix5MZxBA3GgeCH8ACQmIHttG wx9QeQ7qUA6RrNGlDPbcr0t8q4+RjCqDDcnzcVh6Ku8NVpoLjlohnoKxDMfWKFk61NFF vNQcS0lNm3/NmSUt/0TE9EPcV/umaGJz/eknFWvUWOXn6lQKhvzLtsYk+uq/blMZh8kx k2gtJnVyxaQ7A28XLaJi5TLbQM5gAnW04S99TnqSSWbMsQRY3CTD94SfX0TBE1s5+ceB OoBw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f18si14706136pff.208.2018.05.04.18.16.50; Fri, 04 May 2018 18:17:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752121AbeEEBQN (ORCPT + 99 others); Fri, 4 May 2018 21:16:13 -0400 Received: from mailout.easymail.ca ([64.68.200.34]:50496 "EHLO mailout.easymail.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751808AbeEEBQL (ORCPT ); Fri, 4 May 2018 21:16:11 -0400 Received: from localhost (localhost [127.0.0.1]) by mailout.easymail.ca (Postfix) with ESMTP id 315B021075; Sat, 5 May 2018 01:16:11 +0000 (UTC) Received: from mailout.easymail.ca ([127.0.0.1]) by localhost (emo02-pco.easydns.vpn [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1XnE51rr5N18; Sat, 5 May 2018 01:16:11 +0000 (UTC) Received: from localhost.localdomain (c-24-9-64-241.hsd1.co.comcast.net [24.9.64.241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mailout.easymail.ca (Postfix) with ESMTPSA id 976DC21020; Sat, 5 May 2018 01:16:04 +0000 (UTC) From: "Shuah Khan (Samsung OSG)" To: shuah@kernel.org, mcgrof@kernel.org Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 13/24] selftests: kmod: return Kselftest Skip code for skipped tests Date: Fri, 4 May 2018 19:13:17 -0600 Message-Id: <20180505011328.32078-13-shuah@kernel.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180505011328.32078-1-shuah@kernel.org> References: <20180505011328.32078-1-shuah@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When kmod test is skipped because of unmet dependencies and/or unsupported configuration, it returns 0 which is treated as a pass by the Kselftest framework. This leads to false positive result even when the test could not be run. It returns fail in some cases when test is skipped. Either way, it is incorrect and incosnistent reporting. Change it to return kselftest skip code when a test gets skipped to clearly report that the test could not be run. Kselftest framework SKIP code is 4 and the framework prints appropriate messages to indicate that the test is skipped. Signed-off-by: Shuah Khan (Samsung OSG) --- tools/testing/selftests/kmod/kmod.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tools/testing/selftests/kmod/kmod.sh b/tools/testing/selftests/kmod/kmod.sh index 7956ea3be667..0a76314b4414 100755 --- a/tools/testing/selftests/kmod/kmod.sh +++ b/tools/testing/selftests/kmod/kmod.sh @@ -62,13 +62,16 @@ ALL_TESTS="$ALL_TESTS 0007:5:1" ALL_TESTS="$ALL_TESTS 0008:150:1" ALL_TESTS="$ALL_TESTS 0009:150:1" +# Kselftest framework requirement - SKIP code is 4. +ksft_skip=4 + test_modprobe() { if [ ! -d $DIR ]; then echo "$0: $DIR not present" >&2 echo "You must have the following enabled in your kernel:" >&2 cat $TEST_DIR/config >&2 - exit 1 + exit $ksft_skip fi } @@ -105,12 +108,12 @@ test_reqs() { if ! which modprobe 2> /dev/null > /dev/null; then echo "$0: You need modprobe installed" >&2 - exit 1 + exit $ksft_skip fi if ! which kmod 2> /dev/null > /dev/null; then echo "$0: You need kmod installed" >&2 - exit 1 + exit $ksft_skip fi # kmod 19 has a bad bug where it returns 0 when modprobe @@ -124,13 +127,13 @@ test_reqs() echo "$0: You need at least kmod 20" >&2 echo "kmod <= 19 is buggy, for details see:" >&2 echo "http://git.kernel.org/cgit/utils/kernel/kmod/kmod.git/commit/libkmod/libkmod-module.c?id=fd44a98ae2eb5eb32161088954ab21e58e19dfc4" >&2 - exit 1 + exit $ksft_skip fi uid=$(id -u) if [ $uid -ne 0 ]; then echo $msg must be run as root >&2 - exit 0 + exit $ksft_skip fi } -- 2.14.1