From owner-svn-src-head@FreeBSD.ORG Mon Oct 13 01:14:03 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 86280F4F; Mon, 13 Oct 2014 01:14:03 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 71B1B263; Mon, 13 Oct 2014 01:14:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9D1E3rZ000236; Mon, 13 Oct 2014 01:14:03 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9D1E1W5000225; Mon, 13 Oct 2014 01:14:01 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410130114.s9D1E1W5000225@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 13 Oct 2014 01:14:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273019 - head/contrib/netbsd-tests/lib/libc/locale X-SVN-Group: head 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.18-1 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: Mon, 13 Oct 2014 01:14:03 -0000 Author: ngie Date: Mon Oct 13 01:14:01 2014 New Revision: 273019 URL: https://svnweb.freebsd.org/changeset/base/273019 Log: Do initial port of contrib/netbsd-tests/lib/libc/locale t_io: - Expect failures potentially related to implementation-specific knowledge of the zh_TW.Big5 locale [*] t_mbrtowc: - Handle unknown locales more gracefully (do not test if the locale doesn't exist) - Expect failure with mbrtowc_internal dealing with Japanese locales (potentially related to implementation detail knowledge of the ja_* locales) [*]. t_mbstowcs, t_mbtowc, t_wctomb: - Handle unknown locales more gracefully (do not test if the locale doesn't exist) t_wcstod: - Treat FreeBSD like NetBSD and Linux in the XXX: FIXME section [*] More investigation is required to determine the root cause of the failures Submitted by: pho Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/locale/t_io.c head/contrib/netbsd-tests/lib/libc/locale/t_mbrtowc.c head/contrib/netbsd-tests/lib/libc/locale/t_mbstowcs.c head/contrib/netbsd-tests/lib/libc/locale/t_mbtowc.c head/contrib/netbsd-tests/lib/libc/locale/t_wcstod.c head/contrib/netbsd-tests/lib/libc/locale/t_wctomb.c Modified: head/contrib/netbsd-tests/lib/libc/locale/t_io.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/locale/t_io.c Mon Oct 13 01:06:40 2014 (r273018) +++ head/contrib/netbsd-tests/lib/libc/locale/t_io.c Mon Oct 13 01:14:01 2014 (r273019) @@ -56,6 +56,11 @@ ATF_TC_BODY(bad_big5_wprintf, tc) /* XXX implementation detail knowledge (wchar_t encoding) */ wchar_t ibuf[] = { 0xcf10, 0 }; setlocale(LC_CTYPE, "zh_TW.Big5"); + +#if defined(__FreeBSD__) + atf_tc_expect_fail("does not fail as expected (may be implementation " + "specific issue with the test)"); +#endif ATF_REQUIRE_ERRNO(EILSEQ, wprintf(L"%ls\n", ibuf) < 0); ATF_REQUIRE(ferror(stdout)); } @@ -72,6 +77,11 @@ ATF_TC_BODY(bad_big5_swprintf, tc) wchar_t ibuf[] = { 0xcf10, 0 }; wchar_t obuf[20]; setlocale(LC_CTYPE, "zh_TW.Big5"); + +#if defined(__FreeBSD__) + atf_tc_expect_fail("does not fail as expected (may be implementation " + "specific issue with the test)"); +#endif ATF_REQUIRE_ERRNO(EILSEQ, swprintf(obuf, sizeof(obuf), L"%ls\n", ibuf) < 0); } @@ -161,6 +171,9 @@ ATF_TC_BODY(bad_big5_getwc, tc) ATF_REQUIRE(fp != NULL); setlocale(LC_CTYPE, "zh_TW.Big5"); +#if defined(__FreeBSD__) + atf_tc_expect_fail("does not return WEOF as expected"); +#endif ATF_REQUIRE_EQ(getwc(fp), WEOF); fclose(fp); } Modified: head/contrib/netbsd-tests/lib/libc/locale/t_mbrtowc.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/locale/t_mbrtowc.c Mon Oct 13 01:06:40 2014 (r273018) +++ head/contrib/netbsd-tests/lib/libc/locale/t_mbrtowc.c Mon Oct 13 01:14:01 2014 (r273019) @@ -132,7 +132,14 @@ h_ctype2(const struct test *t, bool use_ size_t n; ATF_REQUIRE_STREQ(setlocale(LC_ALL, "C"), "C"); +#if defined(__NetBSD__) ATF_REQUIRE(setlocale(LC_CTYPE, t->locale) != NULL); +#else + if (setlocale(LC_CTYPE, t->locale) == NULL) { + fprintf(stderr, "Locale %s not found.\n", t->locale); + return; + } +#endif (void)strvis(buf, t->data, VIS_WHITE | VIS_OCTAL); (void)printf("Checking string: \"%s\"\n", buf); @@ -238,6 +245,9 @@ ATF_TC_BODY(mbrtowc_internal, tc) { struct test *t; +#if defined(__FreeBSD__) + atf_tc_expect_fail("ja_* locale fails"); +#endif for (t = &tests[0]; t->data != NULL; ++t) h_ctype2(t, false); } Modified: head/contrib/netbsd-tests/lib/libc/locale/t_mbstowcs.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/locale/t_mbstowcs.c Mon Oct 13 01:06:40 2014 (r273018) +++ head/contrib/netbsd-tests/lib/libc/locale/t_mbstowcs.c Mon Oct 13 01:14:01 2014 (r273019) @@ -150,7 +150,14 @@ ATF_TC_BODY(mbstowcs_basic, tc) int i; ATF_REQUIRE_STREQ(setlocale(LC_ALL, "C"), "C"); +#if defined(__NetBSD__) ATF_REQUIRE(setlocale(LC_CTYPE, t->locale) != NULL); +#else + if (setlocale(LC_CTYPE, t->locale) == NULL) { + fprintf(stderr, "Locale %s not found.\n", t->locale); + continue; + } +#endif (void)strvis(visbuf, t->data, VIS_WHITE | VIS_OCTAL); (void)printf("Checking string: \"%s\"\n", visbuf); Modified: head/contrib/netbsd-tests/lib/libc/locale/t_mbtowc.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/locale/t_mbtowc.c Mon Oct 13 01:06:40 2014 (r273018) +++ head/contrib/netbsd-tests/lib/libc/locale/t_mbtowc.c Mon Oct 13 01:14:01 2014 (r273019) @@ -76,7 +76,14 @@ h_mbtowc(const char *locale, const char char *str; ATF_REQUIRE_STREQ(setlocale(LC_ALL, "C"), "C"); +#if defined(__NetBSD__) ATF_REQUIRE(setlocale(LC_CTYPE, locale) != NULL); +#else + if (setlocale(LC_CTYPE, locale) == NULL) { + fprintf(stderr, "Locale %s not found.\n", locale); + return; + } +#endif ATF_REQUIRE((str = setlocale(LC_ALL, NULL)) != NULL); (void)printf("Using locale: %s\n", str); @@ -130,9 +137,16 @@ ATF_TC_BODY(mbtowc, tc) h_mbtowc("ja_JP.ISO2022-JP", "\033$B", "\033$B$\"\033(B"); h_mbtowc("ja_JP.SJIS", "\202", "\202\240"); h_mbtowc("ja_JP.eucJP", "\244", "\244\242"); +#if !defined(__FreeBSD__) + /* Moved last as it fails */ h_mbtowc("zh_CN.GB18030", "\241", "\241\241"); +#endif h_mbtowc("zh_TW.Big5", "\241", "\241@"); h_mbtowc("zh_TW.eucTW", "\241", "\241\241"); +#if defined(__FreeBSD__) + atf_tc_expect_fail("zh_CN.GB18030"); + h_mbtowc("zh_CN.GB18030", "\241", "\241\241"); +#endif } ATF_TP_ADD_TCS(tp) Modified: head/contrib/netbsd-tests/lib/libc/locale/t_wcstod.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/locale/t_wcstod.c Mon Oct 13 01:06:40 2014 (r273018) +++ head/contrib/netbsd-tests/lib/libc/locale/t_wcstod.c Mon Oct 13 01:14:01 2014 (r273019) @@ -238,7 +238,7 @@ static struct test { { L" -0X.", 12, 0, 0 }, #endif /* XXX: FIXME */ -#if defined(__NetBSD__) || defined(__linux__) +#if defined(__NetBSD__) || defined(__linux__) || defined(__FreeBSD__) { L"0X.0", 4, 0, 0 }, { L"+0X.0", 5, 0, 0 }, { L"-0X.0", 5, 0, 0 }, Modified: head/contrib/netbsd-tests/lib/libc/locale/t_wctomb.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/locale/t_wctomb.c Mon Oct 13 01:06:40 2014 (r273018) +++ head/contrib/netbsd-tests/lib/libc/locale/t_wctomb.c Mon Oct 13 01:14:01 2014 (r273019) @@ -109,7 +109,14 @@ h_wctomb(const struct test *t, char tc) size_t sz, ret, i; ATF_REQUIRE_STREQ(setlocale(LC_ALL, "C"), "C"); +#if defined(__NetBSD__) ATF_REQUIRE(setlocale(LC_CTYPE, t->locale) != NULL); +#else + if (setlocale(LC_CTYPE, t->locale) == NULL) { + fprintf(stderr, "Locale %s not found.\n", t->locale); + return; + } +#endif (void)strvis(buf, t->data, VIS_WHITE | VIS_OCTAL); (void)printf("Checking sequence: \"%s\"\n", buf);