[HUST CSE][example] fix some typo bugs about 'sucess' and others. (#7528)

This commit is contained in:
shandianchengzi 2023-05-18 22:42:44 +08:00 committed by GitHub
parent c349fe68b8
commit a294d7da9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 39 additions and 39 deletions

View File

@ -76,7 +76,7 @@ static void tcpclient(void *arg)
/* 创建一个socket类型是SOCKET_STREAMTCP类型 */ /* 创建一个socket类型是SOCKET_STREAMTCP类型 */
if ((sock = socket(AF_INET, SOCK_STREAM, 0)) == -1) if ((sock = socket(AF_INET, SOCK_STREAM, 0)) == -1)
{ {
/* Failed on creatinf socket */ /* Failed on creating socket */
/* 创建socket失败 */ /* 创建socket失败 */
LOG_E("Create socket error"); LOG_E("Create socket error");
goto __exit; goto __exit;
@ -91,7 +91,7 @@ static void tcpclient(void *arg)
/* 连接到服务端 */ /* 连接到服务端 */
if (connect(sock, (struct sockaddr *)&server_addr, sizeof(struct sockaddr)) == -1) 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!"); LOG_E("Connect fail!");
goto __exit; goto __exit;
@ -123,14 +123,14 @@ static void tcpclient(void *arg)
} }
else if (bytes_received == 0) else if (bytes_received == 0)
{ {
/* Print warning message when recv function return 0 */ /* Print warning message when recv function returns 0 */
/* 打印recv函数返回值为0的警告信息 */ /* 打印recv函数返回值为0的警告信息 */
LOG_W("Received warning, recv function return 0."); LOG_W("Received warning, recv function returns 0.");
continue; continue;
} }
else 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'; recv_data[bytes_received] = '\0';
@ -160,9 +160,9 @@ static void tcpclient(void *arg)
} }
else if (ret == 0) else if (ret == 0)
{ {
/* Print warning message when send function return 0 */ /* Print warning message when send function returns 0 */
/* 打印send函数返回值为0的警告信息 */ /* 打印send函数返回值为0的警告信息 */
LOG_W("Send warning, send function return 0."); LOG_W("Send warning, send function returns 0.");
} }
} }

View File

