diff --git a/config_iccarm.gni b/config_iccarm.gni index 0b934ff6..125afcc6 100644 --- a/config_iccarm.gni +++ b/config_iccarm.gni @@ -86,10 +86,6 @@ optimize_config_cflags = [] optimize_config_asmflags = [] if (defined(LOSCFG_COMPILE_DEBUG)) { - optimize_config_cflags += [ - "-g", - "-gdwarf-2", - ] optimize_config_cflags += [ "-On" ] } else { if (defined(LOSCFG_COMPILE_OPTIMIZE)) { @@ -118,12 +114,14 @@ kconfig_config_cflags += [ warn_config_cflags = [] warn_config_asmflags = [] -warn_config_cflags += [ - "--warnings_affect_exit_code", - "--warnings_are_errors", - "--warn_about_c_style_casts", - "--warn_about_incomplete_constructors", -] +if (!defined(LOSCFG_TEST)) { + warn_config_cflags += [ + "--warnings_affect_exit_code", + "--warnings_are_errors", + "--warn_about_c_style_casts", + "--warn_about_incomplete_constructors", + ] +} # # dialect_config diff --git a/testsuites/include/osTest.h b/testsuites/include/osTest.h index 5f034449..78a4ddea 100644 --- a/testsuites/include/osTest.h +++ b/testsuites/include/osTest.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. + * Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: @@ -340,6 +340,7 @@ typedef struct tagHwiHandleForm { #define TEST_HwiCreate(ID, prio, mode, Func, irqParam) LOS_HwiCreate(ID, prio, mode, Func, irqParam) #define uart_printf_func printf +extern VOID ItSuiteLosAtomic(void); extern VOID ItSuiteLosTask(void); extern VOID ItSuiteLosQueue(void); extern VOID ItSuiteLosMux(void); diff --git a/testsuites/sample/cmsis/cmsis_func_test.c b/testsuites/sample/cmsis/cmsis_func_test.c index aa15c496..bcd74ef8 100644 --- a/testsuites/sample/cmsis/cmsis_func_test.c +++ b/testsuites/sample/cmsis/cmsis_func_test.c @@ -101,14 +101,14 @@ LITE_TEST_CASE(CmsisFuncTestSuite, TestCmsis007, Function | MediumTest | Level1) msgQueueId = osMessageQueueNew(1, strlen(strbuff), &attr); ICUNIT_ASSERT_NOT_EQUAL(msgQueueId, NULL, msgQueueId); - name = osMessageQueueGetName(msgQueueId); + name = (CHAR *)osMessageQueueGetName(msgQueueId); ret = strcmp(name, "q1"); ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); ret = osMessageQueueDelete(msgQueueId); ICUNIT_ASSERT_EQUAL(ret, osOK, ret); - name = osMessageQueueGetName(msgQueueId); + name = (CHAR *)osMessageQueueGetName(msgQueueId); ICUNIT_ASSERT_EQUAL(name, NULL, name); #if (LOSCFG_BASE_IPC_QUEUE_STATIC == 1) diff --git a/testsuites/sample/kernel/atomic/it_los_atomic.h b/testsuites/sample/kernel/atomic/it_los_atomic.h index 6bb953ca..7d0d1017 100644 --- a/testsuites/sample/kernel/atomic/it_los_atomic.h +++ b/testsuites/sample/kernel/atomic/it_los_atomic.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. + * Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: @@ -56,6 +56,8 @@ extern VOID ItLosAtomic006(VOID); extern VOID ItLosAtomic007(VOID); extern VOID ItLosAtomic008(VOID); extern VOID ItLosAtomic009(VOID); +extern VOID ItLosAtomic010(VOID); +extern VOID ItLosAtomic011(VOID); #ifdef __cplusplus #if __cplusplus diff --git a/testsuites/sample/kernel/atomic/it_los_atomic_011.c b/testsuites/sample/kernel/atomic/it_los_atomic_011.c index d2a322e3..995c15f2 100644 --- a/testsuites/sample/kernel/atomic/it_los_atomic_011.c +++ b/testsuites/sample/kernel/atomic/it_los_atomic_011.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. + * Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: diff --git a/testsuites/sample/kernel/swtmr/It_los_swtmr_039.c b/testsuites/sample/kernel/swtmr/It_los_swtmr_039.c index 020527ec..01a0c7b6 100644 --- a/testsuites/sample/kernel/swtmr/It_los_swtmr_039.c +++ b/testsuites/sample/kernel/swtmr/It_los_swtmr_039.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. + * Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: @@ -69,7 +69,7 @@ static UINT32 Testcase(VOID) g_testCount1 = 0; // 1, Timeout interval of a periodic software timer. - ret = LOS_SwtmrCreate(1, LOS_SWTMR_MODE_ONCE, (SWTMR_PROC_FUNC)Case2, &g_swtmrId1, &irqParam + ret = LOS_SwtmrCreate(1, LOS_SWTMR_MODE_ONCE, (SWTMR_PROC_FUNC)Case2, &g_swtmrId1, (UINT32)&irqParam #if (LOSCFG_BASE_CORE_SWTMR_ALIGN == 1) , OS_SWTMR_ROUSES_ALLOW, OS_SWTMR_ALIGN_INSENSITIVE #endif diff --git a/testsuites/sample/kernel/task/It_los_task_054.c b/testsuites/sample/kernel/task/It_los_task_054.c index 7417125b..b49dbd1d 100644 --- a/testsuites/sample/kernel/task/It_los_task_054.c +++ b/testsuites/sample/kernel/task/It_los_task_054.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. + * Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: @@ -71,7 +71,7 @@ static VOID TaskF01(VOID) #ifdef __RISC_V__ ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, HwiF01, 0); #else - ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, HwiF01, 1); + ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, HwiF01, (HwiIrqParam *)1); #endif ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret); diff --git a/testsuites/sample/posix/pthread_func_test.c b/testsuites/sample/posix/pthread_func_test.c index 3c674a34..ba112acb 100644 --- a/testsuites/sample/posix/pthread_func_test.c +++ b/testsuites/sample/posix/pthread_func_test.c @@ -31,7 +31,9 @@ #include #include "osTest.h" #include "pthread.h" +#include "time.h" +#undef TASK_PRIO_TEST #define TASK_PRIO_TEST LOSCFG_BASE_CORE_TSK_DEFAULT_PRIO #define OS_TSK_TEST_STACK_SIZE 0x1000 #define PTHREAD_TASK_DELAY 10 @@ -582,10 +584,10 @@ LITE_TEST_CASE(PthreadFuncTestSuite, TestPthread008, Function | MediumTest | Lev int result = 0; UINT32 ret; - ret = pthread_key_create(&g_pthreadKey1, pthreadKeyFree); + ret = pthread_key_create((pthread_key_t *)&g_pthreadKey1, pthreadKeyFree); ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = pthread_key_create(&g_pthreadKey2, pthreadKeyFree); + ret = pthread_key_create((pthread_key_t *)&g_pthreadKey2, pthreadKeyFree); ICUNIT_ASSERT_EQUAL(ret, 0, ret); ret = pthread_attr_init(&attr); @@ -657,7 +659,7 @@ LITE_TEST_CASE(PthreadFuncTestSuite, TestPthread009, Function | MediumTest | Lev ICUNIT_ASSERT_EQUAL(ret, 0, ret); for (i = 0; i < TEST_THREAD_COUNT; i++) { - ret = pthread_create(&thread[i], &attr, PthreadPrioFunc01, TEST_THREAD_COUNT - i); + ret = pthread_create(&thread[i], &attr, PthreadPrioFunc01, (void *)(TEST_THREAD_COUNT - i)); ICUNIT_ASSERT_EQUAL(ret, 0, ret); } diff --git a/testsuites/unittest/posix/BUILD.gn b/testsuites/unittest/posix/BUILD.gn index 8bf3003f..0c2f8f4b 100644 --- a/testsuites/unittest/posix/BUILD.gn +++ b/testsuites/unittest/posix/BUILD.gn @@ -1,5 +1,5 @@ # Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. -# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: @@ -27,6 +27,7 @@ # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +import("//kernel/liteos_m/liteos.gni") import("//test/xts/tools/lite/build/suite_lite.gni") static_library("posix_test") { @@ -65,6 +66,11 @@ static_library("posix_test") { "src", ] - cflags = [ "-Wno-error" ] + if (!defined(LOSCFG_COMPILER_ICCARM)) { + cflags = [ "-Wno-error" ] + } else { + cflags = [ "--no_warnings" ] + } + configs += [ "//kernel/liteos_m/testsuites:include" ] } 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 124dc2db..66021747 100644 --- a/testsuites/unittest/posix/src/fs/posix_fs_func_test.c +++ b/testsuites/unittest/posix/src/fs/posix_fs_func_test.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. + * Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: @@ -43,7 +43,8 @@ #include "log.h" #include #include -#include "sys/stat.h" +#include +#include /* * * @tc.desc : register a test suite, this suite is used to test basic flow and interface dependency @@ -1074,7 +1075,7 @@ LITE_TEST_CASE(PosixFsFuncTestSuite, testFsFreadFwrite003, Function | MediumTest fp = fopen(TEST_FILE_PTAH_RIGHT, "r"); TEST_ASSERT_NOT_NULL(fp); - ret = fread(chr1, strlen(chr1) + 1, 1, fp); + ret = fread((void *)chr1, strlen(chr1) + 1, 1, fp); TEST_ASSERT_TRUE(ret != -1); ret = fclose(fp); diff --git a/testsuites/unittest/posix/src/posix_test.h b/testsuites/unittest/posix/src/posix_test.h index 7434aca1..07a90f1a 100644 --- a/testsuites/unittest/posix/src/posix_test.h +++ b/testsuites/unittest/posix/src/posix_test.h @@ -44,7 +44,9 @@ #define Function 0 #define MediumTest 0 #define Level1 0 +#define LITE_TEST_SUIT(subsystem, module, testsuit) #define LITE_TEST_CASE(module, function, flag) static int function(void) +#define RUN_TEST_SUITE(testsuit) #define TEST_ASSERT_EQUAL(expected, actual) ICUNIT_ASSERT_EQUAL(expected, actual, actual) #define TEST_ASSERT_EQUAL_INT(expected, actual) TEST_ASSERT_EQUAL(expected, actual) diff --git a/testsuites/unittest/posix/src/string/string_func_test_03.c b/testsuites/unittest/posix/src/string/string_func_test_03.c index 85f0d5d4..7d135459 100644 --- a/testsuites/unittest/posix/src/string/string_func_test_03.c +++ b/testsuites/unittest/posix/src/string/string_func_test_03.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. + * Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: @@ -211,6 +211,7 @@ LITE_TEST_CASE(PosixStringFuncTestSuite, testStrStrcspn002, Function | MediumTes return 0; }; +#ifndef LOSCFG_COMPILER_ICCARM /* * * @tc.number : SUB_KERNEL_POSIX_strptime_OPERATION_001 * @tc.name : Memony operation for strptime test @@ -229,6 +230,7 @@ LITE_TEST_CASE(PosixStringFuncTestSuite, testStrStrptime001, Function | MediumTe TEST_ASSERT_EQUAL_INT(tmData.tm_min, 24); return 0; } +#endif RUN_TEST_SUITE(PosixStringFuncTestSuite); @@ -243,7 +245,9 @@ void PosixStringFuncTest03() RUN_ONE_TESTCASE(testStrStrdup002); RUN_ONE_TESTCASE(testStrStrcspn001); RUN_ONE_TESTCASE(testStrStrcspn002); +#ifndef LOSCFG_COMPILER_ICCARM RUN_ONE_TESTCASE(testStrStrptime001); +#endif return; } \ No newline at end of file