mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-02-06 08:52:21 +08:00
[HUST CSE][example] fix some typo bugs about 'sucess' and others. (#7528)
This commit is contained in:
@@ -72,7 +72,7 @@ static void tcpclient(void *arg)
|
||||
/* 创建一个socket,类型是SOCKET_STREAM,TCP类型 */
|
||||
if ((sock = socket(AF_INET, SOCK_STREAM, 0)) == -1)
|
||||
{
|
||||
/* Failed on creatinf socket */
|
||||
/* Failed on creating socket */
|
||||
/* 创建socket失败 */
|
||||
LOG_E("Create socket error");
|
||||
goto __exit;
|
||||
@@ -87,7 +87,7 @@ static void tcpclient(void *arg)
|
||||
/* 连接到服务端 */
|
||||
if (connect(sock, (struct sockaddr *)&server_addr, sizeof(struct sockaddr)) == -1)
|
||||
{
|
||||
/*Failed on connecting to server*/
|
||||
/* Failed on connecting to server */
|
||||
/* 连接失败 */
|
||||
LOG_E("Connect fail!");
|
||||
goto __exit;
|
||||
@@ -119,14 +119,14 @@ static void tcpclient(void *arg)
|
||||
}
|
||||
else if (bytes_received == 0)
|
||||
{
|
||||
/* Print warning message when recv function return 0 */
|
||||
/* Print warning message when recv function returns 0 */
|
||||
/* 打印recv函数返回值为0的警告信息 */
|
||||
LOG_W("Received warning, recv function return 0.");
|
||||
LOG_W("Received warning, recv function returns 0.");
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Receive data sucessfully and append '\0' at the end of message */
|
||||
/* Receive data successfully and append '\0' at the end of message */
|
||||
/* 有接收到数据,把末端清零 */
|
||||
recv_data[bytes_received] = '\0';
|
||||
|
||||
@@ -156,9 +156,9 @@ static void tcpclient(void *arg)
|
||||
}
|
||||
else if (ret == 0)
|
||||
{
|
||||
/* Print warning message when send function return 0 */
|
||||
/* Print warning message when send function returns 0 */
|
||||
/* 打印send函数返回值为0的警告信息 */
|
||||
LOG_W("Send warning, send function return 0.");
|
||||
LOG_W("Send warning, send function returns 0.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ void tcp_senddata(const char *url, int port, int length)
|
||||
else if (result == 0)
|
||||
{
|
||||
/* 打印send函数返回值为0的警告信息 */
|
||||
rt_kprintf("\n Send warning,send function return 0.\r\n");
|
||||
rt_kprintf("\n Send warning,send function returns 0.\r\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ static void tcpserv(void *arg)
|
||||
/* Accept a request from client and the function is blocking */
|
||||
/* 接受一个客户端连接socket的请求,这个函数调用是阻塞式的 */
|
||||
connected = accept(sock, (struct sockaddr *)&client_addr, &sin_size);
|
||||
/* Return the socket connected sucessfully */
|
||||
/* Return the socket connected successfully */
|
||||
/* 返回的是连接成功的socket */
|
||||
if (connected < 0)
|
||||
{
|
||||
@@ -139,13 +139,13 @@ static void tcpserv(void *arg)
|
||||
}
|
||||
else if (bytes_received == 0)
|
||||
{
|
||||
/* Print warning message when recv function return 0 */
|
||||
/* Print warning message when recv function returns 0 */
|
||||
/* 打印recv函数返回值为0的警告信息 */
|
||||
LOG_W("Received warning, recv function return 0.");
|
||||
LOG_W("Received warning, recv function returns 0.");
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{ /* Receive data sucessfully and append '\0' at the end of message */
|
||||
{ /* Receive data successfully and append '\0' at the end of message */
|
||||
/* 有接收到数据,把末端清零 */
|
||||
recv_data[bytes_received] = '\0';
|
||||
if (strcmp(recv_data, "q") == 0 || strcmp(recv_data, "Q") == 0)
|
||||
@@ -184,9 +184,9 @@ static void tcpserv(void *arg)
|
||||
}
|
||||
else if (ret == 0)
|
||||
{
|
||||
/* Print warning message when send function return 0 */
|
||||
/* Print warning message when send function returns 0 */
|
||||
/* 打印send函数返回值为0的警告信息 */
|
||||
LOG_W("Send warning, send function return 0.");
|
||||
LOG_W("Send warning, send function returns 0.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ static void udpclient(void *arg)
|
||||
/* 创建一个socket,类型是SOCK_DGRAM,UDP类型 */
|
||||
if ((sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1)
|
||||
{
|
||||
/* Failed on creatinf socket */
|
||||
/* Failed on creating socket */
|
||||
LOG_E("Create socket error");
|
||||
return;
|
||||
}
|
||||
@@ -71,7 +71,7 @@ static void udpclient(void *arg)
|
||||
/* 发送数据到服务远端 */
|
||||
sendto(sock, send_data, rt_strlen(send_data), 0,
|
||||
(struct sockaddr *)&server_addr, sizeof(struct sockaddr));
|
||||
/* Thread sllep for 1 second */
|
||||
/* Thread sleep for 1 second */
|
||||
/* 线程休眠一段时间 */
|
||||
rt_thread_mdelay(1000);
|
||||
/* count decrease 1 */
|
||||
|
||||
@@ -107,7 +107,7 @@ static void udpserv(void *paramemter)
|
||||
}
|
||||
else if (bytes_read == 0)
|
||||
{
|
||||
LOG_W("Received warning, recv function return 0.");
|
||||
LOG_W("Received warning, recv function returns 0.");
|
||||
continue;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
## 简介
|
||||
|
||||
为了保证某一部分代码的质量,通常可以通过编写测试用例的方式,验证此代码的功能。为了保证 RT-Thread 相关仓库的代码质量,我们基于 utest 框架搭建了一套简易的自动化测试环境。有兴趣,有精力的小伙伴可以利用这套机制完善自己的代码检查。如果有意愿让社区上更多的小伙伴收益,也可以在提交代码的时候,把对应的测试用例也提交上来。
|
||||
为了保证某一部分代码的质量,通常可以通过编写测试用例的方式,验证此代码的功能。为了保证 RT-Thread 相关仓库的代码质量,我们基于 utest 框架搭建了一套简易的自动化测试环境。有兴趣,有精力的小伙伴可以利用这套机制完善自己的代码检查。如果有意愿让社区上更多的小伙伴受益,也可以在提交代码的时候,把对应的测试用例也提交上来。
|
||||
|
||||
## 目录结构
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
### 1. 编写测试用例
|
||||
|
||||
参考已有的测试用例在 [examples\utest\testcases](./testcases) 目录下添加自己的测试用例。测试用例的编写方法参考文档中心《utest 测试框架》章节。
|
||||
参考已有的测试用例在 [examples\utest\testcases](./testcases) 目录下添加自己的测试用例。测试用例的编写方法参考文档中心[《utest 测试框架》章节](https://www.rt-thread.org/document/site/#/rt-thread-version/rt-thread-standard/programming-manual/utest/utest)。
|
||||
|
||||
### 2. 本地测试
|
||||
|
||||
@@ -70,4 +70,4 @@ CONFIG_RT_USING_MEMHEAP=y
|
||||
- {UTEST: "components/utest", RTT_BSP: "bsp/qemu-vexpress-a9", QEMU_ARCH: "arm", QEMU_MACHINE: "vexpress-a9", CONFIG_FILE: "utest_self/self.conf", SD_FILE: "sd.bin"}
|
||||
```
|
||||
|
||||
3. 向 RT-Thread 主仓库提交合并请求。
|
||||
3. 向 RT-Thread 主仓库提交合并请求。
|
||||
|
||||
@@ -246,7 +246,7 @@ static void scenar_init(void)
|
||||
" PTHREAD_CREATE_JOINABLE");
|
||||
}
|
||||
#if VERBOSE > 4
|
||||
output("Detach state was set sucessfully\n");
|
||||
output("Detach state was set successfully\n");
|
||||
#endif
|
||||
|
||||
/* Sched related attributes */
|
||||
@@ -269,7 +269,7 @@ static void scenar_init(void)
|
||||
UNRESOLVED(ret, "Unable to set inheritsched"
|
||||
" attribute");
|
||||
#if VERBOSE > 4
|
||||
output("inheritsched state was set sucessfully\n");
|
||||
output("inheritsched state was set successfully\n");
|
||||
#endif
|
||||
}
|
||||
#if VERBOSE > 4
|
||||
@@ -292,7 +292,7 @@ static void scenar_init(void)
|
||||
" sched policy");
|
||||
#if VERBOSE > 4
|
||||
if (scenarii[i].schedpolicy)
|
||||
output("Sched policy was set sucessfully\n");
|
||||
output("Sched policy was set successfully\n");
|
||||
else
|
||||
output("Sched policy untouched\n");
|
||||
#endif
|
||||
@@ -323,7 +323,7 @@ static void scenar_init(void)
|
||||
"Failed to set the sched param");
|
||||
|
||||
#if VERBOSE > 4
|
||||
output("Sched param was set sucessfully to %i\n",
|
||||
output("Sched param was set successfully to %i\n",
|
||||
sp.sched_priority);
|
||||
} else {
|
||||
output("Sched param untouched\n");
|
||||
|
||||
@@ -16,7 +16,7 @@ static int fclose_entry(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("fclose sucess \n");
|
||||
printf("fclose success \n");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user