提交 d17bc9d4 编写于 作者: Y yinjiaming

fix:删除冗余的函数

代码扫描工具发现代码中有被注释的多余函数,现删除。
Signed-off-by: Nyinjiaming <yinjiaming@huawei.com>
Change-Id: I26980061390924d53c77e467b2cab2f56b192a82
上级 be507218
...@@ -55,7 +55,6 @@ static int Testcase(VOID) ...@@ -55,7 +55,6 @@ static int Testcase(VOID)
ICUNIT_GOTO_EQUAL(ds.shm_perm.uid, getuid(), ds.shm_perm.uid, ERROR_OUT); ICUNIT_GOTO_EQUAL(ds.shm_perm.uid, getuid(), ds.shm_perm.uid, ERROR_OUT);
ret = shmctl(shmid, SHM_STAT, &ds); ret = shmctl(shmid, SHM_STAT, &ds);
// ICUNIT_GOTO_EQUAL(ret, 0x10000, ret, ERROR_OUT);
ICUNIT_GOTO_NOT_EQUAL(ret, -1, ret, ERROR_OUT); ICUNIT_GOTO_NOT_EQUAL(ret, -1, ret, ERROR_OUT);
ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, ERROR_OUT); ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, ERROR_OUT);
...@@ -70,7 +69,7 @@ static int Testcase(VOID) ...@@ -70,7 +69,7 @@ static int Testcase(VOID)
ICUNIT_GOTO_EQUAL(info.shmmax, 0x1000000, info.shmmax, ERROR_OUT); ICUNIT_GOTO_EQUAL(info.shmmax, 0x1000000, info.shmmax, ERROR_OUT);
ICUNIT_GOTO_EQUAL(info.shmmin, 1, info.shmmin, ERROR_OUT); ICUNIT_GOTO_EQUAL(info.shmmin, 1, info.shmmin, ERROR_OUT);
ICUNIT_GOTO_EQUAL(info.shmmni, 192, info.shmmni, ERROR_OUT); ICUNIT_GOTO_EQUAL(info.shmmni, 192, info.shmmni, ERROR_OUT);
ICUNIT_GOTO_EQUAL(info.shmseg, 128, info.shmseg, ERROR_OUT); ICUNIT_GOTO_EQUAL(info.shmseg, 128, info.shmseg, ERROR_OUT); // 128: expected value of shmseg
ICUNIT_GOTO_EQUAL(info.shmall, 0x1000, info.shmall, ERROR_OUT); ICUNIT_GOTO_EQUAL(info.shmall, 0x1000, info.shmall, ERROR_OUT);
ret = shmdt(shm); ret = shmdt(shm);
......
...@@ -63,13 +63,11 @@ static int LiteIpcTest(void) ...@@ -63,13 +63,11 @@ static int LiteIpcTest(void)
/* testing mmap liteipc mem pool with different size and flag */ /* testing mmap liteipc mem pool with different size and flag */
retptr = mmap(nullptr, 1024 * 4096, PROT_READ, MAP_PRIVATE, fd, 0); retptr = mmap(nullptr, 1024 * 4096, PROT_READ, MAP_PRIVATE, fd, 0);
ICUNIT_ASSERT_EQUAL(static_cast<int>(static_cast<intptr_t>(retptr)), -1, retptr); ICUNIT_ASSERT_EQUAL(static_cast<int>(static_cast<intptr_t>(retptr)), -1, retptr);
//retptr = mmap(nullptr, 0, PROT_READ, MAP_PRIVATE, fd, 0);
//ICUNIT_ASSERT_EQUAL((int)(intptr_t)retptr, -1, retptr);
retptr = mmap(nullptr, -1, PROT_READ, MAP_PRIVATE, fd, 0); retptr = mmap(nullptr, -1, PROT_READ, MAP_PRIVATE, fd, 0);
ICUNIT_ASSERT_EQUAL(static_cast<int>(static_cast<intptr_t>(retptr)), -1, retptr); ICUNIT_ASSERT_EQUAL(static_cast<int>(static_cast<intptr_t>(retptr)), -1, retptr);
retptr = mmap(nullptr, 4096, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0); retptr = mmap(nullptr, 4096, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
ICUNIT_ASSERT_EQUAL(static_cast<int>(static_cast<intptr_t>(retptr)), -1, retptr); ICUNIT_ASSERT_EQUAL(static_cast<int>(static_cast<intptr_t>(retptr)), -1, retptr);
retptr = mmap(nullptr, 4096, PROT_READ, MAP_SHARED, fd, 0); retptr = mmap(nullptr, 4096, PROT_READ, MAP_SHARED, fd, 0); // 4096: length of mapped memory
ICUNIT_ASSERT_EQUAL(static_cast<int>(static_cast<intptr_t>(retptr)), -1, retptr); ICUNIT_ASSERT_EQUAL(static_cast<int>(static_cast<intptr_t>(retptr)), -1, retptr);
retptr = mmap(nullptr, 1, PROT_READ, MAP_PRIVATE, fd, 0); retptr = mmap(nullptr, 1, PROT_READ, MAP_PRIVATE, fd, 0);
...@@ -81,7 +79,7 @@ static int LiteIpcTest(void) ...@@ -81,7 +79,7 @@ static int LiteIpcTest(void)
char buf[10] = {0}; char buf[10] = {0};
ret = read(fd, buf, 10); ret = read(fd, buf, 10);
ICUNIT_ASSERT_EQUAL(ret, -1, ret); ICUNIT_ASSERT_EQUAL(ret, -1, ret);
ret = write(fd, buf, 10); ret = write(fd, buf, 10); // 10: size of buf
ICUNIT_ASSERT_EQUAL(ret, -1, ret); ICUNIT_ASSERT_EQUAL(ret, -1, ret);
/* before set cms, testing ioctl cmd */ /* before set cms, testing ioctl cmd */
...@@ -96,7 +94,7 @@ static int LiteIpcTest(void) ...@@ -96,7 +94,7 @@ static int LiteIpcTest(void)
sleep(2); sleep(2);
/* after set cms, testing set cms cmd */ /* after set cms, testing set cms cmd */
ret = ioctl(fd, IPC_SET_CMS, 200); ret = ioctl(fd, IPC_SET_CMS, 200); // 200: use 200 for set cms cmd testing
ICUNIT_ASSERT_NOT_EQUAL(ret, 0, ret); ICUNIT_ASSERT_NOT_EQUAL(ret, 0, ret);
exit(0); exit(0);
......
...@@ -60,17 +60,6 @@ static int TestCase() ...@@ -60,17 +60,6 @@ static int TestCase()
exit(0); exit(0);
} }
/* sig = SIGTERM;
ret = sigaction(sig, (struct sigaction *)1, &oldAct);
printf("ret == %d\n", ret);
ICUNIT_ASSERT_EQUAL(ret, -1, ret);
ICUNIT_ASSERT_EQUAL(errno, EFAULT, errno);
ret = sigaction(sig, &sigAct, (struct sigaction *)1);
printf("ret === %d\n", ret);
ICUNIT_ASSERT_EQUAL(ret, -1, ret);
ICUNIT_ASSERT_EQUAL(errno, EFAULT, errno); */
ret = waitpid(fpid, &status, 0); ret = waitpid(fpid, &status, 0);
ICUNIT_ASSERT_EQUAL(ret, fpid, ret); ICUNIT_ASSERT_EQUAL(ret, fpid, ret);
ICUNIT_ASSERT_EQUAL(WEXITSTATUS(status), 0, WEXITSTATUS(status)); ICUNIT_ASSERT_EQUAL(WEXITSTATUS(status), 0, WEXITSTATUS(status));
......
...@@ -37,7 +37,6 @@ static UINT32 testcase(VOID) ...@@ -37,7 +37,6 @@ static UINT32 testcase(VOID)
time_t currtime; time_t currtime;
struct tm *timer = {nullptr}; struct tm *timer = {nullptr};
char buffer[80]; char buffer[80];
//locale_t loc = malloc(sizeof(locale_t);
time(&currtime); time(&currtime);
timer = localtime(&currtime); timer = localtime(&currtime);
...@@ -46,17 +45,17 @@ static UINT32 testcase(VOID) ...@@ -46,17 +45,17 @@ static UINT32 testcase(VOID)
printf("getenv MUSL_LOCPATH=%s\n", getenv("MUSL_LOCPATH")); printf("getenv MUSL_LOCPATH=%s\n", getenv("MUSL_LOCPATH"));
printf("Locale is: %s\n", setlocale(LC_TIME, "en_US.UTF-8")); printf("Locale is: %s\n", setlocale(LC_TIME, "en_US.UTF-8"));
strftime(buffer, 80, "%c", timer); (void)strftime(buffer, sizeof(buffer), "%c", timer);
printf("Date is: %s\n", buffer); printf("Date is: %s\n", buffer);
ICUNIT_ASSERT_NOT_EQUAL_NULL(buffer, NULL, -1); ICUNIT_ASSERT_NOT_EQUAL_NULL(buffer, NULL, -1);
printf("Locale is: %s\n", setlocale(LC_TIME, "zh_CN.UTF-8")); printf("Locale is: %s\n", setlocale(LC_TIME, "zh_CN.UTF-8"));
strftime(buffer, 80, "%c", timer); (void)strftime(buffer, sizeof(buffer), "%c", timer);
printf("Date is: %s\n", buffer); printf("Date is: %s\n", buffer);
ICUNIT_ASSERT_NOT_EQUAL_NULL(buffer, NULL, -1); ICUNIT_ASSERT_NOT_EQUAL_NULL(buffer, NULL, -1);
printf("Locale is: %s\n", setlocale(LC_TIME, "")); printf("Locale is: %s\n", setlocale(LC_TIME, ""));
strftime(buffer, 80, "%c", timer); (void)strftime(buffer, sizeof(buffer), "%c", timer);
printf("Date is: %s\n", buffer); printf("Date is: %s\n", buffer);
ICUNIT_ASSERT_NOT_EQUAL_NULL(buffer, NULL, -1); ICUNIT_ASSERT_NOT_EQUAL_NULL(buffer, NULL, -1);
setlocale(LC_ALL, "C"); setlocale(LC_ALL, "C");
......
...@@ -145,26 +145,6 @@ HWTEST_F(MiscTest, ItTestMisc009, TestSize.Level0) ...@@ -145,26 +145,6 @@ HWTEST_F(MiscTest, ItTestMisc009, TestSize.Level0)
ItTestMisc009(); ItTestMisc009();
} }
/* *
* @tc.name: IT_TEST_MISC_010
* @tc.desc: function for MiscTest
* @tc.type: FUNC
*/
/*HWTEST_F(MiscTest, ItTestMisc010, TestSize.Level0)
{
ItTestMisc010();
}*/
/* *
* @tc.name: IT_TEST_MISC_011
* @tc.desc: function for MiscTest
* @tc.type: FUNC
*/
/*HWTEST_F(MiscTest, ItTestMisc011, TestSize.Level0)
{
ItTestMisc011();
}*/
/* * /* *
* @tc.name: IT_TEST_MISC_012 * @tc.name: IT_TEST_MISC_012
* @tc.desc: function for MiscTest * @tc.desc: function for MiscTest
...@@ -174,16 +154,6 @@ HWTEST_F(MiscTest, ItTestMisc012, TestSize.Level0) ...@@ -174,16 +154,6 @@ HWTEST_F(MiscTest, ItTestMisc012, TestSize.Level0)
{ {
ItTestMisc012(); ItTestMisc012();
} }
/* *
* @tc.name: IT_TEST_MISC_013
* @tc.desc: function for MiscTest
* @tc.type: FUNC
*/
/*HWTEST_F(MiscTest, ItTestMisc013, TestSize.Level0)
{
ItTestMisc013();
}*/
#endif #endif
} // namespace OHOS } // namespace OHOS
...@@ -34,7 +34,6 @@ static void *pthread_f01(void *tmp) ...@@ -34,7 +34,6 @@ static void *pthread_f01(void *tmp)
{ {
int rc = 0; int rc = 0;
g_testCount++; g_testCount++;
// printf("www\n");
/* acquire the mutex */ /* acquire the mutex */
rc = pthread_mutex_lock(&g_pthreadMutexTest1); rc = pthread_mutex_lock(&g_pthreadMutexTest1);
...@@ -69,7 +68,7 @@ static UINT32 Testcase(VOID) ...@@ -69,7 +68,7 @@ static UINT32 Testcase(VOID)
/* Let the other thread run */ /* Let the other thread run */
LosTaskDelay(2); LosTaskDelay(2);
ICUNIT_ASSERT_EQUAL(g_testCount, 2, g_testCount); ICUNIT_ASSERT_EQUAL(g_testCount, 2, g_testCount); // 2: expected value of g_testCount
/* Try to destroy the cond var. This should return an error */ /* Try to destroy the cond var. This should return an error */
rc = pthread_cond_destroy(&g_pthreadCondTest1); rc = pthread_cond_destroy(&g_pthreadCondTest1);
...@@ -79,7 +78,7 @@ static UINT32 Testcase(VOID) ...@@ -79,7 +78,7 @@ static UINT32 Testcase(VOID)
ICUNIT_ASSERT_EQUAL(rc, 0, rc); ICUNIT_ASSERT_EQUAL(rc, 0, rc);
LosTaskDelay(2); LosTaskDelay(2);
ICUNIT_ASSERT_EQUAL(g_testCount, 4, g_testCount); ICUNIT_ASSERT_EQUAL(g_testCount, 4, g_testCount); // 4: expected value of g_testCount
rc = pthread_cond_destroy(&g_pthreadCondTest1); rc = pthread_cond_destroy(&g_pthreadCondTest1);
ICUNIT_ASSERT_EQUAL(rc, 0, rc); ICUNIT_ASSERT_EQUAL(rc, 0, rc);
......
...@@ -51,10 +51,6 @@ static UINT32 Testcase(VOID) ...@@ -51,10 +51,6 @@ static UINT32 Testcase(VOID)
tmp = pthread_equal(a, b); tmp = pthread_equal(a, b);
// pthread_join(a, NULL);
// pthread_detach(a);
pthread_attr_init(&aa); pthread_attr_init(&aa);
pthread_attr_getdetachstate(&aa, &detachstate); pthread_attr_getdetachstate(&aa, &detachstate);
...@@ -63,19 +59,6 @@ static UINT32 Testcase(VOID) ...@@ -63,19 +59,6 @@ static UINT32 Testcase(VOID)
pthread_attr_destroy(&aa); pthread_attr_destroy(&aa);
// pthread_mutex_init(&c, NULL);
// pthread_mutex_destroy(&c);
// pthread_mutex_lock(&c);
// pthread_mutex_trylock(&c);
// pthread_mutex_unlock(&c);
// pthread_mutexattr_init(&c);
// pthread_mutexattr_destroy(&c);
ret = pthread_join(aThread, NULL); ret = pthread_join(aThread, NULL);
ICUNIT_ASSERT_EQUAL(ret, 0, ret); ICUNIT_ASSERT_EQUAL(ret, 0, ret);
......
...@@ -36,8 +36,6 @@ static void *ThreadF01(void *arg) ...@@ -36,8 +36,6 @@ static void *ThreadF01(void *arg)
/* Shouldn't reach here. If we do, then the pthread_cancel() /* Shouldn't reach here. If we do, then the pthread_cancel()
* function did not succeed. */ * function did not succeed. */
// uart_printf_func("Could not send cancel request correctly\n");
// ICUNIT_TRACK_EQUAL(1, 0, errno);
pthread_exit(nullptr); pthread_exit(nullptr);
return NULL; return NULL;
} }
...@@ -62,7 +60,6 @@ static UINT32 Testcase(VOID) ...@@ -62,7 +60,6 @@ static UINT32 Testcase(VOID)
ret = pthread_join(newTh, (void **)&temp); ret = pthread_join(newTh, (void **)&temp);
ICUNIT_ASSERT_EQUAL(ret, 0, ret); ICUNIT_ASSERT_EQUAL(ret, 0, ret);
// ICUNIT_ASSERT_EQUAL(temp, (UINTPTR)PTHREAD_CANCELED, temp);
return PTHREAD_NO_ERROR; return PTHREAD_NO_ERROR;
} }
......
...@@ -34,7 +34,6 @@ static void *ThreadF01(void *arg) ...@@ -34,7 +34,6 @@ static void *ThreadF01(void *arg)
{ {
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
// while (1)
sleep(1); sleep(1);
pthread_exit(nullptr); pthread_exit(nullptr);
...@@ -48,7 +47,6 @@ static UINT32 Testcase(VOID) ...@@ -48,7 +47,6 @@ static UINT32 Testcase(VOID)
pthread_t a; pthread_t a;
/* SIGALRM will be sent in 5 seconds. */ /* SIGALRM will be sent in 5 seconds. */
// alarm(5);//alarm NOT SUPPORT
/* Create a new thread. */ /* Create a new thread. */
if (pthread_create(&a, NULL, ThreadF01, NULL) != 0) { if (pthread_create(&a, NULL, ThreadF01, NULL) != 0) {
...@@ -61,7 +59,6 @@ static UINT32 Testcase(VOID) ...@@ -61,7 +59,6 @@ static UINT32 Testcase(VOID)
/* If 'main' has reached here, then the test passed because it means /* If 'main' has reached here, then the test passed because it means
* that the thread is truly asynchronise, and main isn't waiting for * that the thread is truly asynchronise, and main isn't waiting for
* it to return in order to move on. */ * it to return in order to move on. */
// printf("Test PASSED\n");
ret = pthread_join(a, &temp); ret = pthread_join(a, &temp);
ICUNIT_ASSERT_EQUAL(ret, 0, ret); ICUNIT_ASSERT_EQUAL(ret, 0, ret);
......
...@@ -176,16 +176,5 @@ HWTEST_F(NetSocketTest, NetSocketTest012, TestSize.Level0) ...@@ -176,16 +176,5 @@ HWTEST_F(NetSocketTest, NetSocketTest012, TestSize.Level0)
NetSocketTest012(); NetSocketTest012();
} }
/* *
* @tc.name: NetSocketTest013
* @tc.desc: function for NetSocketTest
* @tc.type: FUNC
*/
/*
HWTEST_F(NetSocketTest, NetSocketTest013, TestSize.Level0)
{
//NetSocketTest013(); // broadcast to self to be supported.
}
*/
#endif #endif
} }
...@@ -131,7 +131,6 @@ def parse_user_pc_ulr(excinfo_file, rootfs_dir, string, addr2line_cmd, objdump_c ...@@ -131,7 +131,6 @@ def parse_user_pc_ulr(excinfo_file, rootfs_dir, string, addr2line_cmd, objdump_c
ret = commands.getoutput(cmd) ret = commands.getoutput(cmd)
print(ret) print(ret)
cmd = "%s%s%s %s" % (addr2line_cmd, rootfs_dir, strlist[4], strlist[6]) cmd = "%s%s%s %s" % (addr2line_cmd, rootfs_dir, strlist[4], strlist[6])
#print(cmd)
ret = commands.getoutput(cmd) ret = commands.getoutput(cmd)
ret = ret.split('\n') ret = ret.split('\n')
print("<%s>%s<%s><%s>\n" % (string, ret[0], strlist[6], strlist[4])) print("<%s>%s<%s><%s>\n" % (string, ret[0], strlist[6], strlist[4]))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册