diff options
author | ngie <ngie@FreeBSD.org> | 2014-10-13 01:14:01 +0000 |
---|---|---|
committer | ngie <ngie@FreeBSD.org> | 2014-10-13 01:14:01 +0000 |
commit | f890b5bffa3a65125f7b30bd9a79a81fab72c5f8 (patch) | |
tree | e58b66119c74945b5f46ea5822505d7783d06939 /contrib/netbsd-tests/lib/libc | |
parent | e7491a16adbd1e122203b38bce7423fe40beb51c (diff) | |
download | FreeBSD-src-f890b5bffa3a65125f7b30bd9a79a81fab72c5f8.zip FreeBSD-src-f890b5bffa3a65125f7b30bd9a79a81fab72c5f8.tar.gz |
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
Diffstat (limited to 'contrib/netbsd-tests/lib/libc')
-rw-r--r-- | contrib/netbsd-tests/lib/libc/locale/t_io.c | 13 | ||||
-rw-r--r-- | contrib/netbsd-tests/lib/libc/locale/t_mbrtowc.c | 10 | ||||
-rw-r--r-- | contrib/netbsd-tests/lib/libc/locale/t_mbstowcs.c | 7 | ||||
-rw-r--r-- | contrib/netbsd-tests/lib/libc/locale/t_mbtowc.c | 14 | ||||
-rw-r--r-- | contrib/netbsd-tests/lib/libc/locale/t_wcstod.c | 2 | ||||
-rw-r--r-- | contrib/netbsd-tests/lib/libc/locale/t_wctomb.c | 7 |
6 files changed, 52 insertions, 1 deletions
diff --git a/contrib/netbsd-tests/lib/libc/locale/t_io.c b/contrib/netbsd-tests/lib/libc/locale/t_io.c index 782bed8..7f7293a 100644 --- a/contrib/netbsd-tests/lib/libc/locale/t_io.c +++ b/contrib/netbsd-tests/lib/libc/locale/t_io.c @@ -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); } diff --git a/contrib/netbsd-tests/lib/libc/locale/t_mbrtowc.c b/contrib/netbsd-tests/lib/libc/locale/t_mbrtowc.c index b4ad841..7cab973 100644 --- a/contrib/netbsd-tests/lib/libc/locale/t_mbrtowc.c +++ b/contrib/netbsd-tests/lib/libc/locale/t_mbrtowc.c @@ -132,7 +132,14 @@ h_ctype2(const struct test *t, bool use_mbstate) 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); } diff --git a/contrib/netbsd-tests/lib/libc/locale/t_mbstowcs.c b/contrib/netbsd-tests/lib/libc/locale/t_mbstowcs.c index ec06729..7395d19 100644 --- a/contrib/netbsd-tests/lib/libc/locale/t_mbstowcs.c +++ b/contrib/netbsd-tests/lib/libc/locale/t_mbstowcs.c @@ -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); diff --git a/contrib/netbsd-tests/lib/libc/locale/t_mbtowc.c b/contrib/netbsd-tests/lib/libc/locale/t_mbtowc.c index 62f62b1..bb69060 100644 --- a/contrib/netbsd-tests/lib/libc/locale/t_mbtowc.c +++ b/contrib/netbsd-tests/lib/libc/locale/t_mbtowc.c @@ -76,7 +76,14 @@ h_mbtowc(const char *locale, const char *illegal, const char *legal) 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) diff --git a/contrib/netbsd-tests/lib/libc/locale/t_wcstod.c b/contrib/netbsd-tests/lib/libc/locale/t_wcstod.c index ef85777..fe7b468 100644 --- a/contrib/netbsd-tests/lib/libc/locale/t_wcstod.c +++ b/contrib/netbsd-tests/lib/libc/locale/t_wcstod.c @@ -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 }, diff --git a/contrib/netbsd-tests/lib/libc/locale/t_wctomb.c b/contrib/netbsd-tests/lib/libc/locale/t_wctomb.c index f553c8c..06016bf 100644 --- a/contrib/netbsd-tests/lib/libc/locale/t_wctomb.c +++ b/contrib/netbsd-tests/lib/libc/locale/t_wctomb.c @@ -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); |