Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp1151633pxv; Fri, 9 Jul 2021 19:40:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJybtRZOJO1Gvz/8Gswf90Rbs8IcCIO2kipE/mbAJhuficCf1n4FtY7pVwH1ZqMeV/x3MXq7 X-Received: by 2002:a05:6402:7cc:: with SMTP id u12mr29281781edy.156.1625884820146; Fri, 09 Jul 2021 19:40:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625884820; cv=none; d=google.com; s=arc-20160816; b=P2UxZoy4w7MzOjfHXKcaUUeIMttm+nKDrcBPHoNM4QFOuvVebDxI1g36IIFg+74wlM MxCune5NzuifN2fEoH+Fo83uo9qf/QwtOakKuFpKjxJeWXmtVnLLF2sXbTEV0OLe4Set vhLFGekNUc5sOZOBEmCvmvORmIyR4C0GSYlBPb+FTg6rhQR9Rr3kCq9DPahha2uG/bPC sPipJ8f3a1vCCpR+L3pInhmfCVvtKS9sACXVs37I8iMhzmJaaeSpdEdFJEF7GJL3496h OIuZwj6RVPHdZ0/JdRghhcXSHN4YHA+dHST1/qyxSTOz07BMYOTxfMfTjbJ/SUB0Fqzd 1QWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=VuAonr68fMdv7McVrkniFy/3Hij7c9m+jlQ3uit2YUs=; b=z0JBwCjBRi1zNayJAwo0CgTo/Lm4JqOA0tRifEy0U2YgtwnVqgyyPYN6NIgF9frnVr 630U3+yMCSkrhvhmKfbwPWRw5KJqS/mkhPrDpqvndEv5/nK2D3GWAaKOZjj9/IIoyEcl qvFtoCy27igZ7frOEPT9PipOccHOicTCofvdX180Bb18ppsuKRIya3dtIFacCdMhx0nA fMc+x8uNoKQG/Jz8y4+n9KzWEymo9nkL9c2PTZI2WJZrjSxdo4C4qKxfIM3d7BeAb7Jr O9qUrJmDqqU7KY8S1LoQPYtMd8gSMr5d54UPmcIilxaqciTrmkDiMvdzSYi/bq+55fk4 Xx+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="A7NuQI/q"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x21si8770903eds.521.2021.07.09.19.39.56; Fri, 09 Jul 2021 19:40:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="A7NuQI/q"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234700AbhGJCjN (ORCPT + 99 others); Fri, 9 Jul 2021 22:39:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:53520 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234005AbhGJCf3 (ORCPT ); Fri, 9 Jul 2021 22:35:29 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E44AF61402; Sat, 10 Jul 2021 02:32:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1625884348; bh=cWHiH12FvTJFDthkEwrs//hjGIjPEoNDcrBkmfawt0I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A7NuQI/q4eYygFd5b+fkETJuL6NJp3Jv6Xolg1kgV/u/woJg+4AJbepf45QjeqLqr BjxjH4HgY4iGBU6F203c4t7EnKuZVsG1rYP5rwLL3+CwRXsoaTJdkxjdd2Gxm6tcsa +TMQlboXGzEOztuEGB6wyyYgrQn6GuEFH55MRSuNeRimXT8Rmw0Opp1SqZx1Jga0Ma PGlNjfjymiY1iY339Ur/0DkNqP9am3j39JYsQN2NBydfPOQBXWOAN3CpJ4GEgY57cS B0YDPkWpRwHEDBp0aQ08k09MH4oaPcKk/GfHYdlAsz9rchAxlbTi274KKnEE8vU9dG DOjjGAwwSk50A== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Po-Hsu Lin , Shuah Khan , Sasha Levin , linux-kselftest@vger.kernel.org Subject: [PATCH AUTOSEL 4.19 19/39] selftests: timers: rtcpie: skip test if default RTC device does not exist Date: Fri, 9 Jul 2021 22:31:44 -0400 Message-Id: <20210710023204.3171428-19-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210710023204.3171428-1-sashal@kernel.org> References: <20210710023204.3171428-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Po-Hsu Lin [ Upstream commit 0d3e5a057992bdc66e4dca2ca50b77fa4a7bd90e ] This test will require /dev/rtc0, the default RTC device, or one specified by user to run. Since this default RTC is not guaranteed to exist on all of the devices, so check its existence first, otherwise skip this test with the kselftest skip code 4. Without this patch this test will fail like this on a s390x zVM: $ selftests: timers: rtcpie $ /dev/rtc0: No such file or directory not ok 1 selftests: timers: rtcpie # exit=22 With this patch: $ selftests: timers: rtcpie $ Default RTC /dev/rtc0 does not exist. Test Skipped! not ok 9 selftests: timers: rtcpie # SKIP Fixed up change log so "With this patch" text doesn't get dropped. Shuah Khan Signed-off-by: Po-Hsu Lin Signed-off-by: Shuah Khan Signed-off-by: Sasha Levin --- tools/testing/selftests/timers/rtcpie.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/timers/rtcpie.c b/tools/testing/selftests/timers/rtcpie.c index 47b5bad1b393..4ef2184f1558 100644 --- a/tools/testing/selftests/timers/rtcpie.c +++ b/tools/testing/selftests/timers/rtcpie.c @@ -18,6 +18,8 @@ #include #include +#include "../kselftest.h" + /* * This expects the new RTC class driver framework, working with * clocks that will often not be clones of what the PC-AT had. @@ -35,8 +37,14 @@ int main(int argc, char **argv) switch (argc) { case 2: rtc = argv[1]; - /* FALLTHROUGH */ + break; case 1: + fd = open(default_rtc, O_RDONLY); + if (fd == -1) { + printf("Default RTC %s does not exist. Test Skipped!\n", default_rtc); + exit(KSFT_SKIP); + } + close(fd); break; default: fprintf(stderr, "usage: rtctest [rtcdev] [d]\n"); -- 2.30.2