未验证 提交 43f04932 编写于 作者: O openharmony_ci 提交者: Gitee

!569 libctest 测试问题解决

Merge pull request !569 from dhy308/branch_fixbug_1011
......@@ -21,6 +21,7 @@
#include <sys/wait.h>
#include "fortify_test.h"
#include "test.h"
#include "../../../../porting/linux/user/include/fortify/fortify.h"
#define SIZE_1 1
#define SIZE_5 5
......@@ -412,7 +413,7 @@ static void test_strchr_0020()
};
sigaction(SIGABRT, &sigabrt, NULL);
char *s;
char str[0];
int status;
int pid = fork();
switch (pid) {
......@@ -420,7 +421,7 @@ static void test_strchr_0020()
t_error("fork failed: %s\n", strerror(errno));
break;
case 0:
strchr(s, 'a');
strchr(str, 'a');
exit(0);
default:
waitpid(pid, &status, WUNTRACED);
......@@ -460,7 +461,7 @@ static void test_strrchr_0020()
};
sigaction(SIGABRT, &sigabrt, NULL);
char *s;
char str[0];
int status;
int pid = fork();
switch (pid) {
......@@ -468,7 +469,7 @@ static void test_strrchr_0020()
t_error("fork failed: %s\n", strerror(errno));
break;
case 0:
strrchr(s, 'a');
strrchr(str, 'a');
exit(0);
default:
waitpid(pid, &status, WUNTRACED);
......@@ -558,7 +559,6 @@ static void test_strlcpy_0020()
};
sigaction(SIGABRT, &sigabrt, NULL);
char src[SIZE_15];
char dst[SIZE_10];
strcpy(src, STRLEN_14);
......
......@@ -49,7 +49,7 @@ void strtok_r_0200(void)
char *p;
char *outer_ptr = NULL;
char *result = strtok_r(outer_ptr, ",", &p);
if (!result) {
if (result) {
t_error("%s strtok_r error get result is %s not null\n", __func__, result);
}
}
......
......@@ -51,7 +51,7 @@ void wcpncpy_0200(void)
if (wcscmp(result, dst + 2) != 0) {
t_error("%s wcpncpy get result is %ls are not want %ls\n", __func__, result, dst + 2);
}
if (wcscmp(src, dst) != 0) {
if (wcscmp(dst, L"So") != 0) {
t_error("%s wcpncpy get dst is %ls are not want %ls\n", __func__, dst, src);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册