fix: kora工具检视问题修复

【背景】kora工具检视问题修复

【修改方案】
1,对部分代码问题进行整改

【影响】
对现有的产品编译不会有影响。

Signed-off-by: wangchen <wangchen64@huawei.com>
Change-Id: Iafc58b7c71e5d139e11a0ae9d98ca5a57fc6549f
This commit is contained in:
wangchen
2022-03-22 12:52:03 +00:00
parent f61ecd7669
commit 6ba17fc862
40 changed files with 146 additions and 248 deletions

View File

@@ -60,6 +60,8 @@ static UINT32 Testcase(VOID)
fclose(testFile);
testFile = fopen(pathname, "r");
ICUNIT_GOTO_NOT_EQUAL(testFile, NULL, testFile, EXIT);
p = fgetws(tarStr, 16, testFile); // 16 read size,total write and '\0'
nRet = wcscmp(L"hello world 666", tarStr);
ICUNIT_GOTO_EQUAL(nRet, 0, nRet, EXIT);

View File

@@ -55,6 +55,10 @@ static UINT32 testcase(VOID)
}
mnt_new = (struct mntent *)malloc(sizeof(struct mntent));
if (mnt_new == NULL) {
(VOID)RecoveryFileEnv(pathList, 1);
return LOS_NOK;
}
mnt_new->mnt_fsname = "UUID=c4992556-a86e-45e8-ba5f-190b16a9073x";
mnt_new->mnt_dir = "/usr1";
mnt_new->mnt_type = "ext3";

View File

@@ -55,6 +55,8 @@ static UINT32 Testcase(VOID)
fclose(putwcFile);
putwcFile = fopen(pathname, "r");
ICUNIT_GOTO_NOT_EQUAL(putwcFile, NULL, putwcFile, EXIT);
tarWc = getwc(putwcFile);
ICUNIT_GOTO_EQUAL(tarWc, L'H', tarWc, EXIT);

View File

@@ -44,8 +44,6 @@ static UINT32 Testcase(VOID)
ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1);
ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1);
ret = mq_close(mqueue);
ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1);

View File

@@ -43,7 +43,6 @@ static VOID *pthread_f02(void *argument)
ret = pthread_getschedparam(pthread_self(), &policy, &param);
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
ICUNIT_GOTO_EQUAL(policy, SCHED_RR, policy, EXIT); //
ICUNIT_GOTO_EQUAL(param.sched_priority, 3, param.sched_priority, EXIT);
@@ -63,7 +62,6 @@ static VOID *pthread_f01(void *argument)
ret = pthread_getschedparam(pthread_self(), &policy, &param);
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
ICUNIT_GOTO_EQUAL(policy, SCHED_RR, policy, EXIT); //
ICUNIT_GOTO_EQUAL(param.sched_priority, 4, param.sched_priority, EXIT);

View File

@@ -43,7 +43,7 @@ static UINT32 TestCase(VOID)
ICUNIT_GOTO_NOT_EQUAL(p, NULL, p, EXIT);
x = drand48();
printf("x= %d\n", x);
printf("x= %lf\n", x);
return 0;
EXIT:

View File

@@ -42,18 +42,6 @@ static void sig_alarm(int signum)
static UINT32 TestCase(VOID)
{
#if 0
int alarm_time = 1;
int ret;
signal(SIGALRM, sig_alarm);
alarm(alarm_time);
ret = sigsetjmp(jmp_env, 1);
if (ret) {
ICUNIT_ASSERT_EQUAL(ret, val, ret);
}
sleep(3);
#endif
return 0;
}

View File

@@ -48,6 +48,9 @@ static UINT32 TestCase(VOID)
NULL
};
CHAR *buf = (char *)malloc(TEST_BUF_SIZE);
if (buf == NULL) {
return -1;
}
CHAR *a = TEST_STR;
CHAR *value = NULL;
CHAR *subopts = NULL;

View File

@@ -87,11 +87,13 @@ static UINT32 TestCase(VOID)
ptr = (int *)Xmalloc(sizeof(int));
*ptr = rand() & 0xff;
val = tsearch((void *)ptr, &g_root, Compare);
if (val == NULL)
if (val == NULL) {
exit(EXIT_FAILURE);
else if ((*(int **)val) != ptr)
} else if ((*(int **)val) != ptr) {
free(ptr);
}
}
twalk(g_root, Action);
tdestroy(g_root, free);