未验证 提交 56e9847a 编写于 作者: O openharmony_ci 提交者: Gitee

!1330 解决黄区ut用例导致设备重启和ut执行时间过长问题

Merge pull request !1330 from cheng_jinsong/master_cc_fix_ut
...@@ -57,7 +57,11 @@ static int DoReboot_(const char *option) ...@@ -57,7 +57,11 @@ static int DoReboot_(const char *option)
int DoReboot(const char *option) int DoReboot(const char *option)
{ {
// check if param set ok // check if param set ok
#ifndef STARTUP_INIT_TEST
const int maxCount = 10; const int maxCount = 10;
#else
const int maxCount = 1;
#endif
int count = 0; int count = 0;
DoReboot_(option); DoReboot_(option);
while (count < maxCount) { while (count < maxCount) {
......
...@@ -326,6 +326,9 @@ void WaitForFile(const char *source, unsigned int maxSecond) ...@@ -326,6 +326,9 @@ void WaitForFile(const char *source, unsigned int maxSecond)
unsigned int waitTime = 500000; unsigned int waitTime = 500000;
/* 500ms interval, check maxSecond*2 times total */ /* 500ms interval, check maxSecond*2 times total */
unsigned int maxCount = maxSecond * 2; unsigned int maxCount = maxSecond * 2;
#ifdef STARTUP_INIT_TEST
maxCount = 0;
#endif
unsigned int count = 0; unsigned int count = 0;
while ((stat(source, &sourceInfo) < 0) && (errno == ENOENT) && (count < maxCount)) { while ((stat(source, &sourceInfo) < 0) && (errno == ENOENT) && (count < maxCount)) {
usleep(waitTime); usleep(waitTime);
......
...@@ -271,10 +271,6 @@ HWTEST_F(CmdsUnitTest, TestGetCmdLinesFromJson, TestSize.Level1) ...@@ -271,10 +271,6 @@ HWTEST_F(CmdsUnitTest, TestGetCmdLinesFromJson, TestSize.Level1)
HWTEST_F(CmdsUnitTest, TestInitCmdFunc, TestSize.Level1) HWTEST_F(CmdsUnitTest, TestInitCmdFunc, TestSize.Level1)
{ {
int ret = GetBootModeFromMisc(); int ret = GetBootModeFromMisc();
#ifdef __MUSL__
EXPECT_EQ(ret, 0); EXPECT_EQ(ret, 0);
#else
EXPECT_NE(ret, 0);
#endif
} }
} // namespace init_ut } // namespace init_ut
...@@ -123,10 +123,10 @@ HWTEST_F(ModuleMgrUnitTest, ModuleInstallTest, TestSize.Level1) ...@@ -123,10 +123,10 @@ HWTEST_F(ModuleMgrUnitTest, ModuleInstallTest, TestSize.Level1)
ModuleMgrDestroy(moduleMgr); ModuleMgrDestroy(moduleMgr);
// Scan all modules // Scan all modules
moduleMgr = ModuleMgrScan("init"); moduleMgr = ModuleMgrScan("init/autorun");
ASSERT_NE(moduleMgr, nullptr); ASSERT_NE(moduleMgr, nullptr);
cnt = ModuleMgrGetCnt(moduleMgr); cnt = ModuleMgrGetCnt(moduleMgr);
ASSERT_NE(cnt, 0); ASSERT_EQ(cnt, 0);
ModuleMgrUninstall(moduleMgr, NULL); ModuleMgrUninstall(moduleMgr, NULL);
cnt = ModuleMgrGetCnt(moduleMgr); cnt = ModuleMgrGetCnt(moduleMgr);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册