Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp3890326pxv; Mon, 19 Jul 2021 11:13:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxdYUXznNX9oY6ZQ0LL7OIdTLiqOLGGm+ePAcFzCIEOcOgWR+ee2XeEmMEe/GMYsEJbjaW+ X-Received: by 2002:a05:6e02:68c:: with SMTP id o12mr18859289ils.261.1626718289971; Mon, 19 Jul 2021 11:11:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626718289; cv=none; d=google.com; s=arc-20160816; b=0nG8dR1xb/VPv6X9dtQ98vWiqLj9+tVZzcTyC4cMlhByuqTfgRWPtQ5+tFf8AXqqEV +vz7HfX/waglc+GbRDnQsgxs25JKrjNTmMmZa358DJX3xrwmzgulJdKgOgBv9FPDJtAu 74iF/QK7XJlxpDMuIy7XmhjT177yMJO5rG6rV73l5svrT8415vMVTWF4pzX5nNC28Y/c AlxHdxfqsxRsnKKzhiuEl+LFUv3cd7ncWS0hpGjbLhqQMRvE9W7cSxV5C95WeP0HnNlL +i+VA1AojsSCvvcj5BE6AyNqhjNGDcBsP1zwrXn7XOVNagZlvekO8pz04c6NPMmaNWKK dZdQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=VuAonr68fMdv7McVrkniFy/3Hij7c9m+jlQ3uit2YUs=; b=SL5HrjmHuK12zkXiGuPd7BxP1JJ4eG/ZC6gKIXd/DXDc8Iji3smRyRvE0ahhYNml3k 7iYbCxz8kKvPrO9p2maNBHr3KeSI6CVSjqHrOeB8s05iIaftbVa/yL/AF+RndznoV4J2 i3Bi8pN0wR3ypLMjxVomnWCzL8Wax6pQlaC3S/tVYRwFSdqB/NbDg28F4bMALJidpY32 81B/vf6ExToauQSDzp3T0Rei7IvY9H5g8d1UGxvj5JKJUBao3k4ViRPY4h7l3NkBhCEv ub4AH5XFCO51/ofmn292u987KEGjF3Iuh7FPPOvLyKzvHGCMa+Ll6m4mkrCZHUcG/FCj 7rtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fgtaHVzr; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t9si22436102jaj.20.2021.07.19.11.11.18; Mon, 19 Jul 2021 11:11:29 -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=@linuxfoundation.org header.s=korg header.b=fgtaHVzr; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380396AbhGSR2I (ORCPT + 99 others); Mon, 19 Jul 2021 13:28:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:45034 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347940AbhGSPni (ORCPT ); Mon, 19 Jul 2021 11:43:38 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 403DF613AE; Mon, 19 Jul 2021 16:22:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626711747; bh=cWHiH12FvTJFDthkEwrs//hjGIjPEoNDcrBkmfawt0I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fgtaHVzrvlyeoU0hofEaWLLofH6fhlTKTpg+YKLA9VHKj4AozEmICQajTaKCbSBm4 VmyghkYjM/DUat2kBlKuf81aoXkaS7hXU0hf9pVXlYSgcjteLNnETkpFO7P0yDMubh N04jvITF8u9dls+QfJK7JncVABzQYqZbDmepsS4U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Po-Hsu Lin , Shuah Khan , Sasha Levin Subject: [PATCH 5.12 084/292] selftests: timers: rtcpie: skip test if default RTC device does not exist Date: Mon, 19 Jul 2021 16:52:26 +0200 Message-Id: <20210719144945.278415099@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210719144942.514164272@linuxfoundation.org> References: <20210719144942.514164272@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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