@ -665,7 +665,7 @@ tcp_process(struct tcp_pcb *pcb)
pcb->nrtx = 0; pcb->nrtx = 0;
} }
/* Call the user specified function to call when sucessfully /* Call the user specified function to call when successfully
* connected. */ * connected. */
TCP_EVENT_CONNECTED(pcb, ERR_OK, err); TCP_EVENT_CONNECTED(pcb, ERR_OK, err);
if (err == ERR_ABRT) { if (err == ERR_ABRT) {

View File

@ -186,7 +186,7 @@ PACK_STRUCT_END
/** Flags used on input processing, not on pcb->flags /** Flags used on input processing, not on pcb->flags
*/ */
#define TF_RESET (u8_t)0x08U /* Connection was reset. */ #define TF_RESET (u8_t)0x08U /* Connection was reset. */
#define TF_CLOSED (u8_t)0x10U /* Connection was sucessfully closed. */ #define TF_CLOSED (u8_t)0x10U /* Connection was successfully closed. */
#define TF_GOT_FIN (u8_t)0x20U /* Connection was closed by the remote end. */ #define TF_GOT_FIN (u8_t)0x20U /* Connection was closed by the remote end. */

View File

@ -148,7 +148,7 @@ void example_publish(mqtt_client_t *client, void *arg)
} }
} }
/* Called when publish is complete either with sucess or failure */ /* Called when publish is complete either with success or failure */
static void mqtt_pub_request_cb(void *arg, err_t result) static void mqtt_pub_request_cb(void *arg, err_t result)
{ {
if(result != ERR_OK) { if(result != ERR_OK) {

View File

@ -148,7 +148,7 @@ void example_publish(mqtt_client_t *client, void *arg)
} }
} }
/* Called when publish is complete either with sucess or failure */ /* Called when publish is complete either with success or failure */
static void mqtt_pub_request_cb(void *arg, err_t result) static void mqtt_pub_request_cb(void *arg, err_t result)
{ {
if(result != ERR_OK) { if(result != ERR_OK) {

View File

@ -605,7 +605,7 @@ void tcpclient(int argc, char**argv)
else if (bytes_received == 0) else if (bytes_received == 0)
{ {
/* Print the recv function returns a warning message with a value of 0 */ /* Print the recv function returns a warning message with a value of 0 */
rt_kprintf("\nReceived warning,recv function return 0.\r\n"); rt_kprintf("\nReceived warning,recv function returns 0.\r\n");
continue; continue;
} }
@ -643,7 +643,7 @@ void tcpclient(int argc, char**argv)
else if (ret == 0) else if (ret == 0)
{ {
/* Print the send function returns a warning message with a value of 0 */ /* Print the send function returns a warning message with a value of 0 */
rt_kprintf("\n Send warning,send function return 0.\r\n"); rt_kprintf("\n Send warning,send function returns 0.\r\n");
} }
} }
return; return;

View File

@ -72,7 +72,7 @@ static void tcpclient(void *arg)
/* 创建一个socket类型是SOCKET_STREAMTCP类型 */ /* 创建一个socket类型是SOCKET_STREAMTCP类型 */
if ((sock = socket(AF_INET, SOCK_STREAM, 0)) == -1) if ((sock = socket(AF_INET, SOCK_STREAM, 0)) == -1)
{ {
/* Failed on creatinf socket */ /* Failed on creating socket */
/* 创建socket失败 */ /* 创建socket失败 */
LOG_E("Create socket error"); LOG_E("Create socket error");
goto __exit; goto __exit;
@ -87,7 +87,7 @@ static void tcpclient(void *arg)
/* 连接到服务端 */ /* 连接到服务端 */
if (connect(sock, (struct sockaddr *)&server_addr, sizeof(struct sockaddr)) == -1) 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!"); LOG_E("Connect fail!");
goto __exit; goto __exit;
@ -119,14 +119,14 @@ static void tcpclient(void *arg)
} }
else if (bytes_received == 0) else if (bytes_received == 0)
{ {
/* Print warning message when recv function return 0 */ /* Print warning message when recv function returns 0 */
/* 打印recv函数返回值为0的警告信息 */ /* 打印recv函数返回值为0的警告信息 */
LOG_W("Received warning, recv function return 0."); LOG_W("Received warning, recv function returns 0.");
continue; continue;
} }
else 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'; recv_data[bytes_received] = '\0';
@ -156,9 +156,9 @@ static void tcpclient(void *arg)
} }
else if (ret == 0) else if (ret == 0)
{ {
/* Print warning message when send function return 0 */ /* Print warning message when send function returns 0 */
/* 打印send函数返回值为0的警告信息 */ /* 打印send函数返回值为0的警告信息 */
LOG_W("Send warning, send function return 0."); LOG_W("Send warning, send function returns 0.");
} }
} }

View File

@ -76,7 +76,7 @@ void tcp_senddata(const char *url, int port, int length)
else if (result == 0) else if (result == 0)
{ {
/* 打印send函数返回值为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");
} }
} }
} }

View File

@ -106,7 +106,7 @@ static void tcpserv(void *arg)
/* Accept a request from client and the function is blocking */ /* Accept a request from client and the function is blocking */
/* 接受一个客户端连接socket的请求这个函数调用是阻塞式的 */ /* 接受一个客户端连接socket的请求这个函数调用是阻塞式的 */
connected = accept(sock, (struct sockaddr *)&client_addr, &sin_size); connected = accept(sock, (struct sockaddr *)&client_addr, &sin_size);
/* Return the socket connected sucessfully */ /* Return the socket connected successfully */
/* 返回的是连接成功的socket */ /* 返回的是连接成功的socket */
if (connected < 0) if (connected < 0)
{ {
@ -139,13 +139,13 @@ static void tcpserv(void *arg)
} }
else if (bytes_received == 0) else if (bytes_received == 0)
{ {
/* Print warning message when recv function return 0 */ /* Print warning message when recv function returns 0 */
/* 打印recv函数返回值为0的警告信息 */ /* 打印recv函数返回值为0的警告信息 */
LOG_W("Received warning, recv function return 0."); LOG_W("Received warning, recv function returns 0.");
continue; continue;
} }
else 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'; recv_data[bytes_received] = '\0';
if (strcmp(recv_data, "q") == 0 || strcmp(recv_data, "Q") == 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) else if (ret == 0)
{ {
/* Print warning message when send function return 0 */ /* Print warning message when send function returns 0 */
/* 打印send函数返回值为0的警告信息 */ /* 打印send函数返回值为0的警告信息 */
LOG_W("Send warning, send function return 0."); LOG_W("Send warning, send function returns 0.");
} }
} }
} }

View File

