From be68dc8bcaf8d965039ae1d792775f00a08adfac Mon Sep 17 00:00:00 2001 From: yinjiaming Date: Thu, 17 Feb 2022 07:15:27 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8DA=E6=A0=B8=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E7=94=A8=E4=BE=8B=E5=A4=B1=E8=B4=A5=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98=20=E3=80=90=E8=83=8C=E6=99=AF=E3=80=91=20=E3=80=90Ope?= =?UTF-8?q?nHarmony=E3=80=91=E3=80=90master=E3=80=91L1=20liteos=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E6=89=A7=E8=A1=8Cliteos=5Fa=5Flibc=5Funittest.bin=20?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E6=A8=A1=E5=9D=97=EF=BC=8C=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E5=A5=97SysTest=201=E6=9D=A1=E7=94=A8=E4=BE=8BFail?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【修改方案】 将先前更改locale的地方将locale设置为默认值 【影响】 对现有的产品编译不会有影响。 re #I4SQDP Signed-off-by: yinjiaming Change-Id: I4cd5d5d59aa3ff8ece469ee7a61054f3d4635f45 --- testsuites/unittest/libc/io/full/IO_test_dcgettext_001.cpp | 1 + testsuites/unittest/libc/io/full/IO_test_dcgettext_002.cpp | 1 + testsuites/unittest/libc/io/full/IO_test_dcngettext_002.cpp | 1 + testsuites/unittest/libc/io/full/IO_test_dngettext_001.cpp | 1 + testsuites/unittest/libc/io/full/IO_test_dngettext_002.cpp | 1 + testsuites/unittest/libc/io/full/IO_test_duplocale_001.cpp | 1 + testsuites/unittest/libc/io/full/IO_test_gettext_001.cpp | 1 + testsuites/unittest/libc/io/full/IO_test_locale_001.cpp | 1 + testsuites/unittest/libc/io/full/IO_test_locale_002.cpp | 1 + testsuites/unittest/libc/io/full/IO_test_ngettext_001.cpp | 1 + testsuites/unittest/libc/io/full/IO_test_nl_langinfo_001.cpp | 1 + testsuites/unittest/libc/io/full/IO_test_nl_langinfo_l_001.cpp | 1 + testsuites/unittest/libc/io/full/IO_test_strfmon_l_002.cpp | 1 + testsuites/unittest/libc/io/full/IO_test_strncasecmp_l_002.cpp | 1 + testsuites/unittest/libc/io/full/It_stdio_mblen_001.cpp | 1 + testsuites/unittest/libc/io/full/It_stdio_mbrlen_001.cpp | 1 + 16 files changed, 16 insertions(+) diff --git a/testsuites/unittest/libc/io/full/IO_test_dcgettext_001.cpp b/testsuites/unittest/libc/io/full/IO_test_dcgettext_001.cpp index e51a27ad..57367c17 100644 --- a/testsuites/unittest/libc/io/full/IO_test_dcgettext_001.cpp +++ b/testsuites/unittest/libc/io/full/IO_test_dcgettext_001.cpp @@ -46,6 +46,7 @@ static UINT32 testcase(VOID) s = dcgettext("www.huawei.com", "TestString1\n", LC_MESSAGES); printf("[INFO]%s:%d,%s,s=%s\n", __FILE__, __LINE__, __func__, s); ICUNIT_ASSERT_STRING_EQUAL(s, "TestString1\n", s); + setlocale(LC_ALL, "C"); return LOS_OK; } diff --git a/testsuites/unittest/libc/io/full/IO_test_dcgettext_002.cpp b/testsuites/unittest/libc/io/full/IO_test_dcgettext_002.cpp index 8ffb46b8..0c1174d3 100644 --- a/testsuites/unittest/libc/io/full/IO_test_dcgettext_002.cpp +++ b/testsuites/unittest/libc/io/full/IO_test_dcgettext_002.cpp @@ -127,6 +127,7 @@ static UINT32 testcase(VOID) testcase2(); testcase3(); testcase4(); + setlocale(LC_ALL, "C"); return LOS_OK; } diff --git a/testsuites/unittest/libc/io/full/IO_test_dcngettext_002.cpp b/testsuites/unittest/libc/io/full/IO_test_dcngettext_002.cpp index 4253cb43..75732114 100644 --- a/testsuites/unittest/libc/io/full/IO_test_dcngettext_002.cpp +++ b/testsuites/unittest/libc/io/full/IO_test_dcngettext_002.cpp @@ -92,6 +92,7 @@ static UINT32 testcase(VOID) { testcase1(); testcase2(); + setlocale(LC_ALL, "C"); return LOS_OK; } diff --git a/testsuites/unittest/libc/io/full/IO_test_dngettext_001.cpp b/testsuites/unittest/libc/io/full/IO_test_dngettext_001.cpp index dea72b5f..5b890485 100644 --- a/testsuites/unittest/libc/io/full/IO_test_dngettext_001.cpp +++ b/testsuites/unittest/libc/io/full/IO_test_dngettext_001.cpp @@ -51,6 +51,7 @@ static UINT32 testcase(VOID) s = dngettext("www.huawei.com", "TestString1\n", "TestString2\n", 2); printf("[INFO]%s:%d,%s,s=%s\n", __FILE__, __LINE__, __func__, s); ICUNIT_ASSERT_STRING_EQUAL(s, "TestString2\n", s); + setlocale(LC_ALL, "C"); return LOS_OK; } diff --git a/testsuites/unittest/libc/io/full/IO_test_dngettext_002.cpp b/testsuites/unittest/libc/io/full/IO_test_dngettext_002.cpp index 0e6753de..bcb9bf0d 100644 --- a/testsuites/unittest/libc/io/full/IO_test_dngettext_002.cpp +++ b/testsuites/unittest/libc/io/full/IO_test_dngettext_002.cpp @@ -121,6 +121,7 @@ static UINT32 testcase(VOID) testcase1(); /* test the domain is NULL */ testcase2(); /* test the domain is different with the setlocale */ testcase3(); /* if n != 1,then dngettext will choose msgid2's string */ + setlocale(LC_ALL, "C"); return LOS_OK; } diff --git a/testsuites/unittest/libc/io/full/IO_test_duplocale_001.cpp b/testsuites/unittest/libc/io/full/IO_test_duplocale_001.cpp index 85157281..a75d39e4 100644 --- a/testsuites/unittest/libc/io/full/IO_test_duplocale_001.cpp +++ b/testsuites/unittest/libc/io/full/IO_test_duplocale_001.cpp @@ -143,6 +143,7 @@ static UINT32 testcase(VOID) (VOID)RecoveryFileEnv(pathList, 1); status = WEXITSTATUS(status); ICUNIT_ASSERT_EQUAL(status, 0, status); + setlocale(LC_ALL, "C"); return LOS_OK; } diff --git a/testsuites/unittest/libc/io/full/IO_test_gettext_001.cpp b/testsuites/unittest/libc/io/full/IO_test_gettext_001.cpp index fb3c91d0..23d6960e 100644 --- a/testsuites/unittest/libc/io/full/IO_test_gettext_001.cpp +++ b/testsuites/unittest/libc/io/full/IO_test_gettext_001.cpp @@ -56,6 +56,7 @@ static UINT32 testcase1(VOID) s = gettext("Monday/n\n"); ICUNIT_ASSERT_STRING_EQUAL(s, "Monday/n\n", s); + setlocale(LC_ALL, "C"); return LOS_OK; OUT: diff --git a/testsuites/unittest/libc/io/full/IO_test_locale_001.cpp b/testsuites/unittest/libc/io/full/IO_test_locale_001.cpp index 4282ce17..f2bbf1c6 100644 --- a/testsuites/unittest/libc/io/full/IO_test_locale_001.cpp +++ b/testsuites/unittest/libc/io/full/IO_test_locale_001.cpp @@ -58,6 +58,7 @@ static UINT32 testcase(VOID) strftime(buffer, 80, "%c", timer); printf("Date is: %s\n", buffer); ICUNIT_ASSERT_NOT_EQUAL_NULL(buffer, NULL, -1); + setlocale(LC_ALL, "C"); return LOS_OK; } diff --git a/testsuites/unittest/libc/io/full/IO_test_locale_002.cpp b/testsuites/unittest/libc/io/full/IO_test_locale_002.cpp index 000508d2..6e22bc86 100644 --- a/testsuites/unittest/libc/io/full/IO_test_locale_002.cpp +++ b/testsuites/unittest/libc/io/full/IO_test_locale_002.cpp @@ -59,6 +59,7 @@ static UINT32 testcase(VOID) strftime(buffer, 80, "%c", timer); printf("Date is: %s\n", buffer); ICUNIT_ASSERT_NOT_EQUAL_NULL(buffer, NULL, -1); + setlocale(LC_ALL, "C"); return LOS_OK; } diff --git a/testsuites/unittest/libc/io/full/IO_test_ngettext_001.cpp b/testsuites/unittest/libc/io/full/IO_test_ngettext_001.cpp index 18f3858b..446a7cf7 100644 --- a/testsuites/unittest/libc/io/full/IO_test_ngettext_001.cpp +++ b/testsuites/unittest/libc/io/full/IO_test_ngettext_001.cpp @@ -46,6 +46,7 @@ static UINT32 testcase(VOID) s = ngettext("0123456789", "0123456789", 2); ICUNIT_ASSERT_STRING_EQUAL(s, "0123456789", s); + setlocale(LC_ALL, "C"); return LOS_OK; } diff --git a/testsuites/unittest/libc/io/full/IO_test_nl_langinfo_001.cpp b/testsuites/unittest/libc/io/full/IO_test_nl_langinfo_001.cpp index 8e8bd44b..b33fb2ff 100644 --- a/testsuites/unittest/libc/io/full/IO_test_nl_langinfo_001.cpp +++ b/testsuites/unittest/libc/io/full/IO_test_nl_langinfo_001.cpp @@ -90,6 +90,7 @@ static UINT32 testcase(VOID) char *string = nl_langinfo(CRNCYSTR); ICUNIT_ASSERT_NOT_EQUAL_NULL(string, NULL, string); + setlocale(LC_ALL, "C"); return LOS_OK; } diff --git a/testsuites/unittest/libc/io/full/IO_test_nl_langinfo_l_001.cpp b/testsuites/unittest/libc/io/full/IO_test_nl_langinfo_l_001.cpp index 8adb4f8f..922e0c18 100644 --- a/testsuites/unittest/libc/io/full/IO_test_nl_langinfo_l_001.cpp +++ b/testsuites/unittest/libc/io/full/IO_test_nl_langinfo_l_001.cpp @@ -58,6 +58,7 @@ static UINT32 testcase(VOID) { char *string = nl_langinfo_l(CRNCYSTR, (locale_t)"zh_CN.UTF-8"); ICUNIT_ASSERT_NOT_EQUAL_NULL(string, NULL, string); + setlocale(LC_ALL, "C"); return LOS_OK; } diff --git a/testsuites/unittest/libc/io/full/IO_test_strfmon_l_002.cpp b/testsuites/unittest/libc/io/full/IO_test_strfmon_l_002.cpp index 4b658239..b266fff4 100644 --- a/testsuites/unittest/libc/io/full/IO_test_strfmon_l_002.cpp +++ b/testsuites/unittest/libc/io/full/IO_test_strfmon_l_002.cpp @@ -69,6 +69,7 @@ static UINT32 testcase1(VOID) TEST_PRINT("[INFO]%s:%d,%s,ret=%d,buf=%s\n", __FILE__, __LINE__, __func__, ret, buf); ICUNIT_GOTO_EQUAL(ret, 23, ret, OUT); ICUNIT_GOTO_EQUAL(errno, 0, errno, OUT); + setlocale(LC_ALL, "C"); return LOS_OK; OUT: diff --git a/testsuites/unittest/libc/io/full/IO_test_strncasecmp_l_002.cpp b/testsuites/unittest/libc/io/full/IO_test_strncasecmp_l_002.cpp index 285088bd..0f68f80c 100644 --- a/testsuites/unittest/libc/io/full/IO_test_strncasecmp_l_002.cpp +++ b/testsuites/unittest/libc/io/full/IO_test_strncasecmp_l_002.cpp @@ -129,6 +129,7 @@ static UINT32 testcase(VOID) testcase2(); testcase3(); testcase4(); + setlocale(LC_ALL, "C"); return LOS_OK; } diff --git a/testsuites/unittest/libc/io/full/It_stdio_mblen_001.cpp b/testsuites/unittest/libc/io/full/It_stdio_mblen_001.cpp index 7667ce6c..f35fd4b3 100644 --- a/testsuites/unittest/libc/io/full/It_stdio_mblen_001.cpp +++ b/testsuites/unittest/libc/io/full/It_stdio_mblen_001.cpp @@ -49,6 +49,7 @@ static UINT32 Testcase(VOID) ++result; } ICUNIT_GOTO_EQUAL(result, 4, result, EXIT); // 4, except value + setlocale(LC_ALL, "C"); return LOS_OK; EXIT: diff --git a/testsuites/unittest/libc/io/full/It_stdio_mbrlen_001.cpp b/testsuites/unittest/libc/io/full/It_stdio_mbrlen_001.cpp index 39ee9f4a..da1c3fd0 100644 --- a/testsuites/unittest/libc/io/full/It_stdio_mbrlen_001.cpp +++ b/testsuites/unittest/libc/io/full/It_stdio_mbrlen_001.cpp @@ -49,6 +49,7 @@ static UINT32 Testcase(VOID) len3 = mbrlen(str + 1, sz - 1, &mb); ICUNIT_GOTO_EQUAL(len3, -1, len3, EXIT); + setlocale(LC_ALL, "C"); return LOS_OK; EXIT: