Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 Oct 2014 01:14:01 +0000 (UTC)
From:      Garrett Cooper <ngie@FreeBSD.org>
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
Message-ID:  <201410130114.s9D1E1W5000225@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201410130114.s9D1E1W5000225>