Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp1144939pxv; Fri, 9 Jul 2021 19:26:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxr3CAILX4Gsk0Wm/SiPjj/19LYwIbxKs0bxWlfDDh9/sN980IBMikye66gx9bYINobqqkn X-Received: by 2002:a17:907:160c:: with SMTP id hb12mr40694614ejc.135.1625883982020; Fri, 09 Jul 2021 19:26:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625883982; cv=none; d=google.com; s=arc-20160816; b=o+jQENy1a4cdlc9GHP3ooqxdFGYFQRepIjk6yn99UfSkR1LtmDTi5fc/O95LHcnw/+ QbXM4KBpEnPIiW+A9u+OKrXawmZrgTyH1PGfbVuVk0XhCHYa4foh65sm+XpSL8qkRHWO 46vqY7cBqGCZSvAA4z9c2DS71I0xm8X3FLZ6Wt1BEqbEiqvTyfdawn86XLrzuCHRNC5k o0oGW+NLrOkK85rt918zV4og8OeDuueXoaqtK7iHZpnOf7okjvBFW0mhjNGNlMpkCSce i51rsKn1Lw0TRykx/GCEejjV91giBL5Yk+h7llwW1VK0rCKr2svO4/PpyCuXCYehMrE9 95iQ== 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=M8bJ2S8Bhz6lOvoYU99YLp9VFosMnx1DNtbV6hNB6nJ1QGNhN4oFLchYQcyvCjTSOK Xh4cM+u4FCR8XK8QLEfFQw7RzUPBxrS8ca3CunPafzzHxmOdJ0lK0DLOcShkdZZiuLAa YxeqHIh1GadSM3CzUZxFG7pGfMk/cBzIB0CiO+d23rOOhvuR0FLWU/wBtIfnMF7btudQ P7IJTzgy4qxl1m9Gbw5478FblLaR83s5ri9eHaKEiC5Pl43hy4nTLu1Jq/mKPu8/iW/O +NogVdn6LNqjhvHeW2tnSh9iEQqyyOI0HjJdFONVcoab2bkUYE5TvG8gwr42JGiKo/kk y/VA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=kGMNjVRO; 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 ho14si8736108ejc.252.2021.07.09.19.25.59; Fri, 09 Jul 2021 19:26:22 -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=kGMNjVRO; 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 S233322AbhGJC06 (ORCPT + 99 others); Fri, 9 Jul 2021 22:26:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:42574 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233366AbhGJCZx (ORCPT ); Fri, 9 Jul 2021 22:25:53 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 88244613B7; Sat, 10 Jul 2021 02:23:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1625883789; bh=cWHiH12FvTJFDthkEwrs//hjGIjPEoNDcrBkmfawt0I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kGMNjVRO3y+M7kP0SWRzQoEs+y+kRAxbFV/aUS2JHFEAz+a1E/YRXqYPhh8nozYc0 XNAabVR5IEZStM9eYZpi1PO1biBebnJ255veb5CjldT7fcghRM7oHiQ9uqdEOCIbOp 4ts/1pg0mIZ11cCnv6ZYHcPHY/7EYARxbwpCgOjp/TDWtcXRCRibVw/yyETRDRgCtz IblCk9nscY6E0F5hpzCh2ZmswjR6lFzH23GGZyFicMAIgO73cBYQiD3bM6MgHroyyc kXaoRIqmWP5YL98fcaD37xPGkttzyAfFvf0eRrnH3N9yWERxMLMYX6z8jOJ8z+o4Km TrAKSWDFwYiHA== 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 5.12 055/104] selftests: timers: rtcpie: skip test if default RTC device does not exist Date: Fri, 9 Jul 2021 22:21:07 -0400 Message-Id: <20210710022156.3168825-55-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210710022156.3168825-1-sashal@kernel.org> References: <20210710022156.3168825-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