From owner-svn-src-head@freebsd.org Tue Oct 30 02:37:24 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9631410CEB68; Tue, 30 Oct 2018 02:37:24 +0000 (UTC) (envelope-from yuripv@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B8E36D9A6; Tue, 30 Oct 2018 02:37:24 +0000 (UTC) (envelope-from yuripv@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2E32317588; Tue, 30 Oct 2018 02:37:24 +0000 (UTC) (envelope-from yuripv@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w9U2bOxT015541; Tue, 30 Oct 2018 02:37:24 GMT (envelope-from yuripv@FreeBSD.org) Received: (from yuripv@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9U2bNeq015539; Tue, 30 Oct 2018 02:37:23 GMT (envelope-from yuripv@FreeBSD.org) Message-Id: <201810300237.w9U2bNeq015539@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: yuripv set sender to yuripv@FreeBSD.org using -f From: Yuri Pankov Date: Tue, 30 Oct 2018 02:37:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r339904 - in head: contrib/netbsd-tests/lib/libc/time lib/libc/tests X-SVN-Group: head X-SVN-Commit-Author: yuripv X-SVN-Commit-Paths: in head: contrib/netbsd-tests/lib/libc/time lib/libc/tests X-SVN-Commit-Revision: 339904 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Oct 2018 02:37:24 -0000 Author: yuripv Date: Tue Oct 30 02:37:23 2018 New Revision: 339904 URL: https://svnweb.freebsd.org/changeset/base/339904 Log: Connect libc/tests/time to the build, adding test cases for strptime() issues fixed recently, and disabling the failing ones (mostly due to TZ parsing differences with NetBSD). Reviewed by: ngie Approved by: kib (mentor) Differential Revision: https://reviews.freebsd.org/D17546 Modified: head/contrib/netbsd-tests/lib/libc/time/t_mktime.c head/contrib/netbsd-tests/lib/libc/time/t_strptime.c head/lib/libc/tests/Makefile Modified: head/contrib/netbsd-tests/lib/libc/time/t_mktime.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/time/t_mktime.c Tue Oct 30 01:39:22 2018 (r339903) +++ head/contrib/netbsd-tests/lib/libc/time/t_mktime.c Tue Oct 30 02:37:23 2018 (r339904) @@ -64,6 +64,9 @@ ATF_TC_HEAD(mktime_negyear, tc) ATF_TC_BODY(mktime_negyear, tc) { +#ifdef __FreeBSD__ + atf_tc_expect_fail("needs work"); +#endif struct tm tms; time_t t; Modified: head/contrib/netbsd-tests/lib/libc/time/t_strptime.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/time/t_strptime.c Tue Oct 30 01:39:22 2018 (r339903) +++ head/contrib/netbsd-tests/lib/libc/time/t_strptime.c Tue Oct 30 02:37:23 2018 (r339904) @@ -103,6 +103,7 @@ static struct { const char *name; long offs; } zt[] = { +#ifndef __FreeBSD__ { "Z", 0 }, { "UT", 0 }, { "UTC", 0 }, @@ -173,6 +174,7 @@ static struct { { "EST4EDT", -14400 }, { "Bogus", -1 }, +#endif }; static void @@ -188,9 +190,11 @@ ztest1(const char *name, const char *fmt, long value) value = 0; switch (value) { +#ifndef __FreeBSD__ case -2: value = -timezone; break; +#endif case -1: if (fmt[1] == 'Z') value = 0; @@ -210,9 +214,11 @@ static void ztest(const char *fmt) { setenv("TZ", "US/Eastern", 1); +#ifndef __FreeBSD__ ztest1("GMT", fmt, 0); ztest1("UTC", fmt, 0); ztest1("US/Eastern", fmt, -18000); +#endif for (size_t i = 0; i < __arraycount(zt); i++) ztest1(zt[i].name, fmt, zt[i].offs); } @@ -228,10 +234,6 @@ ATF_TC_HEAD(common, tc) ATF_TC_BODY(common, tc) { -#ifdef __FreeBSD__ - atf_tc_expect_fail("There are various issues with strptime on FreeBSD"); -#endif - h_pass("Tue Jan 20 23:27:46 1998", "%a %b %d %T %Y", 24, 46, 27, 23, 20, 0, 98, 2, 19); h_pass("Tue Jan 20 23:27:46 1998", "%a %b %d %H:%M:%S %Y", @@ -305,6 +307,10 @@ ATF_TC_BODY(day, tc) #else h_pass("SaturDay", "%OA", 8, -1, -1, -1, -1, -1, -1, 6, -1); #endif + +#ifdef __FreeBSD__ + h_fail("00", "%d"); +#endif } ATF_TC(hour); @@ -313,7 +319,11 @@ ATF_TC_HEAD(hour, tc) { atf_tc_set_md_var(tc, "descr", +#ifdef __FreeBSD__ + "Checks strptime(3) hour conversions [HIkl]"); +#else "Checks strptime(3) hour conversions [IH]"); +#endif } ATF_TC_BODY(hour, tc) @@ -321,6 +331,10 @@ ATF_TC_BODY(hour, tc) h_fail("00", "%I"); h_fail("13", "%I"); +#ifdef __FreeBSD__ + h_fail("00", "%l"); + h_fail("13", "%l"); +#endif h_pass("00", "%H", 2, -1, -1, 0, -1, -1, -1, -1, -1); h_pass("12", "%H", 2, -1, -1, 12, -1, -1, -1, -1, -1); @@ -413,7 +427,18 @@ ATF_TC_BODY(seconds, tc) h_pass("0", "%S", 1, 0, -1, -1, -1, -1, -1, -1, -1); h_pass("59", "%S", 2, 59, -1, -1, -1, -1, -1, -1, -1); h_pass("60", "%S", 2, 60, -1, -1, -1, -1, -1, -1, -1); +#ifdef __FreeBSD__ + /* + * (Much) older versions of the standard (up to the Issue 6) allowed for + * [0;61] range in %S conversion for double-leap seconds, and it's + * apparently what NetBSD and glibc are expecting, however current + * version defines allowed values to be [0;60], and that is what our + * strptime() implementation expects. + */ + h_fail("61", "%S"); +#else h_pass("61", "%S", 2, 61, -1, -1, -1, -1, -1, -1, -1); +#endif h_fail("62", "%S"); } @@ -434,7 +459,9 @@ ATF_TC_BODY(year, tc) h_pass("x2084y", "x%C%yy", 6, -1, -1, -1, -1, -1, 184, -1, -1); h_pass("x8420y", "x%y%Cy", 6, -1, -1, -1, -1, -1, 184, -1, -1); h_pass("%20845", "%%%C%y5", 6, -1, -1, -1, -1, -1, 184, -1, -1); +#ifndef __FreeBSD__ h_fail("%", "%E%"); +#endif h_pass("1980", "%Y", 4, -1, -1, -1, -1, -1, 80, -1, -1); h_pass("1980", "%EY", 4, -1, -1, -1, -1, -1, 80, -1, -1); @@ -467,7 +494,7 @@ ATF_TC_HEAD(Zone, tc) ATF_TC_BODY(Zone, tc) { - ztest("%z"); + ztest("%Z"); } ATF_TP_ADD_TCS(tp) Modified: head/lib/libc/tests/Makefile ============================================================================== --- head/lib/libc/tests/Makefile Tue Oct 30 01:39:22 2018 (r339903) +++ head/lib/libc/tests/Makefile Tue Oct 30 02:37:23 2018 (r339904) @@ -20,6 +20,7 @@ TESTS_SUBDIRS+= stdlib TESTS_SUBDIRS+= string TESTS_SUBDIRS+= sys TESTS_SUBDIRS+= termios +TESTS_SUBDIRS+= time TESTS_SUBDIRS+= tls TESTS_SUBDIRS+= ttyio