From d17bc9d4eaaf37364a2bb5fb1c2126168e0a7f39 Mon Sep 17 00:00:00 2001 From: yinjiaming Date: Tue, 7 Feb 2023 15:10:12 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E5=88=A0=E9=99=A4=E5=86=97=E4=BD=99?= =?UTF-8?q?=E7=9A=84=E5=87=BD=E6=95=B0=20=E4=BB=A3=E7=A0=81=E6=89=AB?= =?UTF-8?q?=E6=8F=8F=E5=B7=A5=E5=85=B7=E5=8F=91=E7=8E=B0=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E4=B8=AD=E6=9C=89=E8=A2=AB=E6=B3=A8=E9=87=8A=E7=9A=84=E5=A4=9A?= =?UTF-8?q?=E4=BD=99=E5=87=BD=E6=95=B0=EF=BC=8C=E7=8E=B0=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: yinjiaming Change-Id: I26980061390924d53c77e467b2cab2f56b192a82 --- .../basic/mem/shm/full/shm_test_004.cpp | 3 +- .../liteipc/smoke/liteipc_test_001.cpp | 8 ++--- .../extended/signal/smoke/signal_test_036.cpp | 11 ------- .../libc/io/full/IO_test_locale_002.cpp | 7 ++--- testsuites/unittest/libc/misc/misc_test.cpp | 30 ------------------- .../pthread/full/It_posix_pthread_072.cpp | 5 ++-- .../pthread/smoke/It_posix_pthread_003.cpp | 17 ----------- .../pthread/smoke/It_posix_pthread_005.cpp | 3 -- .../pthread/smoke/It_posix_pthread_006.cpp | 3 -- .../unittest/net/socket/net_socket_test.cpp | 11 ------- tools/scripts/parse_exc/parse_excinfo.py | 1 - 11 files changed, 9 insertions(+), 90 deletions(-) diff --git a/testsuites/unittest/basic/mem/shm/full/shm_test_004.cpp b/testsuites/unittest/basic/mem/shm/full/shm_test_004.cpp index 3348ea39..4a2d914c 100644 --- a/testsuites/unittest/basic/mem/shm/full/shm_test_004.cpp +++ b/testsuites/unittest/basic/mem/shm/full/shm_test_004.cpp @@ -55,7 +55,6 @@ static int Testcase(VOID) ICUNIT_GOTO_EQUAL(ds.shm_perm.uid, getuid(), ds.shm_perm.uid, ERROR_OUT); 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, 0, ret, ERROR_OUT); @@ -70,7 +69,7 @@ static int Testcase(VOID) ICUNIT_GOTO_EQUAL(info.shmmax, 0x1000000, info.shmmax, 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.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); ret = shmdt(shm); diff --git a/testsuites/unittest/extended/liteipc/smoke/liteipc_test_001.cpp b/testsuites/unittest/extended/liteipc/smoke/liteipc_test_001.cpp index 7355dc69..62cb49a0 100644 --- a/testsuites/unittest/extended/liteipc/smoke/liteipc_test_001.cpp +++ b/testsuites/unittest/extended/liteipc/smoke/liteipc_test_001.cpp @@ -63,13 +63,11 @@ static int LiteIpcTest(void) /* testing mmap liteipc mem pool with different size and flag */ retptr = mmap(nullptr, 1024 * 4096, PROT_READ, MAP_PRIVATE, fd, 0); ICUNIT_ASSERT_EQUAL(static_cast(static_cast(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); ICUNIT_ASSERT_EQUAL(static_cast(static_cast(retptr)), -1, retptr); retptr = mmap(nullptr, 4096, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0); ICUNIT_ASSERT_EQUAL(static_cast(static_cast(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(static_cast(retptr)), -1, retptr); retptr = mmap(nullptr, 1, PROT_READ, MAP_PRIVATE, fd, 0); @@ -81,7 +79,7 @@ static int LiteIpcTest(void) char buf[10] = {0}; ret = read(fd, buf, 10); 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); /* before set cms, testing ioctl cmd */ @@ -96,7 +94,7 @@ static int LiteIpcTest(void) sleep(2); /* 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); exit(0); diff --git a/testsuites/unittest/extended/signal/smoke/signal_test_036.cpp b/testsuites/unittest/extended/signal/smoke/signal_test_036.cpp index 8cb97a67..35aaed0b 100644 --- a/testsuites/unittest/extended/signal/smoke/signal_test_036.cpp +++ b/testsuites/unittest/extended/signal/smoke/signal_test_036.cpp @@ -60,17 +60,6 @@ static int TestCase() 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); ICUNIT_ASSERT_EQUAL(ret, fpid, ret); ICUNIT_ASSERT_EQUAL(WEXITSTATUS(status), 0, WEXITSTATUS(status)); diff --git a/testsuites/unittest/libc/io/full/IO_test_locale_002.cpp b/testsuites/unittest/libc/io/full/IO_test_locale_002.cpp index 6e22bc86..daaca4c7 100644 --- a/testsuites/unittest/libc/io/full/IO_test_locale_002.cpp +++ b/testsuites/unittest/libc/io/full/IO_test_locale_002.cpp @@ -37,7 +37,6 @@ static UINT32 testcase(VOID) time_t currtime; struct tm *timer = {nullptr}; char buffer[80]; - //locale_t loc = malloc(sizeof(locale_t); time(&currtime); timer = localtime(&currtime); @@ -46,17 +45,17 @@ static UINT32 testcase(VOID) printf("getenv MUSL_LOCPATH=%s\n", getenv("MUSL_LOCPATH")); 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); ICUNIT_ASSERT_NOT_EQUAL_NULL(buffer, NULL, -1); 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); ICUNIT_ASSERT_NOT_EQUAL_NULL(buffer, NULL, -1); 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); ICUNIT_ASSERT_NOT_EQUAL_NULL(buffer, NULL, -1); setlocale(LC_ALL, "C"); diff --git a/testsuites/unittest/libc/misc/misc_test.cpp b/testsuites/unittest/libc/misc/misc_test.cpp index 319e5658..0f34b621 100644 --- a/testsuites/unittest/libc/misc/misc_test.cpp +++ b/testsuites/unittest/libc/misc/misc_test.cpp @@ -145,26 +145,6 @@ HWTEST_F(MiscTest, ItTestMisc009, TestSize.Level0) 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.desc: function for MiscTest @@ -174,16 +154,6 @@ HWTEST_F(MiscTest, ItTestMisc012, TestSize.Level0) { ItTestMisc012(); } - -/* * - * @tc.name: IT_TEST_MISC_013 - * @tc.desc: function for MiscTest - * @tc.type: FUNC - */ -/*HWTEST_F(MiscTest, ItTestMisc013, TestSize.Level0) -{ - ItTestMisc013(); -}*/ #endif } // namespace OHOS diff --git a/testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_072.cpp b/testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_072.cpp index b6e5efd8..9d8141be 100644 --- a/testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_072.cpp +++ b/testsuites/unittest/libc/posix/pthread/full/It_posix_pthread_072.cpp @@ -34,7 +34,6 @@ static void *pthread_f01(void *tmp) { int rc = 0; g_testCount++; - // printf("www\n"); /* acquire the mutex */ rc = pthread_mutex_lock(&g_pthreadMutexTest1); @@ -69,7 +68,7 @@ static UINT32 Testcase(VOID) /* Let the other thread run */ 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 */ rc = pthread_cond_destroy(&g_pthreadCondTest1); @@ -79,7 +78,7 @@ static UINT32 Testcase(VOID) ICUNIT_ASSERT_EQUAL(rc, 0, rc); 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); ICUNIT_ASSERT_EQUAL(rc, 0, rc); diff --git a/testsuites/unittest/libc/posix/pthread/smoke/It_posix_pthread_003.cpp b/testsuites/unittest/libc/posix/pthread/smoke/It_posix_pthread_003.cpp index 001d1c6b..9cd44b50 100644 --- a/testsuites/unittest/libc/posix/pthread/smoke/It_posix_pthread_003.cpp +++ b/testsuites/unittest/libc/posix/pthread/smoke/It_posix_pthread_003.cpp @@ -51,10 +51,6 @@ static UINT32 Testcase(VOID) tmp = pthread_equal(a, b); - // pthread_join(a, NULL); - - // pthread_detach(a); - pthread_attr_init(&aa); pthread_attr_getdetachstate(&aa, &detachstate); @@ -63,19 +59,6 @@ static UINT32 Testcase(VOID) 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); ICUNIT_ASSERT_EQUAL(ret, 0, ret); diff --git a/testsuites/unittest/libc/posix/pthread/smoke/It_posix_pthread_005.cpp b/testsuites/unittest/libc/posix/pthread/smoke/It_posix_pthread_005.cpp index 9ccb21ec..5beb285c 100644 --- a/testsuites/unittest/libc/posix/pthread/smoke/It_posix_pthread_005.cpp +++ b/testsuites/unittest/libc/posix/pthread/smoke/It_posix_pthread_005.cpp @@ -36,8 +36,6 @@ static void *ThreadF01(void *arg) /* Shouldn't reach here. If we do, then the pthread_cancel() * function did not succeed. */ - // uart_printf_func("Could not send cancel request correctly\n"); - // ICUNIT_TRACK_EQUAL(1, 0, errno); pthread_exit(nullptr); return NULL; } @@ -62,7 +60,6 @@ static UINT32 Testcase(VOID) ret = pthread_join(newTh, (void **)&temp); ICUNIT_ASSERT_EQUAL(ret, 0, ret); - // ICUNIT_ASSERT_EQUAL(temp, (UINTPTR)PTHREAD_CANCELED, temp); return PTHREAD_NO_ERROR; } diff --git a/testsuites/unittest/libc/posix/pthread/smoke/It_posix_pthread_006.cpp b/testsuites/unittest/libc/posix/pthread/smoke/It_posix_pthread_006.cpp index 0389711c..80d397a3 100644 --- a/testsuites/unittest/libc/posix/pthread/smoke/It_posix_pthread_006.cpp +++ b/testsuites/unittest/libc/posix/pthread/smoke/It_posix_pthread_006.cpp @@ -34,7 +34,6 @@ static void *ThreadF01(void *arg) { pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); - // while (1) sleep(1); pthread_exit(nullptr); @@ -48,7 +47,6 @@ static UINT32 Testcase(VOID) pthread_t a; /* SIGALRM will be sent in 5 seconds. */ - // alarm(5);//alarm NOT SUPPORT /* Create a new thread. */ if (pthread_create(&a, NULL, ThreadF01, NULL) != 0) { @@ -61,7 +59,6 @@ static UINT32 Testcase(VOID) /* If 'main' has reached here, then the test passed because it means * that the thread is truly asynchronise, and main isn't waiting for * it to return in order to move on. */ - // printf("Test PASSED\n"); ret = pthread_join(a, &temp); ICUNIT_ASSERT_EQUAL(ret, 0, ret); diff --git a/testsuites/unittest/net/socket/net_socket_test.cpp b/testsuites/unittest/net/socket/net_socket_test.cpp index 01fff55c..bf71bf33 100644 --- a/testsuites/unittest/net/socket/net_socket_test.cpp +++ b/testsuites/unittest/net/socket/net_socket_test.cpp @@ -176,16 +176,5 @@ HWTEST_F(NetSocketTest, NetSocketTest012, TestSize.Level0) 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 } diff --git a/tools/scripts/parse_exc/parse_excinfo.py b/tools/scripts/parse_exc/parse_excinfo.py index 7f580d8a..a1ba92d4 100644 --- a/tools/scripts/parse_exc/parse_excinfo.py +++ b/tools/scripts/parse_exc/parse_excinfo.py @@ -131,7 +131,6 @@ def parse_user_pc_ulr(excinfo_file, rootfs_dir, string, addr2line_cmd, objdump_c ret = commands.getoutput(cmd) print(ret) cmd = "%s%s%s %s" % (addr2line_cmd, rootfs_dir, strlist[4], strlist[6]) - #print(cmd) ret = commands.getoutput(cmd) ret = ret.split('\n') print("<%s>%s<%s><%s>\n" % (string, ret[0], strlist[6], strlist[4])) -- GitLab