Received: by 10.192.165.148 with SMTP id m20csp682727imm; Fri, 4 May 2018 18:17:51 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoZF2MdIJwJp7nmnTUCMrKLHERTmDAwpGlmqpuZX55q3eplAE8dilN9Ha1mJUZ1jz3/jAvH X-Received: by 2002:a17:902:6941:: with SMTP id k1-v6mr23670519plt.161.1525483071287; Fri, 04 May 2018 18:17:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525483071; cv=none; d=google.com; s=arc-20160816; b=MgIISt0GjhWjluucjBLY4tmBAeX1C7dXrJ52TWjQs8Fny/vgh0sshQmp1b4FK0gA4/ wiiUq1zwzH35WOc8dKlDwkt/Mi+IyplVqWANmJGuIvVZ0nd5HIN+Jpi3mzgXn9zpwn9K OmOtdLOvGZ0VfIrTXMaO5CDLVPi6+VnkHzn2dcnzARe/c6xgKuqyFncMsx4L0gnBgUzA KzF6CGxs5XfxyC4OPwhtMB9zdUqdlyA5SShyhL1F/e1uUVbIk3AFMTBxCeWxgRVoAXPM AZQE/IDb8zmQ1X2CJTMr9jMAnTX1cAZsPLFcuEYGHslxjEG8H9e8b7hTi8lHjiwwkclG I57w== 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=dBXtOmAYgO3pxLcNtS7jXcY9ncw5+dgfRSfYtnPu1x4=; b=JxOve5/+DHcYR7iy35tJttUXJM8gjTXj3wZ9gjwUWkOoqpAWRx/V+1H8Twi+rneikZ OIXwv96HGzl61Rip0ZHsSfc2HeFhOjftfXl/0E0GEl+dzs4//YBje7yhGnYDZoR1twVt Pj90dej7hFbCxk36iEq0IF/+HRAAJzVhF9WZgVhR0i64tI7JqVXOMNz/9qP5azyof9A9 EhImmDFFMPKx0netWrLuh8jYWhzgkGH+rYJe9CBnVBnBwM8Hr2trwMkyN+ra2UDPJaw+ eN+QFYSRPhtl34JJfHvY+8pa5uhJMUxADGHJ5guHBHI5GE28cZCZiixJcweu42vr+vVh 3PDA== 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 u12-v6si17108268plz.563.2018.05.04.18.17.37; Fri, 04 May 2018 18:17:51 -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 S1752163AbeEEBQx (ORCPT + 99 others); Fri, 4 May 2018 21:16:53 -0400 Received: from mailout.easymail.ca ([64.68.200.34]:50547 "EHLO mailout.easymail.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751789AbeEEBQv (ORCPT ); Fri, 4 May 2018 21:16:51 -0400 Received: from localhost (localhost [127.0.0.1]) by mailout.easymail.ca (Postfix) with ESMTP id 1497521075; Sat, 5 May 2018 01:16:51 +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 XqAhlVB20KBZ; Sat, 5 May 2018 01:16:51 +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 2C07021020; Sat, 5 May 2018 01:16:44 +0000 (UTC) From: "Shuah Khan (Samsung OSG)" To: shuah@kernel.org, sumit.semwal@linaro.org Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 16/24] selftests: lib: return Kselftest Skip code for skipped tests Date: Fri, 4 May 2018 19:13:20 -0600 Message-Id: <20180505011328.32078-16-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 lib test(s) is skipped because of unmet dependencies and/or unsupported configuration, it returns non-zero value hich is treated as a fail by the Kselftest framework. This leads to false negative result even when the test could not be run. 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/lib/bitmap.sh | 8 ++++++-- tools/testing/selftests/lib/prime_numbers.sh | 7 +++++-- tools/testing/selftests/lib/printf.sh | 8 ++++++-- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/tools/testing/selftests/lib/bitmap.sh b/tools/testing/selftests/lib/bitmap.sh index 4dee4d2a8bbe..5a90006d1aea 100755 --- a/tools/testing/selftests/lib/bitmap.sh +++ b/tools/testing/selftests/lib/bitmap.sh @@ -1,9 +1,13 @@ #!/bin/sh # SPDX-License-Identifier: GPL-2.0 + +# Kselftest framework requirement - SKIP code is 4. +ksft_skip=4 + # Runs bitmap infrastructure tests using test_bitmap kernel module if ! /sbin/modprobe -q -n test_bitmap; then - echo "bitmap: [SKIP]" - exit 77 + echo "bitmap: module test_bitmap is not found [SKIP]" + exit $ksft_skip fi if /sbin/modprobe -q test_bitmap; then diff --git a/tools/testing/selftests/lib/prime_numbers.sh b/tools/testing/selftests/lib/prime_numbers.sh index b363994e5e11..76602d4b050f 100755 --- a/tools/testing/selftests/lib/prime_numbers.sh +++ b/tools/testing/selftests/lib/prime_numbers.sh @@ -2,9 +2,12 @@ # SPDX-License-Identifier: GPL-2.0 # Checks fast/slow prime_number generation for inconsistencies +# Kselftest framework requirement - SKIP code is 4. +ksft_skip=4 + if ! /sbin/modprobe -q -r prime_numbers; then - echo "prime_numbers: [SKIP]" - exit 77 + echo "prime_numbers: module prime_numbers is not found [SKIP]" + exit $ksft_skip fi if /sbin/modprobe -q prime_numbers selftest=65536; then diff --git a/tools/testing/selftests/lib/printf.sh b/tools/testing/selftests/lib/printf.sh index 0c37377fd7d4..45a23e2d64ad 100755 --- a/tools/testing/selftests/lib/printf.sh +++ b/tools/testing/selftests/lib/printf.sh @@ -1,9 +1,13 @@ #!/bin/sh # SPDX-License-Identifier: GPL-2.0 # Runs printf infrastructure using test_printf kernel module + +# Kselftest framework requirement - SKIP code is 4. +ksft_skip=4 + if ! /sbin/modprobe -q -n test_printf; then - echo "printf: [SKIP]" - exit 77 + echo "printf: module test_printf is not found [SKIP]" + exit $ksft_skip fi if /sbin/modprobe -q test_printf; then -- 2.14.1