From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from deimos.uberspace.de (deimos.uberspace.de [185.26.156.152]) by sourceware.org (Postfix) with ESMTPS id 9299A3858C56 for ; Sun, 10 Apr 2022 17:56:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9299A3858C56 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=jdoubleu.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=jdoubleu.de Received: (qmail 2515 invoked by uid 989); 10 Apr 2022 17:55:58 -0000 Authentication-Results: deimos.uberspace.de; auth=pass (plain) Message-ID: Date: Sun, 10 Apr 2022 19:55:56 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 Subject: Re: [PATCH] add tests for tzset(3) Content-Language: en-US To: Dimitar Dimitrov Cc: newlib@sourceware.org References: <569f6ec3-6bc8-8170-c1fb-ed946020e258@jdoubleu.de> From: jdoubleu In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspamd-Bar: -- X-Rspamd-Report: BAYES_HAM(-2.851778) MIME_GOOD(-0.1) X-Rspamd-Score: -2.951778 Received: from unknown (HELO unkown) (::1) by deimos.uberspace.de (Haraka/2.8.28) with ESMTPSA; Sun, 10 Apr 2022 19:55:58 +0200 X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00, BODY_8BITS, KAM_DMARC_STATUS, MSGID_FROM_MTA_HEADER, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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, 10 Apr 2022 17:56:06 -0000 Hi Dimitar, On 4/10/2022 10:43 AM, Dimitar Dimitrov wrote: > I get the following failure on pru-none-elf and arm-none-eabi targets: that is interesting! I just checked and they are still passing on x86_64-pc-linux-gnu. Which begs the question: What is the difference to your environment/target platform? Are you using any additional compilation flags? Have you enabled/disabled optimizations? Have you enabled the nano I/O API[1]? What compiler (and version) are you using? How/Where are you running the tests? > [..] timezone = "<+0123456789ABCDEF>3:33:33" The given test case aims to check for tzset's parsing behavior when the name (inside the angle brackets) exceeds the TZNAME_MAX var, i.e. is too long to be fully stored. The default behavior is to truncate the name and ignore all remaining chars[2]. The time should still be parsed. > Assertion failed! Expected 1647906533 to equal 1647916532. Now, the interesting part is, that the diff is 9,999 seconds. The time is off by 6 hours, 20 minutes and 12 seconds. That is 2 hours, 46 minutes and 38 seconds too far in the future. I am not sure where this is coming from. Neither does it look like it bailed early[3], because it couldn't parse the name. Please try and remove the "<+0123456789ABCDEF>" part from the string in the tests[4] and re-run the tests. Could you maybe also post the assembly listing and intermediate output of the compiler? If you're using gcc, just (re)configure newlib and rebuild libc: CFLAGS=-save-temps=obj ../newlib/configure make clean # get rid of stamp files make then copy and attach the following files: libc/time/libc_a-tzset_r.i libc/time/libc_a-tzset_r.s [1]: https://sourceware.org/git/?p=newlib-cygwin.git;a=blob;f=newlib/README;h=97890b9d20ca0ac9f206d7a2334d55a3d7052289;hb=HEAD#l403 [2]: https://sourceware.org/pipermail/newlib/2022/019535.html [3]: https://sourceware.org/git/?p=newlib-cygwin.git;a=blob;f=newlib/libc/time/tzset_r.c;h=9cb30b188f989f65ec9eb6417f5d74020f8c72e9;hb=HEAD#l57 [4]: https://sourceware.org/git/?p=newlib-cygwin.git;a=blob;f=newlib/testsuite/newlib.time/tzset.c;h=0e5b196c629bcbecae6148c09bbeba82079c5367;hb=HEAD#l96 Cheers --- 🙎🏻‍♂️ jdoubleu