@ -50,7 +50,7 @@ static void udpclient(void *arg)
/* 创建一个socket类型是SOCK_DGRAMUDP类型 */ /* 创建一个socket类型是SOCK_DGRAMUDP类型 */
if ((sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1) if ((sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1)
{ {
/* Failed on creatinf socket */ /* Failed on creating socket */
LOG_E("Create socket error"); LOG_E("Create socket error");
return; return;
} }
@ -71,7 +71,7 @@ static void udpclient(void *arg)
/* 发送数据到服务远端 */ /* 发送数据到服务远端 */
sendto(sock, send_data, rt_strlen(send_data), 0, sendto(sock, send_data, rt_strlen(send_data), 0,
(struct sockaddr *)&server_addr, sizeof(struct sockaddr)); (struct sockaddr *)&server_addr, sizeof(struct sockaddr));
/* Thread sllep for 1 second */ /* Thread sleep for 1 second */
/* 线程休眠一段时间 */ /* 线程休眠一段时间 */
rt_thread_mdelay(1000); rt_thread_mdelay(1000);
/* count decrease 1 */ /* count decrease 1 */

View File

@ -107,7 +107,7 @@ static void udpserv(void *paramemter)
} }
else if (bytes_read == 0) else if (bytes_read == 0)
{ {
LOG_W("Received warning, recv function return 0."); LOG_W("Received warning, recv function returns 0.");
continue; continue;
} }
else else

View File

@ -2,7 +2,7 @@
## 简介 ## 简介
为了保证某一部分代码的质量,通常可以通过编写测试用例的方式,验证此代码的功能。为了保证 RT-Thread 相关仓库的代码质量,我们基于 utest 框架搭建了一套简易的自动化测试环境。有兴趣,有精力的小伙伴可以利用这套机制完善自己的代码检查。如果有意愿让社区上更多的小伙伴益,也可以在提交代码的时候,把对应的测试用例也提交上来。 为了保证某一部分代码的质量,通常可以通过编写测试用例的方式,验证此代码的功能。为了保证 RT-Thread 相关仓库的代码质量,我们基于 utest 框架搭建了一套简易的自动化测试环境。有兴趣,有精力的小伙伴可以利用这套机制完善自己的代码检查。如果有意愿让社区上更多的小伙伴益,也可以在提交代码的时候,把对应的测试用例也提交上来。
## 目录结构 ## 目录结构
@ -15,7 +15,7 @@
### 1. 编写测试用例 ### 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. 本地测试 ### 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"} - {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 主仓库提交合并请求。

View File

@ -246,7 +246,7 @@ static void scenar_init(void)
" PTHREAD_CREATE_JOINABLE"); " PTHREAD_CREATE_JOINABLE");
} }
#if VERBOSE > 4 #if VERBOSE > 4
output("Detach state was set sucessfully\n"); output("Detach state was set successfully\n");
#endif #endif
/* Sched related attributes */ /* Sched related attributes */
@ -269,7 +269,7 @@ static void scenar_init(void)
UNRESOLVED(ret, "Unable to set inheritsched" UNRESOLVED(ret, "Unable to set inheritsched"
" attribute"); " attribute");
#if VERBOSE > 4 #if VERBOSE > 4
output("inheritsched state was set sucessfully\n"); output("inheritsched state was set successfully\n");
#endif #endif
} }
#if VERBOSE > 4 #if VERBOSE > 4
@ -292,7 +292,7 @@ static void scenar_init(void)
" sched policy"); " sched policy");
#if VERBOSE > 4 #if VERBOSE > 4
if (scenarii[i].schedpolicy) if (scenarii[i].schedpolicy)
output("Sched policy was set sucessfully\n"); output("Sched policy was set successfully\n");
else else
output("Sched policy untouched\n"); output("Sched policy untouched\n");
#endif #endif
@ -323,7 +323,7 @@ static void scenar_init(void)
"Failed to set the sched param"); "Failed to set the sched param");
#if VERBOSE > 4 #if VERBOSE > 4
output("Sched param was set sucessfully to %i\n", output("Sched param was set successfully to %i\n",
sp.sched_priority); sp.sched_priority);
} else { } else {
output("Sched param untouched\n"); output("Sched param untouched\n");

View File

@ -16,7 +16,7 @@ static int fclose_entry(void)
} }
else else
{ {
printf("fclose sucess \n"); printf("fclose success \n");
} }
return 0; return 0;
} }

View File

@ -291,7 +291,7 @@ class SconsUI():
setting.close() setting.close()
tkMessageBox.showinfo("RT-Thread SCons UI", tkMessageBox.showinfo("RT-Thread SCons UI",
"Save setting sucessfully") "Save setting successfully")
def setup_building_ui(self, frame): def setup_building_ui(self, frame):
padding = ttk.Frame(frame) padding = ttk.Frame(frame)