提交 6eca25ea 编写于 作者: O openharmony_ci 提交者: Gitee

!1112 【communication_lite】延时接口函数 osDelay()修改为sleep()

Merge pull request !1112 from wkejing/master
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
#define LWIP_TEST_FAIL (-1) #define LWIP_TEST_FAIL (-1)
#define DEF_TASK_STACK 2000 #define DEF_TASK_STACK 2000
#define DEF_TASK_PRIORITY 20 #define DEF_TASK_PRIORITY 20
#define ONE_SECOND 100 #define ONE_SECOND 1
#define TIMEOUT 4 #define TIMEOUT 4
#define TEST_FD_COUNT 10 #define TEST_FD_COUNT 10
...@@ -56,7 +56,7 @@ static int g_selectTimeout = 2; ...@@ -56,7 +56,7 @@ static int g_selectTimeout = 2;
static void WaitClient(void) static void WaitClient(void)
{ {
while (1) { while (1) {
osDelay(ONE_SECOND); sleep(ONE_SECOND);
if (g_clientWait) { if (g_clientWait) {
break; break;
} }
...@@ -68,7 +68,7 @@ static void WaitClient(void) ...@@ -68,7 +68,7 @@ static void WaitClient(void)
static void WaitServer(void) static void WaitServer(void)
{ {
while (1) { while (1) {
osDelay(ONE_SECOND); sleep(ONE_SECOND);
if (g_serverWait) { if (g_serverWait) {
break; break;
} }
...@@ -134,7 +134,7 @@ static void CommTcpClientTask(void) ...@@ -134,7 +134,7 @@ static void CommTcpClientTask(void)
char sendMsgList[5][50] = {"Hi, I'm client,FD:[%d]", "client:123456789abcdefg,FD:[%d]", char sendMsgList[5][50] = {"Hi, I'm client,FD:[%d]", "client:123456789abcdefg,FD:[%d]",
"client:!!@@##$$%%^^&&**(()),FD:[%d]", "client:(((112233445566778899))),FD:[%d]", "bye"}; "client:!!@@##$$%%^^&&**(()),FD:[%d]", "client:(((112233445566778899))),FD:[%d]", "bye"};
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
osDelay(ONE_SECOND); sleep(ONE_SECOND);
memset_s(dataBuf, sizeof(dataBuf), 0, sizeof(dataBuf)); memset_s(dataBuf, sizeof(dataBuf), 0, sizeof(dataBuf));
rst = sprintf_s(dataBuf, sizeof(dataBuf), sendMsgList[i], clnFd); rst = sprintf_s(dataBuf, sizeof(dataBuf), sendMsgList[i], clnFd);
if (rst < 0) { if (rst < 0) {
...@@ -499,7 +499,7 @@ LITE_TEST_CASE(LwipFuncTestSuite, testTcp, Function | MediumTest | Level2) ...@@ -499,7 +499,7 @@ LITE_TEST_CASE(LwipFuncTestSuite, testTcp, Function | MediumTest | Level2)
printf("[testTcp]create client task fail!\n"); printf("[testTcp]create client task fail!\n");
} }
osDelay(ONE_SECOND); sleep(ONE_SECOND);
int timeout = TIMEOUT; int timeout = TIMEOUT;
g_serverWait = 1; g_serverWait = 1;
g_clientWait = 1; g_clientWait = 1;
...@@ -509,11 +509,11 @@ LITE_TEST_CASE(LwipFuncTestSuite, testTcp, Function | MediumTest | Level2) ...@@ -509,11 +509,11 @@ LITE_TEST_CASE(LwipFuncTestSuite, testTcp, Function | MediumTest | Level2)
break; break;
} }
timeout--; timeout--;
osDelay(ONE_SECOND); sleep(ONE_SECOND);
printf("[testTcp] wait[1]...\n"); printf("[testTcp] wait[1]...\n");
} }
osDelay(ONE_SECOND); sleep(ONE_SECOND);
timeout = TIMEOUT; timeout = TIMEOUT;
g_serverWait = 1; g_serverWait = 1;
g_clientWait = 1; g_clientWait = 1;
...@@ -523,11 +523,11 @@ LITE_TEST_CASE(LwipFuncTestSuite, testTcp, Function | MediumTest | Level2) ...@@ -523,11 +523,11 @@ LITE_TEST_CASE(LwipFuncTestSuite, testTcp, Function | MediumTest | Level2)
break; break;
} }
timeout--; timeout--;
osDelay(ONE_SECOND); sleep(ONE_SECOND);
printf("[testTcp] wait[2]...\n"); printf("[testTcp] wait[2]...\n");
} }
osDelay(ONE_SECOND); sleep(ONE_SECOND);
timeout = TIMEOUT; timeout = TIMEOUT;
g_serverWait = 1; g_serverWait = 1;
g_clientWait = 1; g_clientWait = 1;
...@@ -537,10 +537,10 @@ LITE_TEST_CASE(LwipFuncTestSuite, testTcp, Function | MediumTest | Level2) ...@@ -537,10 +537,10 @@ LITE_TEST_CASE(LwipFuncTestSuite, testTcp, Function | MediumTest | Level2)
break; break;
} }
timeout--; timeout--;
osDelay(ONE_SECOND); sleep(ONE_SECOND);
printf("[testTcp] wait[3]...\n"); printf("[testTcp] wait[3]...\n");
} }
osDelay(ONE_SECOND); sleep(ONE_SECOND);
timeout = TIMEOUT; timeout = TIMEOUT;
g_serverWait = 1; g_serverWait = 1;
g_clientWait = 1; g_clientWait = 1;
...@@ -550,13 +550,13 @@ LITE_TEST_CASE(LwipFuncTestSuite, testTcp, Function | MediumTest | Level2) ...@@ -550,13 +550,13 @@ LITE_TEST_CASE(LwipFuncTestSuite, testTcp, Function | MediumTest | Level2)
break; break;
} }
timeout--; timeout--;
osDelay(ONE_SECOND); sleep(ONE_SECOND);
printf("[testTcp] wait[4]...\n"); printf("[testTcp] wait[4]...\n");
} }
TEST_ASSERT_EQUAL_INT(1, g_clientResult); TEST_ASSERT_EQUAL_INT(1, g_clientResult);
TEST_ASSERT_EQUAL_INT(1, g_serverResult); TEST_ASSERT_EQUAL_INT(1, g_serverResult);
osDelay(ONE_SECOND); sleep(ONE_SECOND);
g_serverWait = 1; g_serverWait = 1;
g_clientWait = 1; g_clientWait = 1;
} }
...@@ -642,7 +642,7 @@ LITE_TEST_CASE(LwipFuncTestSuite, testSelectTimeout, Function | MediumTest | Lev ...@@ -642,7 +642,7 @@ LITE_TEST_CASE(LwipFuncTestSuite, testSelectTimeout, Function | MediumTest | Lev
printf("create select server task fail!\n"); printf("create select server task fail!\n");
} else { } else {
while (g_selectFlag) { while (g_selectFlag) {
osDelay(ONE_SECOND); sleep(ONE_SECOND);
printf("wait select server finish...\n"); printf("wait select server finish...\n");
} }
TEST_ASSERT_EQUAL_INT(-2, g_selectResult); TEST_ASSERT_EQUAL_INT(-2, g_selectResult);
...@@ -668,7 +668,7 @@ LITE_TEST_CASE(LwipFuncTestSuite, testSelectOneClient, Function | MediumTest | L ...@@ -668,7 +668,7 @@ LITE_TEST_CASE(LwipFuncTestSuite, testSelectOneClient, Function | MediumTest | L
g_selectTimeout = 5; g_selectTimeout = 5;
osThreadId_t serverTaskId = osThreadNew((osThreadFunc_t)SelectServerTask, NULL, &tSelect); osThreadId_t serverTaskId = osThreadNew((osThreadFunc_t)SelectServerTask, NULL, &tSelect);
TEST_ASSERT_NOT_NULL(serverTaskId); TEST_ASSERT_NOT_NULL(serverTaskId);
osDelay(ONE_SECOND); sleep(ONE_SECOND);
if (serverTaskId == NULL) { if (serverTaskId == NULL) {
printf("create select server task fail!\n"); printf("create select server task fail!\n");
} else { } else {
...@@ -687,7 +687,7 @@ LITE_TEST_CASE(LwipFuncTestSuite, testSelectOneClient, Function | MediumTest | L ...@@ -687,7 +687,7 @@ LITE_TEST_CASE(LwipFuncTestSuite, testSelectOneClient, Function | MediumTest | L
g_selectFlag = 1; g_selectFlag = 1;
while (g_selectFlag) { while (g_selectFlag) {
osDelay(ONE_SECOND); sleep(ONE_SECOND);
printf("wait select server finish...\n"); printf("wait select server finish...\n");
} }
TEST_ASSERT_EQUAL_INT(0, g_selectResult); TEST_ASSERT_EQUAL_INT(0, g_selectResult);
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#include <unistd.h> #include <unistd.h>
#define DEF_TIMEOUT 15 #define DEF_TIMEOUT 15
#define ONE_SECOND 100 #define ONE_SECOND 1
#define LEVEL_ERROR (-1) #define LEVEL_ERROR (-1)
#define LEVEL_ONE 1 #define LEVEL_ONE 1
#define LEVEL_TWO 2 #define LEVEL_TWO 2
...@@ -185,7 +185,7 @@ static void WaitScanResult(void) ...@@ -185,7 +185,7 @@ static void WaitScanResult(void)
{ {
int scanTimeout = DEF_TIMEOUT; int scanTimeout = DEF_TIMEOUT;
while (scanTimeout > 0) { while (scanTimeout > 0) {
osDelay(ONE_SECOND); sleep(ONE_SECOND);
scanTimeout--; scanTimeout--;
if (g_staScanSuccess == 1) { if (g_staScanSuccess == 1) {
printf("WaitScanResult:wait success[%d]s\n", (DEF_TIMEOUT - scanTimeout)); printf("WaitScanResult:wait success[%d]s\n", (DEF_TIMEOUT - scanTimeout));
...@@ -522,7 +522,7 @@ LITE_TEST_CASE(WifiServiceFuncTestSuite, testEnableDisableHotSpot, Function | Me ...@@ -522,7 +522,7 @@ LITE_TEST_CASE(WifiServiceFuncTestSuite, testEnableDisableHotSpot, Function | Me
int timeout = 3; int timeout = 3;
g_apEnableSuccess = 0; g_apEnableSuccess = 0;
while (timeout > 0) { while (timeout > 0) {
osDelay(ONE_SECOND); sleep(ONE_SECOND);
timeout--; timeout--;
if (g_apEnableSuccess >= 1) { if (g_apEnableSuccess >= 1) {
printf("Wait %d seconds.\n", (DEF_TIMEOUT - timeout)); printf("Wait %d seconds.\n", (DEF_TIMEOUT - timeout));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册