Received: by 10.192.165.148 with SMTP id m20csp680913imm; Fri, 4 May 2018 18:14:45 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoTRu6NFmwvH75nzXnyJErZNF0XpwrYruZwo1snohuMxfy/GKCGb8zMxCAzw9NUapgTg5ya X-Received: by 2002:a17:902:b78a:: with SMTP id e10-v6mr13836309pls.260.1525482885856; Fri, 04 May 2018 18:14:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525482885; cv=none; d=google.com; s=arc-20160816; b=ul0Cqk/afJa7fOznkQPgR/49gnk5Znu+FVAKIvfxgHQKbXxNbC9Kph4pcA4Biuqr/m 561QeQDwXVTgGqo3jUdsRKUXh17UASBBT5zc3m2HsRPwB+ZflAql1RQEAL7CE3GMOyLm wbUwUdMMvh6VQLj8wNnMlNYmiBuclD/JucKNmWQUJL6xOlh5fZTijSX0MrAdnTQDS9qt F8HPOcprUeXKY6g6d15MnhH1/TZg5fcgyVT9jPymjuf2uOvaSzUmUG0+43i9IXqgt+0q pNpE9Gg+R9KUTt0uXDvxS2447J6VRrqt9XZp8KcUO4jrxr6wsscf9ytkWTHdqQbiEpnK Hx9w== 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=/t2tmPh1BldkUUk+5nen586DGUrUbmaVdG7hkYcc7lA=; b=qz9MZ8iMm/e506Ur1mwhubDnm+yxCnvM6oW4hF9YUROgmO4wGr+F0BBXk+2SRDf7+B qB0R/QsvqwqVUK5CexZSMiA/MfoTf4LVD1ZGDSb5ABMSzlagZb/aL0BlreR0edHQXZQ6 xhE6rZbTocx6MVyw3nLH1SCNecerbbgHzxbyxiK/CLaGGZG+zoeoeXcQGY+pHAtLMqJe WymeufuCsBuMy2E7TiW5LA2rW4ACCZGF1fHSVcOaUFVG5QnuHOnV1VcKnW7OB8M8JIJw AGUhPZhS0lH38xQfkNeaS5qG2UJKGgUfst+LS359r+IcjXwWySmsEQzEQObSOPl1PJ5L KSeQ== 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 7si1335524pff.154.2018.05.04.18.14.31; Fri, 04 May 2018 18:14:45 -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 S1751906AbeEEBOI (ORCPT + 99 others); Fri, 4 May 2018 21:14:08 -0400 Received: from mailout.easymail.ca ([64.68.200.34]:50335 "EHLO mailout.easymail.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751771AbeEEBOH (ORCPT ); Fri, 4 May 2018 21:14:07 -0400 Received: from localhost (localhost [127.0.0.1]) by mailout.easymail.ca (Postfix) with ESMTP id 62F9921235; Sat, 5 May 2018 01:14:06 +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 UAiW8XwrNcR6; Sat, 5 May 2018 01:14:06 +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 90B4021221; Sat, 5 May 2018 01:13:57 +0000 (UTC) From: "Shuah Khan (Samsung OSG)" To: shuah@kernel.org, paul.elder@pitt.edu, gregkh@linuxfoundation.org, alice.ferrazzi@gmail.com Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 02/24] selftests: breakpoints: return Kselftest Skip code for skipped tests Date: Fri, 4 May 2018 19:13:06 -0600 Message-Id: <20180505011328.32078-2-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 step_after_suspend_test is skipped because of unmet dependencies and/or unsupported configuration, it exits with error 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. Change it to use ksft_exit_skip() when a non-root user runs the test and add an explicit check for root and a clear message, instead of failing the test when /sys/power/state file open fails. Signed-off-by: Shuah Khan (Samsung OSG) --- tools/testing/selftests/breakpoints/step_after_suspend_test.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/breakpoints/step_after_suspend_test.c b/tools/testing/selftests/breakpoints/step_after_suspend_test.c index 3fece06e9f64..f82dcc1f8841 100644 --- a/tools/testing/selftests/breakpoints/step_after_suspend_test.c +++ b/tools/testing/selftests/breakpoints/step_after_suspend_test.c @@ -143,10 +143,14 @@ void suspend(void) int err; struct itimerspec spec = {}; + if (getuid() != 0) + ksft_exit_skip("Please run the test as root - Exiting.\n"); + power_state_fd = open("/sys/power/state", O_RDWR); if (power_state_fd < 0) ksft_exit_fail_msg( - "open(\"/sys/power/state\") failed (is this test running as root?)\n"); + "open(\"/sys/power/state\") failed %s)\n", + strerror(errno)); timerfd = timerfd_create(CLOCK_BOOTTIME_ALARM, 0); if (timerfd < 0) -- 2.14.1