From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4F596C7EE37 for ; Tue, 6 Jun 2023 21:50:27 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id C558A4035D; Tue, 6 Jun 2023 21:50:26 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org C558A4035D Authentication-Results: smtp2.osuosl.org; dkim=fail reason="signature verification failed" (2048-bit key, unprotected) header.d=bootlin.com header.i=@bootlin.com header.a=rsa-sha256 header.s=gm1 header.b=RBuYr2TW X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id EgQAOwKHRGI7; Tue, 6 Jun 2023 21:50:26 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp2.osuosl.org (Postfix) with ESMTPS id 9E46D40128; Tue, 6 Jun 2023 21:50:25 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 9E46D40128 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 7802AC0037; Tue, 6 Jun 2023 21:50:25 +0000 (UTC) Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 41E85C0029 for ; Tue, 6 Jun 2023 21:50:24 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 0950B4021C for ; Tue, 6 Jun 2023 21:50:24 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 0950B4021C X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id g5Ws4D2kw-eT for ; Tue, 6 Jun 2023 21:50:23 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org AC80940128 Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) by smtp2.osuosl.org (Postfix) with ESMTPS id AC80940128 for ; Tue, 6 Jun 2023 21:50:22 +0000 (UTC) X-GND-Sasl: alexandre.belloni@bootlin.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1686088219; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=qYEgav/BD3CFx1ZICW9gZIetsYEJxGUzHc1OT2/n5lo=; b=RBuYr2TWpgtfK1if5UI3v+riqm0DR/ZUG27oxhac7iQJ0/c1VYJXdhddxi0mw2nNjDj0fj aRZqr+1qy+FGP552zBiOTWE8dpTyU0XthKBbHHX6IDzpko2PNcu1dtpiBs9d5DaRMP4Cxt NduqrnEXYAvj16DD1UruQfJ9Ancx1yv3xcVbqCyzUIM1kAKlKXCQkyRYpp5gHqGbhbDGfJ m86BLIiL1f4vCK+mCQJIg989gx8LDoA997Jk56Ny30NFm/2ZxyojNMsx5lJsooaRODxLel YC5C+fxUk+0nNwkFKQ4dgmRJPwuRrtqIvbQMauQOT/OND9AIGyJ4t7Crfdk/iw== X-GND-Sasl: alexandre.belloni@bootlin.com X-GND-Sasl: alexandre.belloni@bootlin.com X-GND-Sasl: alexandre.belloni@bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id 806291BF20C; Tue, 6 Jun 2023 21:50:19 +0000 (UTC) Date: Tue, 6 Jun 2023 23:50:19 +0200 To: Atul Kumar Pant Subject: Re: [PATCH v2] selftests: rtc: Improves rtctest error handling. Message-ID: <20230606215019b362e348@mail.local> References: <20230429064917.97153-1-atulpant.linux@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230429064917.97153-1-atulpant.linux@gmail.com> Cc: a.zummo@towertech.it, shuah@kernel.org, linux-kernel-mentees@lists.linuxfoundation.org X-BeenThere: linux-kernel-mentees@lists.linuxfoundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Alexandre Belloni via Linux-kernel-mentees Reply-To: Alexandre Belloni Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-kernel-mentees-bounces@lists.linuxfoundation.org Sender: "Linux-kernel-mentees" On 29/04/2023 12:19:17+0530, Atul Kumar Pant wrote: > When running the rtctest if we pass wrong rtc device file as an argument > the test fails expectedly, but prints the logs that are not useful > to point out the issue. > To handle this, the patch adds a checks to verify if the rtc_file is valid. > > Signed-off-by: Atul Kumar Pant > --- > > changes since v1: > Removed check for uid=0 > If rtc file is invalid, then exit the test. > > tools/testing/selftests/rtc/rtctest.c | 11 ++++++++++- > 1 file changed, 10 insertions(+), 1 deletion(-) > > diff --git a/tools/testing/selftests/rtc/rtctest.c b/tools/testing/selftests/rtc/rtctest.c > index 2b9d929a24ed..07f7dcd47102 100644 > --- a/tools/testing/selftests/rtc/rtctest.c > +++ b/tools/testing/selftests/rtc/rtctest.c > @@ -17,6 +17,7 @@ > #include > > #include "../kselftest_harness.h" > +#include "../kselftest.h" > > #define NUM_UIE 3 > #define ALARM_DELTA 3 > @@ -388,6 +389,8 @@ __constructor_order_last(void) > > int main(int argc, char **argv) > { > + int ret = -1; > + > switch (argc) { > case 2: > rtc_file = argv[1]; > @@ -399,5 +402,11 @@ int main(int argc, char **argv) > return 1; > } > > - return test_harness_run(argc, argv); > + // Run the test if rtc_file is valid if access to rtc_file is valid > + if (access(rtc_file, F_OK) == 0) > + ret = test_harness_run(argc, argv); > + else > + ksft_exit_fail_msg("[ERROR]: %s : File does not exists - Exiting\n", rtc_file); It doesn't necessarily means the file does not exist but that you don't have access to it. > + > + return ret; > } > -- > 2.25.1 > -- Alexandre Belloni, co-owner and COO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com _______________________________________________ Linux-kernel-mentees mailing list Linux-kernel-mentees@lists.linuxfoundation.org https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees