From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 00E793834E45 for ; Fri, 27 May 2022 15:47:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 00E793834E45 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1653666427; 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=dOGf48DUCln2hlB7+VU8sxBatdvb7rrNJdeyPP2rl/g=; b=PO9ruHw2U6iWxjbYn2hmybeb/tKpW7d/D8POjUQa8m0qH7XcA0eB2BA3zp4aTaLgGxA8z/ jhFn/9pN6hUDqAssEqlH05JheAv/2HrYAtzYuUiIPoZFhF8MPlSvxfI2WLXh3w5iiS5Ky4 TnTOuxDL7vNLQzHBvHg2+dNe661xRcc= Received: from mail-yb1-f197.google.com (mail-yb1-f197.google.com [209.85.219.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-82--qbd3CNUOE-8Jg8pSXPulQ-1; Fri, 27 May 2022 11:46:41 -0400 X-MC-Unique: -qbd3CNUOE-8Jg8pSXPulQ-1 Received: by mail-yb1-f197.google.com with SMTP id e11-20020a25d30b000000b0064f6bcc95e4so4494308ybf.8 for ; Fri, 27 May 2022 08:46:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=dOGf48DUCln2hlB7+VU8sxBatdvb7rrNJdeyPP2rl/g=; b=51OtrMC0n1W/0vulms6VEysW1ZXZsw6Mb/iyOezd1mmwnwHAnPeZhAps+aK2cJ/wRL 1OiwZVB57aK5/AKrBgP0AMJkRWxaaLGiSgYNwEF/ViLAoZb+xMsFicNt/f3sdgDyKSL3 Qj4xI2sKULRRmPgqvDYXMNWW7Nrd5400LgHzKWSLR/naLPJPtcLGrM6/a4oasinu6D0e eK66qy77MW59PBF2kiAoCIwKJiyFpspiUngavQjUuQ06R9NtPzpG399vY2dem/UWbogM E4uUzaJwrbvAPkbbV05cSXEZl5JrFNQn53iE6vcbIBSCdJo0+giDMzSP1X7aE9p2EQ2D zRJQ== X-Gm-Message-State: AOAM530ZIrvOOO58HMzJURRQGVkDiIfv9vQ7+XSG0tfKv53ej55ygnnv FHXeYAyM8J15oC4qDIvEsSWLpKJZPeun9zSnjTm7hd4GmE7shhfy998MJV2OucLzctjLDWlZei6 G7ZMOzOqwTgRLpMATD5KwkXUqcDYUklc= X-Received: by 2002:a0d:f084:0:b0:300:c26:4c10 with SMTP id z126-20020a0df084000000b003000c264c10mr23812178ywe.263.1653666401220; Fri, 27 May 2022 08:46:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx5B7Yx8hQ6J9erOT96TiwW7jA98QVsao3cMtQ0loaq0VJjHzqVHcvzKVP7K7Lzkrf4WXIXrW7cvfg3H6OpuG0= X-Received: by 2002:a0d:f084:0:b0:300:c26:4c10 with SMTP id z126-20020a0df084000000b003000c264c10mr23812157ywe.263.1653666400991; Fri, 27 May 2022 08:46:40 -0700 (PDT) MIME-Version: 1.0 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> In-Reply-To: From: Jeff Johnston Date: Fri, 27 May 2022 11:46:30 -0400 Message-ID: Subject: Re: [PATCH v2] update tzset tests To: Dimitar Dimitrov Cc: jdoubleu , Newlib Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jjohnstn@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00, BODY_8BITS, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, HTML_MESSAGE, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 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: Fri, 27 May 2022 15:47:10 -0000 Thanks to both of you for the patch and testing. I had to do some manual cut/paste as the patch wouldn't apply but I have merged the test patch plus my changes for tzset. If I have messed anything up, please reply to the list. Regards, -- Jeff J. On Sun, May 22, 2022 at 5:02 PM Dimitar Dimitrov wrote: > 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 cod= e > 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 wit= h > my > email client. > > > > > > Cheers > > --- > > =F0=9F=99=8E=F0=9F=8F=BB=E2=80=8D=E2=99=82=EF=B8=8F 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[] =3D { > > {"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 >=3D 8 + 1 > > {"<+H6M20S12>6:20:12<-H4M40S14>-4:40:14", IN_SECONDS(6, 20, > 12), -IN_SECONDS(4, 40, 14)}, // requires TZNAME_MAX >=3D 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[] =3D { > > { /* 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 =3D > test_timezones; iter_name->tzstr !=3D NULL; ++iter_name) > > - > > // END test vectors > > > > static int failed =3D 0; > > @@ -136,22 +166,24 @@ void test_TimezoneStrings(void) > > { > > char buffer[128]; > > > > - FOR_TIMEZONES(ptr) > > + for (int i =3D 0; i < (sizeof(test_timezones) / sizeof(struct > tz_test)); ++i) > > { > > - setenv("TZ", ptr->tzstr, 1); > > + struct tz_test ptr =3D test_timezones[i]; > > + > > + setenv("TZ", ptr.tzstr, 1); > > tzset(); > > > > - snprintf(buffer, 128, "winter time, timezone =3D \"%s\"", > ptr->tzstr); > > + snprintf(buffer, 128, "winter time, timezone =3D \"%s\"", > ptr.tzstr); > > > > struct tm winter_tm_copy =3D 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 !=3D NO_TIME) > > + if (ptr.dst_offset_seconds !=3D NO_TIME) > > { > > - snprintf(buffer, 128, "summer time, timezone =3D \"%s\"", > ptr->tzstr); > > + snprintf(buffer, 128, "summer time, timezone =3D \"%s\"", > ptr.tzstr); > > > > struct tm summer_tm_copy =3D 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 > > > >