!435 补充UT用例

Merge pull request !435 from wenlong_12/master
This commit is contained in:
openharmony_ci 2024-01-31 02:23:30 +00:00 committed by Gitee
commit 1721591f9e
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 30 additions and 0 deletions

View File

@ -1975,6 +1975,23 @@ HWTEST_F(SubCommandStatTest, HandleOtherConfig, TestSize.Level1)
constexpr int testNum = 100;
EXPECT_EQ(SubCommandStat::HandleOtherConfig(comment, summary, testNum, testNum, true), "");
}
/**
* @tc.name: CheckOptionPidAndApp
* @tc.desc: Test handle other config
* @tc.type: FUNC
*/
HWTEST_F(SubCommandStatTest, CheckOptionPidAndApp, TestSize.Level1)
{
SubCommandStat stat;
std::vector<pid_t> pids;
EXPECT_EQ(stat.CheckOptionPidAndApp(pids), true);
pids.push_back(1);
pids.push_back(2); // 2: pid
EXPECT_EQ(stat.CheckOptionPidAndApp(pids), true);
pids.push_back(700011); // 700011: invalid pid
EXPECT_EQ(stat.CheckOptionPidAndApp(pids), false);
}
} // namespace HiPerf
} // namespace Developtools
} // namespace OHOS

View File

@ -650,6 +650,19 @@ HWTEST_F(UtilitiesTest, CanonicalizeSpecPath, TestSize.Level1)
largePath += ".txt";
EXPECT_EQ(CanonicalizeSpecPath(largePath.c_str()), "");
}
/**
* @tc.name: RecordStdoutInit
* @tc.desc:
* @tc.type: FUNC
*/
HWTEST_F(UtilitiesTest, RecordStdoutInit, TestSize.Level1)
{
StdoutRecord stdnormaloutRecord("/data/local/tmp/hiperf_log.txt", "rw");
(void)stdnormaloutRecord.Stop();
StdoutRecord stdexceptoutRecord("/data/local/tmp/../hiperf_log.txt");
EXPECT_EQ(stdexceptoutRecord.Stop().empty(), true);
}
} // namespace HiPerf
} // namespace Developtools
} // namespace OHOS