diff --git a/testsuites/sample/kernel/queue/It_los_queue_static_005.c b/testsuites/sample/kernel/queue/It_los_queue_static_005.c index 1b4e47dc..143cb254 100644 --- a/testsuites/sample/kernel/queue/It_los_queue_static_005.c +++ b/testsuites/sample/kernel/queue/It_los_queue_static_005.c @@ -42,7 +42,7 @@ static UINT32 Testcase(VOID) g_testQueueID01 = LOSCFG_BASE_IPC_QUEUE_LIMIT - 1; - ret = LOS_QueueCreateStatic("Q1", QUEUE_OVERSIZE_NUM, &g_testQueueID01, buff3, 0, 0xFFFF); + ret = LOS_QueueCreateStatic("Q1", QUEUE_OVERSIZE_NUM, &g_testQueueID01, (UINT8 *)buff3, 0, 0xFFFF); ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_QUEUE_SIZE_TOO_BIG, ret, EXIT); ret = LOS_QueueWrite(g_testQueueID01, &buff1, QUEUE_BASE_MSGSIZE, 0); diff --git a/testsuites/sample/kernel/swtmr/It_los_swtmr_Delay_001.c b/testsuites/sample/kernel/swtmr/It_los_swtmr_Delay_001.c index 93c9a4ae..67ba6712 100644 --- a/testsuites/sample/kernel/swtmr/It_los_swtmr_Delay_001.c +++ b/testsuites/sample/kernel/swtmr/It_los_swtmr_Delay_001.c @@ -62,10 +62,10 @@ static UINT32 Testcase(VOID) OS_SWTMR_ROUSES_IGNORE, OS_SWTMR_ALIGN_SENSITIVE #endif ); + id2 = swtmrId1; ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT); - id2 = swtmrId1; ICUNIT_GOTO_NOT_EQUAL(id1, id2, swtmrId1, EXIT); ret = LOS_SwtmrDelete(id1); diff --git a/testsuites/sample/kernel/swtmr/It_los_swtmr_Delay_003.c b/testsuites/sample/kernel/swtmr/It_los_swtmr_Delay_003.c index 7d352e1e..81cef459 100644 --- a/testsuites/sample/kernel/swtmr/It_los_swtmr_Delay_003.c +++ b/testsuites/sample/kernel/swtmr/It_los_swtmr_Delay_003.c @@ -69,7 +69,7 @@ static UINT32 Testcase(VOID) ); ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT); id2 = swtmrId1; - ICUNIT_GOTO_NOT_EQUAL(id1, id2, swtmrId1, EXIT); + ICUNIT_GOTO_NOT_EQUAL(id1, id2, swtmrId1, EXIT1); ret = LOS_SwtmrDelete(id1); ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT); @@ -78,9 +78,10 @@ static UINT32 Testcase(VOID) ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret); return LOS_OK; +EXIT1: + LOS_SwtmrDelete(id2); EXIT: LOS_SwtmrDelete(id1); - LOS_SwtmrDelete(id2); return LOS_OK; } diff --git a/testsuites/sample/posix/mqueue/It_posix_queue.h b/testsuites/sample/posix/mqueue/It_posix_queue.h index 273c0224..81fc26f2 100644 --- a/testsuites/sample/posix/mqueue/It_posix_queue.h +++ b/testsuites/sample/posix/mqueue/It_posix_queue.h @@ -30,6 +30,8 @@ #ifndef IT_POSIX_QUEUE_H #define IT_POSIX_QUEUE_H +#undef _XOPEN_SOURCE +#define _XOPEN_SOURCE 600 #include #include @@ -40,6 +42,7 @@ #include #include #include "pthread.h" +#include "unistd.h" #define MAXMSG5 5 #define MSGLEN 10 diff --git a/testsuites/sample/posix/mqueue/It_posix_queue_001.c b/testsuites/sample/posix/mqueue/It_posix_queue_001.c index 4f1a7cdf..74b4e868 100644 --- a/testsuites/sample/posix/mqueue/It_posix_queue_001.c +++ b/testsuites/sample/posix/mqueue/It_posix_queue_001.c @@ -58,7 +58,6 @@ static UINT32 Testcase(VOID) return LOS_OK; EXIT1: mq_close(mqueue); -EXIT: mq_unlink(mqname); return LOS_OK; } diff --git a/testsuites/sample/posix/mqueue/It_posix_queue_003.c b/testsuites/sample/posix/mqueue/It_posix_queue_003.c index 63aeacbe..8447d256 100644 --- a/testsuites/sample/posix/mqueue/It_posix_queue_003.c +++ b/testsuites/sample/posix/mqueue/It_posix_queue_003.c @@ -35,9 +35,6 @@ static UINT32 Testcase(VOID) CHAR msgrv1[MQUEUE_STANDARD_NAME_LENGTH] = {0}; struct mq_attr attr = {0}; INT32 ret = 0; - INT32 i; - pthread_t pthread1; - pthread_t pthread2; mqd_t mqueue1; mqd_t mqueue2; struct timespec ts; @@ -59,7 +56,6 @@ static UINT32 Testcase(VOID) ret = mq_timedreceive(mqueue1, msgrv1, MQUEUE_STANDARD_NAME_LENGTH, NULL, &ts); ICUNIT_ASSERT_EQUAL(ret, -1, ret); -EXIT: mq_close(mqueue1); mq_close(mqueue2); mq_unlink(mqname); diff --git a/testsuites/sample/posix/mqueue/It_posix_queue_013.c b/testsuites/sample/posix/mqueue/It_posix_queue_013.c index c8699537..a93b7b56 100644 --- a/testsuites/sample/posix/mqueue/It_posix_queue_013.c +++ b/testsuites/sample/posix/mqueue/It_posix_queue_013.c @@ -34,8 +34,6 @@ static UINT32 Testcase(VOID) INT32 ret; CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; mqd_t mqueue; - struct sigevent ev; - struct sigaction act; ret = snprintf_s(mqname, MQUEUE_STANDARD_NAME_LENGTH, MQUEUE_STANDARD_NAME_LENGTH - 1, "/mq013_%d", LOS_CurTaskIDGet()); diff --git a/testsuites/sample/posix/mqueue/It_posix_queue_021.c b/testsuites/sample/posix/mqueue/It_posix_queue_021.c index 8c819eb2..5b124169 100644 --- a/testsuites/sample/posix/mqueue/It_posix_queue_021.c +++ b/testsuites/sample/posix/mqueue/It_posix_queue_021.c @@ -34,7 +34,6 @@ static UINT32 Testcase(VOID) INT32 ret; CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = {0}; mqd_t mqueue; - struct sigevent se; ret = snprintf_s(mqname, MQUEUE_STANDARD_NAME_LENGTH, MQUEUE_STANDARD_NAME_LENGTH - 1, "/mq021_%d", LOS_CurTaskIDGet()); diff --git a/testsuites/sample/posix/mqueue/It_posix_queue_025.c b/testsuites/sample/posix/mqueue/It_posix_queue_025.c index 5eca0def..2fbcedd2 100644 --- a/testsuites/sample/posix/mqueue/It_posix_queue_025.c +++ b/testsuites/sample/posix/mqueue/It_posix_queue_025.c @@ -55,7 +55,7 @@ EXIT: static VOID *PthreadF02(VOID *argument) { - INT32 j, ret; + INT32 ret; CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = ""; @@ -82,8 +82,6 @@ static UINT32 Testcase(VOID) { pthread_t newTh1, newTh2; UINT32 ret; - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = ""; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; struct mq_attr attr = {0}; pthread_attr_t attr1; diff --git a/testsuites/sample/posix/mqueue/It_posix_queue_036.c b/testsuites/sample/posix/mqueue/It_posix_queue_036.c index 76235e33..b7538d34 100644 --- a/testsuites/sample/posix/mqueue/It_posix_queue_036.c +++ b/testsuites/sample/posix/mqueue/It_posix_queue_036.c @@ -36,7 +36,7 @@ static VOID *PthreadF01(VOID *argument) g_testCount = 1; - TestAssertWaitDelay(&g_testCount, 3); // 3, Here, assert the g_testCount. + TestAssertWaitDelay((UINT32 *)&g_testCount, 3); // 3, Here, assert the g_testCount. ret = mq_send(g_gqueue, msgptr, strlen(msgptr), 0); ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); @@ -104,7 +104,7 @@ static UINT32 Testcase(VOID) ret = pthread_create(&newTh1, &attr1, PthreadF01, NULL); ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - TestAssertWaitDelay(&g_testCount, 1); + TestAssertWaitDelay((UINT32 *)&g_testCount, 1); ret = PosixPthreadInit(&attr1, MQUEUE_PTHREAD_PRIORITY_TEST2); ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); @@ -115,7 +115,7 @@ static UINT32 Testcase(VOID) ret = MqueueTaskDelay(10); // 10, Set delay time. ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - TestAssertWaitDelay(&g_testCount, 4); // 4, Here, assert the g_testCount. + TestAssertWaitDelay((UINT32 *)&g_testCount, 4); // 4, Here, assert the g_testCount. ret = PosixPthreadDestroy(&attr1, newTh2); ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); diff --git a/testsuites/sample/posix/mutex/It_posix_mutex_017.c b/testsuites/sample/posix/mutex/It_posix_mutex_017.c index aa626262..a7ab40b5 100644 --- a/testsuites/sample/posix/mutex/It_posix_mutex_017.c +++ b/testsuites/sample/posix/mutex/It_posix_mutex_017.c @@ -37,7 +37,7 @@ static UINT32 Testcase(VOID) pthread_mutex_t mutex = TEST_MUTEX_INIT; sem_t sem; - int pshared; + int pshared = 0; ret = pthread_mutexattr_init(&mta); ICUNIT_ASSERT_EQUAL(ret, 0, ret); diff --git a/testsuites/sample/posix/mutex/It_posix_mutex_036.c b/testsuites/sample/posix/mutex/It_posix_mutex_036.c index c0e538a7..58d01ce2 100644 --- a/testsuites/sample/posix/mutex/It_posix_mutex_036.c +++ b/testsuites/sample/posix/mutex/It_posix_mutex_036.c @@ -33,7 +33,7 @@ #define THREAD_NUM 5 #define LOOPS 4 -static g_value; +static int g_value; static pthread_mutex_t g_mutex036 = PTHREAD_MUTEX_INITIALIZER; /* pthread_mutex_lock 1-1.c diff --git a/testsuites/sample/posix/mutex/It_posix_mutex_038.c b/testsuites/sample/posix/mutex/It_posix_mutex_038.c index 74dc3aaf..37540215 100644 --- a/testsuites/sample/posix/mutex/It_posix_mutex_038.c +++ b/testsuites/sample/posix/mutex/It_posix_mutex_038.c @@ -28,13 +28,17 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#undef _XOPEN_SOURCE +#define _XOPEN_SOURCE 600 + #include "It_posix_mutex.h" +#include "unistd.h" #define THREAD_NUM 6 #define LOOPS 3 static pthread_mutex_t g_mutex040 = PTHREAD_MUTEX_INITIALIZER; -static g_value; +static int g_value; static void *TaskF01(void *parm) { diff --git a/testsuites/sample/posix/pthread/It_posix_pthread.c b/testsuites/sample/posix/pthread/It_posix_pthread.c index db88d229..a6427461 100644 --- a/testsuites/sample/posix/pthread/It_posix_pthread.c +++ b/testsuites/sample/posix/pthread/It_posix_pthread.c @@ -38,7 +38,7 @@ pthread_t TestPthreadSelf(void) { pthread_t tid = pthread_self(); if (tid == 0) { - tid = ((LosTaskCB *)(OsCurrTaskGet()))->taskID; + tid = (pthread_t)(((LosTaskCB *)(OsCurrTaskGet()))->taskID); } return tid; } diff --git a/testsuites/sample/posix/pthread_func_test.c b/testsuites/sample/posix/pthread_func_test.c index 676a528a..3a1cf958 100644 --- a/testsuites/sample/posix/pthread_func_test.c +++ b/testsuites/sample/posix/pthread_func_test.c @@ -28,6 +28,9 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#undef _XOPEN_SOURCE +#define _XOPEN_SOURCE 600 + #include #include "osTest.h" #include "pthread.h" diff --git a/testsuites/unittest/posix/src/errno/strerror_test.c b/testsuites/unittest/posix/src/errno/strerror_test.c index 718b216d..ca3ae043 100644 --- a/testsuites/unittest/posix/src/errno/strerror_test.c +++ b/testsuites/unittest/posix/src/errno/strerror_test.c @@ -95,7 +95,8 @@ LITE_TEST_CASE(PosixSysFuncTestSuite, testOsSysStrerror001, Function | MediumTes LOG("strerror(10) = %s\n", strerror(10)); TEST_ASSERT_EQUAL_STRING("No children", strerror(10)); #endif - + + return LOS_OK; }; RUN_TEST_SUITE(PosixSysFuncTestSuite); diff --git a/testsuites/unittest/posix/src/posix_test.h b/testsuites/unittest/posix/src/posix_test.h index eea1cc7e..d66e1592 100644 --- a/testsuites/unittest/posix/src/posix_test.h +++ b/testsuites/unittest/posix/src/posix_test.h @@ -85,6 +85,7 @@ extern void PosixIslowerFuncTest(void); extern void PosixIsxdigitFuncTest(void); extern void PosixTolowerFuncTest(void); extern void PosixToupperFuncTest(void); +extern void ItSuitePosixMqueue(void); extern void PosixStrerrorTest(void); diff --git a/testsuites/unittest/posix/src/stdlib/atoll_test.c b/testsuites/unittest/posix/src/stdlib/atoll_test.c index 080bd0c3..a87b02c1 100644 --- a/testsuites/unittest/posix/src/stdlib/atoll_test.c +++ b/testsuites/unittest/posix/src/stdlib/atoll_test.c @@ -91,12 +91,12 @@ LITE_TEST_CASE(PosixStdlibAtollTest, testStdlibAtoll001, Function | MediumTest | LITE_TEST_CASE(PosixStdlibAtollTest, testStdlibAtoll002, Function | MediumTest | Level1) { long long value = atoll("-9223372036854775808"); - if (value == -9223372036854775808LL) { + if (value == -9223372036854775808ULL) { LOG("[DEMO] posix stdlib test case 2:atoll(%lld) ok.\n", value); } else { LOG("[DEMO] posix stdlib test case 2:atoll(%lld) fail.\n", value); } - TEST_ASSERT_TRUE(value == -9223372036854775808LL); + TEST_ASSERT_TRUE(value == -9223372036854775808ULL); return 0; } @@ -126,7 +126,7 @@ LITE_TEST_CASE(PosixStdlibAtollTest, testStdlibAtoll003, Function | MediumTest | LITE_TEST_CASE(PosixStdlibAtollTest, testStdlibAtoll004, Function | MediumTest | Level1) { long long value = atoll("9223372036854775808"); - if (value == -9223372036854775808LL) { + if (value == -9223372036854775808ULL) { LOG("[DEMO] posix stdlib test case 4(except):atoll(%lld) != 9223372036854775808 ok.\n", value); } else { LOG("[DEMO] posix stdlib test case 4(except):atoll(%lld) fail.\n", value); diff --git a/testsuites/unittest/posix/src/string/string_func_test_01.c b/testsuites/unittest/posix/src/string/string_func_test_01.c index e9ec2f70..0e69a53b 100644 --- a/testsuites/unittest/posix/src/string/string_func_test_01.c +++ b/testsuites/unittest/posix/src/string/string_func_test_01.c @@ -29,6 +29,8 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#define _GNU_SOURCE + #include "posix_test.h" #include "los_config.h" #include "kernel_test.h" diff --git a/testsuites/unittest/posix/src/string/string_func_test_02.c b/testsuites/unittest/posix/src/string/string_func_test_02.c index 31800f3b..51718e98 100644 --- a/testsuites/unittest/posix/src/string/string_func_test_02.c +++ b/testsuites/unittest/posix/src/string/string_func_test_02.c @@ -29,6 +29,8 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#define _GNU_SOURCE + #include "ohos_types.h" #include "posix_test.h" #include "los_config.h" 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 57baa537..a578c1eb 100644 --- a/testsuites/unittest/posix/src/time/time_func_test_01.c +++ b/testsuites/unittest/posix/src/time/time_func_test_01.c @@ -30,6 +30,9 @@ */ #define _GNU_SOURCE +#undef _XOPEN_SOURCE +#define _XOPEN_SOURCE 600 + #include #include #include