From 8a00c2b5068145d72d60f789c4c7a2521816f535 Mon Sep 17 00:00:00 2001 From: luozhewen Date: Thu, 22 Jul 2021 03:51:05 +0000 Subject: [PATCH] =?UTF-8?q?communication=5Flite:=E5=BC=80=E6=BA=90?= =?UTF-8?q?=E7=A4=BE=E5=8C=BA=E5=91=8A=E8=AD=A6=E6=B8=85=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: luozhewen --- .../lwip_hal/src/lwip_func_test.c | 29 +++++++++---------- .../lwip_posix/src/ActsLwipTest.cpp | 2 +- .../src/wifiservice_func_test.c | 6 ++-- 3 files changed, 18 insertions(+), 19 deletions(-) diff --git a/communication_lite/lwip_hal/src/lwip_func_test.c b/communication_lite/lwip_hal/src/lwip_func_test.c index 2fc4ea2f3..f5ff2465b 100755 --- a/communication_lite/lwip_hal/src/lwip_func_test.c +++ b/communication_lite/lwip_hal/src/lwip_func_test.c @@ -38,7 +38,7 @@ #define LWIP_TEST_FAIL (-1) #define DEF_TASK_STACK 2000 #define DEF_TASK_PRIORITY 20 -#define ONE_SECOND 1 +#define ONE_SECOND 100 #define TIMEOUT 4 #define TEST_FD_COUNT 10 @@ -56,7 +56,7 @@ static int g_selectTimeout = 2; static void WaitClient(void) { while (1) { - sleep(ONE_SECOND); + osDelay(ONE_SECOND); if (g_clientWait) { break; } @@ -68,7 +68,7 @@ static void WaitClient(void) static void WaitServer(void) { while (1) { - sleep(ONE_SECOND); + osDelay(ONE_SECOND); if (g_serverWait) { break; } @@ -129,13 +129,12 @@ static void CommTcpClientTask(void) lwip_close(clnFd); return; } - int sleepSecond = 1; int count = 4; char dataBuf[50] = {0}; char sendMsgList[5][50] = {"Hi, I'm client,FD:[%d]", "client:123456789abcdefg,FD:[%d]", "client:!!@@##$$%%^^&&**(()),FD:[%d]", "client:(((112233445566778899))),FD:[%d]", "bye"}; for (int i = 0; i < count; i++) { - sleep(sleepSecond); + osDelay(ONE_SECOND); memset_s(dataBuf, sizeof(dataBuf), 0, sizeof(dataBuf)); rst = sprintf_s(dataBuf, sizeof(dataBuf), sendMsgList[i], clnFd); if (rst < 0) { @@ -500,7 +499,7 @@ LITE_TEST_CASE(LwipFuncTestSuite, testTcp, Function | MediumTest | Level2) printf("[testTcp]create client task fail!\n"); } - sleep(ONE_SECOND); + osDelay(ONE_SECOND); int timeout = TIMEOUT; g_serverWait = 1; g_clientWait = 1; @@ -510,11 +509,11 @@ LITE_TEST_CASE(LwipFuncTestSuite, testTcp, Function | MediumTest | Level2) break; } timeout--; - sleep(ONE_SECOND); + osDelay(ONE_SECOND); printf("[testTcp] wait[1]...\n"); } - sleep(ONE_SECOND); + osDelay(ONE_SECOND); timeout = TIMEOUT; g_serverWait = 1; g_clientWait = 1; @@ -524,11 +523,11 @@ LITE_TEST_CASE(LwipFuncTestSuite, testTcp, Function | MediumTest | Level2) break; } timeout--; - sleep(ONE_SECOND); + osDelay(ONE_SECOND); printf("[testTcp] wait[2]...\n"); } - sleep(ONE_SECOND); + osDelay(ONE_SECOND); timeout = TIMEOUT; g_serverWait = 1; g_clientWait = 1; @@ -538,10 +537,10 @@ LITE_TEST_CASE(LwipFuncTestSuite, testTcp, Function | MediumTest | Level2) break; } timeout--; - sleep(ONE_SECOND); + osDelay(ONE_SECOND); printf("[testTcp] wait[3]...\n"); } - sleep(ONE_SECOND); + osDelay(ONE_SECOND); timeout = TIMEOUT; g_serverWait = 1; g_clientWait = 1; @@ -551,7 +550,7 @@ LITE_TEST_CASE(LwipFuncTestSuite, testTcp, Function | MediumTest | Level2) break; } timeout--; - sleep(ONE_SECOND); + osDelay(ONE_SECOND); printf("[testTcp] wait[4]...\n"); } TEST_ASSERT_EQUAL_INT(1, g_clientResult); @@ -639,7 +638,7 @@ LITE_TEST_CASE(LwipFuncTestSuite, testSelectTimeout, Function | MediumTest | Lev printf("create select server task fail!\n"); } else { while (g_selectFlag) { - sleep(ONE_SECOND); + osDelay(ONE_SECOND); printf("wait select server finish...\n"); } TEST_ASSERT_EQUAL_INT(-2, g_selectResult); @@ -685,7 +684,7 @@ LITE_TEST_CASE(LwipFuncTestSuite, testSelectMultiClients, Function | MediumTest g_selectFlag = 1; while (g_selectFlag) { - sleep(ONE_SECOND); + osDelay(ONE_SECOND); printf("wait select server finish...\n"); } TEST_ASSERT_EQUAL_INT(0, g_selectResult); diff --git a/communication_lite/lwip_posix/src/ActsLwipTest.cpp b/communication_lite/lwip_posix/src/ActsLwipTest.cpp index 6c625b672..f31181d7e 100755 --- a/communication_lite/lwip_posix/src/ActsLwipTest.cpp +++ b/communication_lite/lwip_posix/src/ActsLwipTest.cpp @@ -931,7 +931,7 @@ HWTEST_F(ActsLwipTest, testInetNtopIpv4Normal, Function | MediumTest | Level2) inputAddr.s_addr = inputBig[i]; #endif ret = inet_ntop(AF_INET, &inputAddr, rstBuff, sizeof(rstBuff)); - ASSERT_NE(ret, nullptr) << "ErrInfo:inet_ntop NULL [" << expectAddrs[i] << "]"; + ASSERT_NE(ret, nullptr); printf("inet_ntop expect [%s]: ret[%s], buf[%s]\n", expectAddrs[i], ret, rstBuff); EXPECT_STREQ(expectAddrs[i], ret); EXPECT_STREQ(expectAddrs[i], rstBuff); diff --git a/communication_lite/wifiservice_hal/src/wifiservice_func_test.c b/communication_lite/wifiservice_hal/src/wifiservice_func_test.c index d54d9ba4b..46af8e7d5 100755 --- a/communication_lite/wifiservice_hal/src/wifiservice_func_test.c +++ b/communication_lite/wifiservice_hal/src/wifiservice_func_test.c @@ -21,7 +21,7 @@ #include #define DEF_TIMEOUT 15 -#define ONE_SECOND 1 +#define ONE_SECOND 100 #define LEVEL_ERROR (-1) #define LEVEL_ONE 1 #define LEVEL_TWO 2 @@ -184,7 +184,7 @@ static void WaitScanResult(void) { int scanTimeout = DEF_TIMEOUT; while (scanTimeout > 0) { - sleep(ONE_SECOND); + osDelay(ONE_SECOND); scanTimeout--; if (g_staScanSuccess == 1) { printf("WaitScanResult:wait success[%d]s\n", (DEF_TIMEOUT - scanTimeout)); @@ -520,7 +520,7 @@ LITE_TEST_CASE(WifiServiceFuncTestSuite, testEnableDisableHotSpot, Function | Me int timeout = 3; g_apEnableSuccess = 0; while (timeout > 0) { - sleep(ONE_SECOND); + osDelay(ONE_SECOND); timeout--; if (g_apEnableSuccess >= 1) { printf("Wait %d seconds.\n", (DEF_TIMEOUT - timeout)); -- GitLab