From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from server28.superhosting.bg (server28.superhosting.bg [217.174.156.11]) by sourceware.org (Postfix) with ESMTPS id 94D42383A326 for ; Sun, 22 May 2022 21:02:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 94D42383A326 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=dinux.eu Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=dinux.eu DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=dinux.eu; s=default; h=In-Reply-To:Content-Transfer-Encoding:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=7UduM45Fxqbf1ad9vdD8jHKpm7u+CpZ/muMqI5O2beE=; b=xvA9aMuni9zmkoxHXf6NaN1zJs I8y2cfJYsOi16xQj+2rRbUcMAHHeFT/u2PX20IFdsaukw9ly9w+pQosLp+ZXLO3NmzEGgwp5jWXaI 2OwnooO/KB7pSwDXbh3Qvxrzd/VTWnspaO4t1VWH8tybM7N7oQAiMF0cNbYHJfjb2xdYRbEOFyptc J62aTHWPO090E00frQGmso4Y0bZ0RfBcmCPsS/M8LfhLJzp4pzRhwdyOrXLIkWmz8bB5HhGRvZxQP 0LPX68oyqebKLRIfc0YdVYmdVJyp+oxJyh5cVbyIM6ZjE/liqnqo1h4HUP4qk3YyZyFMbtFftqMFM mqARqeiw==; Received: from [95.87.234.74] (port=33526 helo=localhost) by server28.superhosting.bg with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1nssiU-0007iA-AE; Mon, 23 May 2022 00:02:24 +0300 Date: Mon, 23 May 2022 00:02:21 +0300 From: Dimitar Dimitrov To: jdoubleu Cc: newlib@sourceware.org Subject: Re: [PATCH v2] update tzset tests Message-ID: References: <9603e3aa-bd7d-6740-c710-27ace1d80397@SystematicSw.ab.ca> <25cfc7a2-2c66-f9fe-581b-8d3cec5d3bd9@jdoubleu.de> <426d1e93-6c4f-4ccc-9522-c187e10716f0@jdoubleu.de> <985b1a40-9c3a-9f7a-273d-86b59bc90265@jdoubleu.de> <8735h6muee.fsf@keithp.com> <1060b8f4-b592-d883-acfe-b5d5193ee825@jdoubleu.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-OutGoing-Spam-Status: No, score=-2.9 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - server28.superhosting.bg X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - dinux.eu X-Get-Message-Sender-Via: server28.superhosting.bg: authenticated_id: dimitar@dinux.eu X-Authenticated-Sender: server28.superhosting.bg: dimitar@dinux.eu X-Source: X-Source-Args: X-Source-Dir: X-Spam-Status: No, score=-10.1 required=5.0 tests=BAYES_00, BODY_8BITS, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: newlib@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Newlib mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 May 2022 21:02:30 -0000 On Sun, May 22, 2022 at 11:51:45AM +0200, jdoubleu wrote: > Dimitar Dimitrov writes: > > Only the following test case fails in tzset.c: > > jdoubleu writes: > > I'm going fix my patch. Thanks for running the tests! > > I've fixed that one test case. I wasn't able to run it myself, yet. Hi, The entire tzset test case passes for pru-unknown-elf: PASS: newlib.time/tzset.c execution Thanks, Dimitar > > > BTW, it took me a while to realize that your patch and the source code in > > newlib's GIT have different line endings > > The patch is now formated with CLRF line endings. I checked tzset_r.c and it > also uses CLRF. But maybe I checked it out the wrong way? I see only LF symbols in your patch, not CRLF. Perhaps it's something with my email client. > > > Cheers > --- > 🙎🏻‍♂️ jdoubleu > From 90f857d6a4ec999074f892fb0641a2d785c09de5 Mon Sep 17 00:00:00 2001 > From: jdoubleu > Date: Sat, 14 May 2022 15:41:22 +0200 > Subject: [PATCH] update tzset tests > > Add test cases for parser errors after reworked parsing behavior. > --- > newlib/testsuite/newlib.time/tzset.c | 58 +++++++++++++++++++++------- > 1 file changed, 45 insertions(+), 13 deletions(-) > > diff --git a/newlib/testsuite/newlib.time/tzset.c b/newlib/testsuite/newlib.time/tzset.c > index 0e5b196c6..19a33be73 100644 > --- a/newlib/testsuite/newlib.time/tzset.c > +++ b/newlib/testsuite/newlib.time/tzset.c > @@ -93,7 +93,6 @@ struct tz_test test_timezones[] = { > {"3:152:30:15", IN_SECONDS(3, 15, 0), IN_SECONDS(2, 30, 15)}, > {"3:152:30:15", IN_SECONDS(3, 15, 0), IN_SECONDS(2, 30, 15)}, // requires TZNAME_MAX >= 8 + 1 > {"<+H6M20S12>6:20:12<-H4M40S14>-4:40:14", IN_SECONDS(6, 20, 12), -IN_SECONDS(4, 40, 14)}, // requires TZNAME_MAX >= 9 + 1 > - {"<+0123456789ABCDEF>3:33:33", IN_SECONDS(3, 33, 33), NO_TIME}, // truncates the name (17 + 1) > > /* > * real-world test vectors. > @@ -111,13 +110,44 @@ struct tz_test test_timezones[] = { > { /* Asia/Colombo */ "<+0530>-5:30", -IN_SECONDS(5, 30, 0), NO_TIME}, > { /* Europe/Berlin */ "CET-1CEST,M3.5.0,M10.5.0/3", -IN_SECONDS(1, 0, 0), -IN_SECONDS(2, 0, 0)}, > > - // END of list > - {NULL, NO_TIME, NO_TIME} > + /// test parsing errors > + // 1. names are too long > + {"<+0123456789ABCDEF>3:33:33", 0, NO_TIME}, > + {"JUSTEXCEEDI1:11:11", 0, NO_TIME}, > + {"AVERYLONGNAMEWHICHEXCEEDSTZNAMEMAX2:22:22", 0, NO_TIME}, > + {"FIRSTVERYLONGNAME3:33:33SECONDVERYLONGNAME4:44:44", 0, 0}, > + {"5:55:55", 0, NO_TIME}, > + {"3:33:334:44:44", 0, 0}, > + {"<+JUSTEXCEED>5:55:55", 0, NO_TIME}, > + > + // 2. names are too short > + {"JU6:34:47", 0, NO_TIME}, > + {"HE6:34:47LO3:34:47", 0, 0}, > + {"2:34:47", 0, NO_TIME}, > + {"2:34:473:34:47", 0, 0}, > + > + // 3. names contain invalid chars > + {"N?ME2:10:56", 0, NO_TIME}, > + {"N!ME2:10:56", 0, NO_TIME}, > + {"N/ME2:10:56", 0, NO_TIME}, > + {"N$ME2:10:56", 0, NO_TIME}, > + {"NAME?2:10:56", 0, NO_TIME}, > + {"?NAME2:10:56", 0, NO_TIME}, > + {"NAME?UNK4:21:15", 0, NO_TIME}, > + {"NAME!UNK4:22:15NEXT/NAME4:23:15", 0, NO_TIME}, > + > + // 4. bogus strings > + {"NOINFO", 0, NO_TIME}, > + {"HOUR:16:18", 0, NO_TIME}, > + {" + {" + {">WRONG<2:15:00", 0, NO_TIME}, > + {"ST + //{"MANY8:00:00:00", 0, NO_TIME}, > + {"\0", 0, NO_TIME}, > + {"M\0STR7:30:36", 0, NO_TIME} > }; > > -// helper macros > -#define FOR_TIMEZONES(iter_name) for (struct tz_test* iter_name = test_timezones; iter_name->tzstr != NULL; ++iter_name) > - > // END test vectors > > static int failed = 0; > @@ -136,22 +166,24 @@ void test_TimezoneStrings(void) > { > char buffer[128]; > > - FOR_TIMEZONES(ptr) > + for (int i = 0; i < (sizeof(test_timezones) / sizeof(struct tz_test)); ++i) > { > - setenv("TZ", ptr->tzstr, 1); > + struct tz_test ptr = test_timezones[i]; > + > + setenv("TZ", ptr.tzstr, 1); > tzset(); > > - snprintf(buffer, 128, "winter time, timezone = \"%s\"", ptr->tzstr); > + snprintf(buffer, 128, "winter time, timezone = \"%s\"", ptr.tzstr); > > struct tm winter_tm_copy = winter_tm; // copy > - TEST_ASSERT_EQUAL_INT_MESSAGE(winter_time + ptr->offset_seconds, mktime(&winter_tm_copy), buffer); > + TEST_ASSERT_EQUAL_INT_MESSAGE(winter_time + ptr.offset_seconds, mktime(&winter_tm_copy), buffer); > > - if (ptr->dst_offset_seconds != NO_TIME) > + if (ptr.dst_offset_seconds != NO_TIME) > { > - snprintf(buffer, 128, "summer time, timezone = \"%s\"", ptr->tzstr); > + snprintf(buffer, 128, "summer time, timezone = \"%s\"", ptr.tzstr); > > struct tm summer_tm_copy = summer_tm; // copy > - TEST_ASSERT_EQUAL_INT_MESSAGE(summer_time + ptr->dst_offset_seconds, mktime(&summer_tm_copy), buffer); > + TEST_ASSERT_EQUAL_INT_MESSAGE(summer_time + ptr.dst_offset_seconds, mktime(&summer_tm_copy), buffer); > } > } > } > -- > 2.35.1 >