From d8104f6290a4bb788e4d9923d8e5497e696bed36 Mon Sep 17 00:00:00 2001 From: wangchen <253227059@qq.com> Date: Tue, 12 Jul 2022 10:45:17 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20M4=20qemu=20=E5=BC=80=E5=90=AFnewlibc?= =?UTF-8?q?=E7=BC=96=E8=AF=91=E6=8A=A5=E9=94=99=20=E3=80=90=E8=83=8C?= =?UTF-8?q?=E6=99=AF=E3=80=91M4=20qemu=20=E5=BC=80=E5=90=AFnewlibc?= =?UTF-8?q?=E7=BC=96=E8=AF=91=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【修改方案】 删除musl依赖路径 【影响】 对现有的产品编译不会有影响。 re #I5GIAR Signed-off-by: wangchen --- testsuites/unittest/posix/src/ctype/isdigit_test.c | 6 +++--- .../unittest/posix/src/errno/strerror_test.c | 13 +++++++++++-- .../unittest/posix/src/fs/posix_fs_func_test.c | 11 ++++++++--- .../unittest/posix/src/regex/regex_func_test.c | 3 +++ testsuites/unittest/posix/src/stdlib/atoi_test.c | 9 ++++++++- testsuites/unittest/posix/src/stdlib/atol_test.c | 4 ++++ testsuites/unittest/posix/src/stdlib/atoll_test.c | 4 ++++ testsuites/unittest/posix/src/stdlib/strtol_test.c | 4 ++++ .../unittest/posix/src/stdlib/strtoul_test.c | 4 ++++ .../unittest/posix/src/stdlib/strtoull_test.c | 4 ++++ .../unittest/posix/src/time/time_func_test_01.c | 14 +++++++++++++- 11 files changed, 66 insertions(+), 10 deletions(-) diff --git a/testsuites/unittest/posix/src/ctype/isdigit_test.c b/testsuites/unittest/posix/src/ctype/isdigit_test.c index e517ad08..a2291e59 100644 --- a/testsuites/unittest/posix/src/ctype/isdigit_test.c +++ b/testsuites/unittest/posix/src/ctype/isdigit_test.c @@ -79,7 +79,7 @@ LITE_TEST_CASE(PosixCTypeIsdigitTest, testCTypeIsdigit001, Function | MediumTest else { LOG("[DEMO] posix ctype test case 1:isdigit(%c) fail.\n", a); } - TEST_ASSERT_EQUAL_INT(1, ret); + TEST_ASSERT_NOT_EQUAL(0, ret); return 0; } @@ -98,7 +98,7 @@ LITE_TEST_CASE(PosixCTypeIsdigitTest, testCTypeIsdigit002, Function | MediumTest else { LOG("[DEMO] posix ctype test case 2:isdigit(%c) fail.\n", a); } - TEST_ASSERT_EQUAL_INT(1, ret); + TEST_ASSERT_NOT_EQUAL(0, ret); return 0; } @@ -117,7 +117,7 @@ LITE_TEST_CASE(PosixCTypeIsdigitTest, testCTypeIsdigit003, Function | MediumTest else { LOG("[DEMO] posix ctype test case 3:isdigit(%c) fail.\n", a); } - TEST_ASSERT_EQUAL_INT(1, ret); + TEST_ASSERT_NOT_EQUAL(0, ret); return 0; } diff --git a/testsuites/unittest/posix/src/errno/strerror_test.c b/testsuites/unittest/posix/src/errno/strerror_test.c index 16d3280a..718b216d 100644 --- a/testsuites/unittest/posix/src/errno/strerror_test.c +++ b/testsuites/unittest/posix/src/errno/strerror_test.c @@ -72,6 +72,7 @@ static BOOL PosixSysFuncTestSuiteTearDown(void) */ LITE_TEST_CASE(PosixSysFuncTestSuite, testOsSysStrerror001, Function | MediumTest | Level1) { +#if (LOSCFG_LIBC_MUSL == 1) for (int i = EPERM; i < EHWPOISON; i++) { char *s = strerror(i); TEST_ASSERT_NOT_NULL(s); @@ -85,10 +86,18 @@ LITE_TEST_CASE(PosixSysFuncTestSuite, testOsSysStrerror001, Function | MediumTes TEST_ASSERT_EQUAL_STRING("No such file or directory", strerror(2)); LOG("strerror(10) = %s\n", strerror(10)); TEST_ASSERT_EQUAL_STRING("No child process", strerror(10)); - return 0; +#endif +#if (LOSCFG_LIBC_NEWLIB == 1) + LOG("strerror(0) = %s\n", strerror(0)); + TEST_ASSERT_EQUAL_STRING("Success", strerror(0)); + LOG("strerror(2) = %s\n", strerror(2)); + TEST_ASSERT_EQUAL_STRING("No such file or directory", strerror(2)); + LOG("strerror(10) = %s\n", strerror(10)); + TEST_ASSERT_EQUAL_STRING("No children", strerror(10)); +#endif + }; - RUN_TEST_SUITE(PosixSysFuncTestSuite); void PosixStrerrorTest() diff --git a/testsuites/unittest/posix/src/fs/posix_fs_func_test.c b/testsuites/unittest/posix/src/fs/posix_fs_func_test.c index 205d9236..a6f612f0 100644 --- a/testsuites/unittest/posix/src/fs/posix_fs_func_test.c +++ b/testsuites/unittest/posix/src/fs/posix_fs_func_test.c @@ -424,6 +424,7 @@ LITE_TEST_CASE(PosixFsFuncTestSuite, testFsFdopen003, Function | MediumTest | Le return 0; } +#if (LOSCFG_LIBC_MUSL == 1) /* * * @tc.number SUB_KERNEL_FS_FDOPEN_004 * @tc.name fdopen @@ -451,7 +452,7 @@ LITE_TEST_CASE(PosixFsFuncTestSuite, testFsFdopen004, Function | MediumTest | Le TEST_ASSERT_EQUAL_INT(ret, 0); return 0; } - +#endif /* * * @tc.number SUB_KERNEL_FS_FTELL_FSEEK_001 * @tc.name ftell and fseek @@ -674,6 +675,7 @@ LITE_TEST_CASE(PosixFsFuncTestSuite, testFsFtellFseek009, Function | MediumTest return 0; } +#if (LOSCFG_LIBC_MUSL == 1) /* * * @tc.number SUB_KERNEL_FS_FTELL_FSEEK_010 * @tc.name ftell and fseek @@ -702,7 +704,7 @@ LITE_TEST_CASE(PosixFsFuncTestSuite, testFsFtellFseek010, Function | MediumTest TEST_ASSERT_EQUAL_INT(ret, 0); return 0; } - +#endif /* * * @tc.number SUB_KERNEL_FS_FTELL_FSEEK_011 * @tc.name ftell and fseek @@ -1649,8 +1651,9 @@ void PosixFsFuncTest() RUN_ONE_TESTCASE(testFsFdopen001); RUN_ONE_TESTCASE(testFsFdopen002); RUN_ONE_TESTCASE(testFsFdopen003); +#if (LOSCFG_LIBC_MUSL == 1) RUN_ONE_TESTCASE(testFsFdopen004); - +#endif RUN_ONE_TESTCASE(testFsFtellFseek001); RUN_ONE_TESTCASE(testFsFtellFseek002); RUN_ONE_TESTCASE(testFsFtellFseek003); @@ -1660,7 +1663,9 @@ void PosixFsFuncTest() RUN_ONE_TESTCASE(testFsFtellFseek007); RUN_ONE_TESTCASE(testFsFtellFseek008); RUN_ONE_TESTCASE(testFsFtellFseek009); +#if (LOSCFG_LIBC_MUSL == 1) RUN_ONE_TESTCASE(testFsFtellFseek010); +#endif RUN_ONE_TESTCASE(testFsFtellFseek011); RUN_ONE_TESTCASE(testFsFtellFseek012); RUN_ONE_TESTCASE(testFsFtellFseek013); diff --git a/testsuites/unittest/posix/src/regex/regex_func_test.c b/testsuites/unittest/posix/src/regex/regex_func_test.c index 8cb2f096..b57828d6 100644 --- a/testsuites/unittest/posix/src/regex/regex_func_test.c +++ b/testsuites/unittest/posix/src/regex/regex_func_test.c @@ -38,6 +38,9 @@ #define EQUAL 0 +#ifndef REG_OK +#define REG_OK 0 +#endif /* * * @tc.desc : register a test suite, this suite is used to test basic flow and interface dependency * @param : subsystem name is utils diff --git a/testsuites/unittest/posix/src/stdlib/atoi_test.c b/testsuites/unittest/posix/src/stdlib/atoi_test.c index 9aaa7d7a..913b20a5 100644 --- a/testsuites/unittest/posix/src/stdlib/atoi_test.c +++ b/testsuites/unittest/posix/src/stdlib/atoi_test.c @@ -116,6 +116,7 @@ LITE_TEST_CASE(PosixStdlibAtoiTest, testStdlibAtoi003, Function | MediumTest | L return 0; } +#if (LOSCFG_LIBC_MUSL == 1) /* * * @tc.number : TEST_STDLIB_ATOI_004 * @tc.name : convert string to integer @@ -149,6 +150,7 @@ LITE_TEST_CASE(PosixStdlibAtoiTest, testStdlibAtoi005, Function | MediumTest | L TEST_ASSERT_EQUAL_INT(2147483647, value); return 0; } +#endif /* * * @tc.number : TEST_STDLIB_ATOI_006 @@ -218,6 +220,7 @@ LITE_TEST_CASE(PosixStdlibAtoiTest, testStdlibAtoi009, Function | MediumTest | L return 0; } +#if (LOSCFG_LIBC_MUSL == 1) /* * * @tc.number : TEST_STDLIB_ATOI_010 * @tc.name : convert string to integer @@ -234,6 +237,7 @@ LITE_TEST_CASE(PosixStdlibAtoiTest, testStdlibAtoi010, Function | MediumTest | L TEST_ASSERT_EQUAL_INT(-10, value); return 0; } +#endif RUN_TEST_SUITE(PosixStdlibAtoiTest); @@ -243,13 +247,16 @@ void PosixStdlibAtoiFuncTest() RUN_ONE_TESTCASE(testStdlibAtoi001); RUN_ONE_TESTCASE(testStdlibAtoi002); RUN_ONE_TESTCASE(testStdlibAtoi003); +#if (LOSCFG_LIBC_MUSL == 1) RUN_ONE_TESTCASE(testStdlibAtoi004); RUN_ONE_TESTCASE(testStdlibAtoi005); +#endif RUN_ONE_TESTCASE(testStdlibAtoi006); RUN_ONE_TESTCASE(testStdlibAtoi007); RUN_ONE_TESTCASE(testStdlibAtoi008); RUN_ONE_TESTCASE(testStdlibAtoi009); +#if (LOSCFG_LIBC_MUSL == 1) RUN_ONE_TESTCASE(testStdlibAtoi010); - +#endif return; } \ No newline at end of file diff --git a/testsuites/unittest/posix/src/stdlib/atol_test.c b/testsuites/unittest/posix/src/stdlib/atol_test.c index 6e0b66b3..1568fd55 100644 --- a/testsuites/unittest/posix/src/stdlib/atol_test.c +++ b/testsuites/unittest/posix/src/stdlib/atol_test.c @@ -116,6 +116,7 @@ LITE_TEST_CASE(PosixStdlibAtolTest, testStdlibAtol003, Function | MediumTest | L return 0; } +#if (LOSCFG_LIBC_MUSL == 1) /* * * @tc.number : TEST_STDLIB_ATOL_004 * @tc.name : convert string to long integer @@ -149,6 +150,7 @@ LITE_TEST_CASE(PosixStdlibAtolTest, testStdlibAtol005, Function | MediumTest | L TEST_ASSERT_EQUAL_INT32(2147483647, value); return 0; } +#endif /* * * @tc.number : TEST_STDLIB_ATOL_006 @@ -226,8 +228,10 @@ void PosixStdlibAtolFuncTest() RUN_ONE_TESTCASE(testStdlibAtol001); RUN_ONE_TESTCASE(testStdlibAtol002); RUN_ONE_TESTCASE(testStdlibAtol003); +#if (LOSCFG_LIBC_MUSL == 1) RUN_ONE_TESTCASE(testStdlibAtol004); RUN_ONE_TESTCASE(testStdlibAtol005); +#endif RUN_ONE_TESTCASE(testStdlibAtol006); RUN_ONE_TESTCASE(testStdlibAtol007); RUN_ONE_TESTCASE(testStdlibAtol008); diff --git a/testsuites/unittest/posix/src/stdlib/atoll_test.c b/testsuites/unittest/posix/src/stdlib/atoll_test.c index d3b9233f..080bd0c3 100644 --- a/testsuites/unittest/posix/src/stdlib/atoll_test.c +++ b/testsuites/unittest/posix/src/stdlib/atoll_test.c @@ -117,6 +117,7 @@ LITE_TEST_CASE(PosixStdlibAtollTest, testStdlibAtoll003, Function | MediumTest | return 0; } +#if (LOSCFG_LIBC_MUSL == 1) /* * * @tc.number : TEST_STDLIB_ATOLL_004 * @tc.name : convert string to long long integer @@ -151,6 +152,7 @@ LITE_TEST_CASE(PosixStdlibAtollTest, testStdlibAtoll005, Function | MediumTest | TEST_ASSERT_EQUAL_INT64(LLONG_MAX, value); return 0; } +#endif /* * * @tc.number : TEST_STDLIB_ATOLL_006 @@ -228,8 +230,10 @@ void PosixStdlibAtollFuncTest() RUN_ONE_TESTCASE(testStdlibAtoll001); RUN_ONE_TESTCASE(testStdlibAtoll002); RUN_ONE_TESTCASE(testStdlibAtoll003); +#if (LOSCFG_LIBC_MUSL == 1) RUN_ONE_TESTCASE(testStdlibAtoll004); RUN_ONE_TESTCASE(testStdlibAtoll005); +#endif RUN_ONE_TESTCASE(testStdlibAtoll006); RUN_ONE_TESTCASE(testStdlibAtoll007); RUN_ONE_TESTCASE(testStdlibAtoll008); diff --git a/testsuites/unittest/posix/src/stdlib/strtol_test.c b/testsuites/unittest/posix/src/stdlib/strtol_test.c index ec1de82a..b921a77d 100644 --- a/testsuites/unittest/posix/src/stdlib/strtol_test.c +++ b/testsuites/unittest/posix/src/stdlib/strtol_test.c @@ -265,6 +265,7 @@ LITE_TEST_CASE(PosixStdlibStrtolTest, testStdlibStrtol010, Function | MediumTest return 0; } +#if (LOSCFG_LIBC_MUSL == 1) /* * * @tc.number : TEST_STDLIB_STRTOL_011 * @tc.name : convert string to long integer @@ -284,6 +285,7 @@ LITE_TEST_CASE(PosixStdlibStrtolTest, testStdlibStrtol011, Function | MediumTest TEST_ASSERT_EQUAL_STRING(endPtr, "12 1.5"); return 0; } +#endif LITE_TEST_CASE(PosixStdlibStrtolTest, testStdlibStrtol012, Function | MediumTest | Level1) { @@ -335,7 +337,9 @@ void PosixStdlibStrtolFuncTest() RUN_ONE_TESTCASE(testStdlibStrtol008); RUN_ONE_TESTCASE(testStdlibStrtol009); RUN_ONE_TESTCASE(testStdlibStrtol010); +#if (LOSCFG_LIBC_MUSL == 1) RUN_ONE_TESTCASE(testStdlibStrtol011); +#endif RUN_ONE_TESTCASE(testStdlibStrtol012); RUN_ONE_TESTCASE(testStdlibStrtol013); diff --git a/testsuites/unittest/posix/src/stdlib/strtoul_test.c b/testsuites/unittest/posix/src/stdlib/strtoul_test.c index 6450f1f3..a99aa1b9 100644 --- a/testsuites/unittest/posix/src/stdlib/strtoul_test.c +++ b/testsuites/unittest/posix/src/stdlib/strtoul_test.c @@ -187,6 +187,7 @@ LITE_TEST_CASE(PosixStdlibStrtoulTest, testStdlibStrtoul006, Function | MediumTe return 0; } +#if (LOSCFG_LIBC_MUSL == 1) /* * * @tc.number : TEST_STDLIB_STRTOUL_007 * @tc.name : convert string by strtoul @@ -206,6 +207,7 @@ LITE_TEST_CASE(PosixStdlibStrtoulTest, testStdlibStrtoul007, Function | MediumTe TEST_ASSERT_EQUAL_STRING(endPtr, " 12.34"); return 0; } +#endif /* * * @tc.number : TEST_STDLIB_STRTOUL_008 @@ -278,7 +280,9 @@ void PosixStdlibStrtoulFuncTest() RUN_ONE_TESTCASE(testStdlibStrtoul004); RUN_ONE_TESTCASE(testStdlibStrtoul005); RUN_ONE_TESTCASE(testStdlibStrtoul006); +#if (LOSCFG_LIBC_MUSL == 1) RUN_ONE_TESTCASE(testStdlibStrtoul007); +#endif RUN_ONE_TESTCASE(testStdlibStrtoul008); RUN_ONE_TESTCASE(testStdlibStrtoul009); RUN_ONE_TESTCASE(testStdlibStrtoul010); diff --git a/testsuites/unittest/posix/src/stdlib/strtoull_test.c b/testsuites/unittest/posix/src/stdlib/strtoull_test.c index 9ea2f43f..edc03e20 100644 --- a/testsuites/unittest/posix/src/stdlib/strtoull_test.c +++ b/testsuites/unittest/posix/src/stdlib/strtoull_test.c @@ -147,6 +147,7 @@ LITE_TEST_CASE(PosixStdlibStrtoullTest, testStdlibStrtoull004, Function | Medium return 0; } +#if (LOSCFG_LIBC_MUSL == 1) /* * * @tc.number : TEST_STDLIB_STRTOULL_005 * @tc.name : convert string by Strtoull @@ -166,6 +167,7 @@ LITE_TEST_CASE(PosixStdlibStrtoullTest, testStdlibStrtoull005, Function | Medium TEST_ASSERT_EQUAL_STRING(endPtr, " 1.6"); return 0; } +#endif /* * * @tc.number : TEST_STDLIB_STRTOULL_006 @@ -279,7 +281,9 @@ void PosixStdlibStrtoullFuncTest() RUN_ONE_TESTCASE(testStdlibStrtoull002); RUN_ONE_TESTCASE(testStdlibStrtoull003); RUN_ONE_TESTCASE(testStdlibStrtoull004); +#if (LOSCFG_LIBC_MUSL == 1) RUN_ONE_TESTCASE(testStdlibStrtoull005); +#endif RUN_ONE_TESTCASE(testStdlibStrtoull006); RUN_ONE_TESTCASE(testStdlibStrtoull007); RUN_ONE_TESTCASE(testStdlibStrtoull008); diff --git a/testsuites/unittest/posix/src/time/time_func_test_01.c b/testsuites/unittest/posix/src/time/time_func_test_01.c index 545ae3a3..07b02c19 100644 --- a/testsuites/unittest/posix/src/time/time_func_test_01.c +++ b/testsuites/unittest/posix/src/time/time_func_test_01.c @@ -219,6 +219,7 @@ LITE_TEST_CASE(PosixTimeFuncTestSuite, testTimeGmtime001, Function | MediumTest return 0; }; +#if (LOSCFG_LIBC_MUSL == 1) /* * * @tc.number SUB_KERNEL_TIME_LOCALTIME_001 * @tc.name test localtime api @@ -358,6 +359,7 @@ LITE_TEST_CASE(PosixTimeFuncTestSuite, testTimeLocaltimer002, Function | MediumT LOG("\n time_t=%lld, first time:%s", tStart, cTime); return 0; } +#endif /* * * @tc.number SUB_KERNEL_TIME_MKTIME_001 @@ -415,11 +417,16 @@ LITE_TEST_CASE(PosixTimeFuncTestSuite, testTimeMktime002, Function | MediumTest INIT_TM(timeptr, 1969, 7, 9, 10, 10, 0, 7); time_t timeRet = mktime(&timeptr); LOG("\n 1800-8-9 10:10:00, mktime Ret lld = %lld", timeRet); +#if (LOSCFG_LIBC_MUSL == 1) TEST_ASSERT_EQUAL_INT(-1, timeRet); +#endif +#if (LOSCFG_LIBC_NEWLIB == 1) + TEST_ASSERT_LESS_THAN_INT(0, timeRet); +#endif return 0; } - +#if (LOSCFG_LIBC_MUSL == 1) /* * * @tc.number SUB_KERNEL_TIME_STRFTIME_001 * @tc.name test strftime api @@ -521,6 +528,7 @@ LITE_TEST_CASE(PosixTimeFuncTestSuite, testTimeStrftime003, Function | MediumTes LOG("\nresult: %s, expected : %s", buffer, "1970-01-01 13:14:40"); return 0; }; +#endif /* * * @tc.number SUB_KERNEL_TIME_API_TIMES_0100 @@ -567,15 +575,19 @@ void PosixTimeFuncTest(void) RUN_ONE_TESTCASE(testTimeUSleep002); RUN_ONE_TESTCASE(testTimeGmtime001); +#if (LOSCFG_LIBC_MUSL == 1) RUN_ONE_TESTCASE(testTimeLocaltime001); RUN_ONE_TESTCASE(testTimeLocaltime002); RUN_ONE_TESTCASE(testTimeLocaltimer001); RUN_ONE_TESTCASE(testTimeLocaltimer002); +#endif RUN_ONE_TESTCASE(testTimeMktime001); RUN_ONE_TESTCASE(testTimeMktime002); +#if (LOSCFG_LIBC_MUSL == 1) RUN_ONE_TESTCASE(testTimeStrftime001); RUN_ONE_TESTCASE(testTimeStrftime002); RUN_ONE_TESTCASE(testTimeStrftime003); +#endif RUN_ONE_TESTCASE(testTimes); return; }