Received: by 10.192.165.148 with SMTP id m20csp684968imm; Fri, 4 May 2018 18:21:14 -0700 (PDT) X-Google-Smtp-Source: AB8JxZq9i2U/5dnleemz+GcSAtctwNiP5mOekozGGFPFczo5qtugjiCZ120s1aijm3/Unuk4PWZr X-Received: by 10.98.0.194 with SMTP id 185mr28927109pfa.238.1525483274496; Fri, 04 May 2018 18:21:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525483274; cv=none; d=google.com; s=arc-20160816; b=UTofSVQJ0mFs7yAsppoXPkc/rgZHG3jcECSa5CpcAgNqj3/7U9Mf4yx33M+2heY5Ik XH9Rru3Sn0Y+F+PodOiwESOuAL4mrmCPONFZ3dVjuG7EJyMIyDKAgDksciWIAguyYMjG 1VlcHA7srvGAqa/w0SHvVHFAtTQEwx4rV0dZTn3UX/EAMav/fvu1QZKbYPxYc8ueQcYi 5/3ZLhtKTYFwvCdvlZ6aPE3WOWLsHT7Fg8YATNGOieh/l64jD1Ckn/p4BssqgpSe/lPN wejab5nMLLHsPK2XaHy2vgw/CGSTlH/KCOHzwsnW7Z6tyaNEq6kK0BU1kRjqawbGqvhs LSZA== 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=wOLPtvVfLZkYi91k96BoiBwQ3GY0f7kYWgFb2AI1M2U=; b=xoqFN9M7fV3trFe1U4jslieWaSV/+WG0mC2+gbHoF5UaYisNql/XNf9D8PBkjjLbMO alftd8twYa0jHDs217z00X/7oW7wwRYdYPuaw4jXPzSbYxBcJlAjfjKFHXXQxInrC/tJ oI2JFdKpZhQnfHXAipwFJZjgVxwJbgo9b7RpJgG3mi3gH9HyiKxQMhzmy1EWfq3wz2om WHzvKDJpiAiGB+9sbbpgUAOLZM2NgXHEr7gigyotf+AyVTZEeHrOmuLzSWKblHzQPjbr UgWjQ+uE8AVUEvUbm9tHwUZy2zHIaRjtCmRzA9vDFtOgTLhzYM2o1Kl9aeX+3o6pgaak TdyA== 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 u14si3622627pfa.84.2018.05.04.18.21.00; Fri, 04 May 2018 18:21:14 -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 S1752282AbeEEBR7 (ORCPT + 99 others); Fri, 4 May 2018 21:17:59 -0400 Received: from mailout.easymail.ca ([64.68.200.34]:50641 "EHLO mailout.easymail.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752272AbeEEBRy (ORCPT ); Fri, 4 May 2018 21:17:54 -0400 Received: from localhost (localhost [127.0.0.1]) by mailout.easymail.ca (Postfix) with ESMTP id 01A6121075; Sat, 5 May 2018 01:17:54 +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 16qWIvsHLM7S; Sat, 5 May 2018 01:17:53 +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 6C7EA20E18; Sat, 5 May 2018 01:17:43 +0000 (UTC) From: "Shuah Khan (Samsung OSG)" To: shuah@kernel.org, akpm@linux-foundation.org, mike.kravetz@oracle.com, marcandre.lureau@redhat.com, lizhijian@cn.fujitsu.com Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 21/24] selftests: memfd: return Kselftest Skip code for skipped tests Date: Fri, 4 May 2018 19:13:25 -0600 Message-Id: <20180505011328.32078-21-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 memfd test is skipped because of unmet dependencies and/or unsupported configuration, it returns non-zero value which 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. Added an explicit check for root user and return skip code. 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/memfd/run_tests.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/memfd/run_tests.sh b/tools/testing/selftests/memfd/run_tests.sh index c2d41ed81b24..88dc206a69b7 100755 --- a/tools/testing/selftests/memfd/run_tests.sh +++ b/tools/testing/selftests/memfd/run_tests.sh @@ -1,6 +1,14 @@ #!/bin/bash # please run as root +# Kselftest framework requirement - SKIP code is 4. +ksft_skip=4 + +if [ $UID != 0 ]; then + echo "Please run this test as root" + exit $ksft_skip +fi + # # Normal tests requiring no special resources # @@ -33,7 +41,7 @@ if [ -n "$freepgs" ] && [ $freepgs -lt $hpages_test ]; then echo $(( $hpages_needed + $nr_hugepgs )) > /proc/sys/vm/nr_hugepages if [ $? -ne 0 ]; then echo "Please run this test as root" - exit 1 + exit $ksft_skip fi while read name size unit; do if [ "$name" = "HugePages_Free:" ]; then -- 2.14.1