mirror of
https://gitee.com/openharmony/developtools_hiperf
synced 2024-11-23 07:29:42 +00:00
commit
3f6a3aecb3
2
OAT.xml
2
OAT.xml
@ -119,8 +119,6 @@ Note:If the text contains special characters, please escape them according to th
|
||||
<filteritem type="filepath" name="test/unittest/resource/testdata/dwarf.uncompress.data" desc="the binary file for test, the file is self-developed"/>
|
||||
<filteritem type="filepath" name="test/unittest/resource/testdata/fp.compress.data" desc="the binary file for test, the file is self-developed"/>
|
||||
<filteritem type="filepath" name="test/unittest/resource/testdata/fp.uncompress.data" desc="the binary file for test, the file is self-developed"/>
|
||||
<filteritem type="filepath" name="test/unittest/resource/testdata/invalid_perf.data.tar.gz" desc="the binary file for test, the file is self-developed"/>
|
||||
<filteritem type="filepath" name="test/unittest/resource/testdata/invalid_gzip_perf.data.tar.gz" desc="the binary file for test, the file is self-developed"/>
|
||||
<filteritem type="filepath" name="demo/js/entry/src/main/resources/base/media/icon.png" desc="the binary file, the file is self-picture"/>
|
||||
<filteritem type="filepath" name="figures/hiperf_architecture.png" desc="the binary file, the file is self-picture"/>
|
||||
<filteritem type="filepath" name="figures/hiperf_architecture_zh.png" desc="the binary file, the file is self-picture"/>
|
||||
|
@ -678,6 +678,29 @@ HWTEST_F(PerfEventRecordTest, SwitchCpuWide, TestSize.Level1)
|
||||
ASSERT_TRUE(record.GetBinary(buff));
|
||||
ASSERT_EQ(CompareByteStream((uint8_t *)&data, buff.data(), sizeof(data)), 0);
|
||||
}
|
||||
|
||||
HWTEST_F(PerfEventRecordTest, GetPerfEventRecord, TestSize.Level1)
|
||||
{
|
||||
struct PerfRecordSwitchCpuWidest {
|
||||
perf_event_header h;
|
||||
PerfRecordSwitchCpuWideData d;
|
||||
};
|
||||
PerfRecordSwitchCpuWidest data = {
|
||||
{PERF_RECORD_SWITCH_CPU_WIDE, PERF_RECORD_MISC_KERNEL, sizeof(PerfRecordSwitchCpuWidest)},
|
||||
{}};
|
||||
perf_event_attr attr {};
|
||||
attr.sample_type = UINT64_MAX;
|
||||
for (size_t type = PERF_RECORD_MMAP; type <= PERF_RECORD_MAX; type++) {
|
||||
if (type == PERF_RECORD_SAMPLE) {
|
||||
continue;
|
||||
}
|
||||
std::unique_ptr<PerfEventRecord> perfEventRecord =
|
||||
GetPerfEventRecord(static_cast<perf_event_type>(type), reinterpret_cast<uint8_t *>(&data), attr);
|
||||
if (type < PERF_RECORD_NAMESPACES) {
|
||||
ASSERT_EQ(perfEventRecord != nullptr, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace HiPerf
|
||||
} // namespace Developtools
|
||||
} // namespace OHOS
|
||||
|
@ -75,13 +75,11 @@ HWTEST_F(RegisterTest, GetSupportedRegMask, TestSize.Level1)
|
||||
*/
|
||||
HWTEST_F(RegisterTest, RegisterGetIP, TestSize.Level1)
|
||||
{
|
||||
#if defined(target_cpu_x86_64)
|
||||
EXPECT_EQ(RegisterGetIP(ArchType::ARCH_X86), PERF_REG_X86_IP);
|
||||
EXPECT_EQ(RegisterGetIP(ArchType::ARCH_X86_64), PERF_REG_X86_IP);
|
||||
#elif defined(target_cpu_arm)
|
||||
EXPECT_EQ(RegisterGetIP(ArchType::ARCH_ARM), PERF_REG_ARM_PC);
|
||||
#elif defined(target_cpu_arm64)
|
||||
EXPECT_EQ(RegisterGetIP(ArchType::ARCH_ARM64), PERF_REG_ARM64_PC);
|
||||
#endif
|
||||
EXPECT_EQ(RegisterGetIP(ArchType::ARCH_UNKNOWN), std::numeric_limits<size_t>::max());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -868,7 +868,7 @@ HWTEST_F(SubCommandRecordTest, DataLimitErr, TestSize.Level1)
|
||||
|
||||
HWTEST_F(SubCommandRecordTest, RecordCompress, TestSize.Level1)
|
||||
{
|
||||
ForkAndRunTest("-d 2 -z ");
|
||||
ForkAndRunTest("-d 2 -z -o /data/local/tmp/perf.data.tar.gz");
|
||||
}
|
||||
|
||||
HWTEST_F(SubCommandRecordTest, Verbose, TestSize.Level1)
|
||||
@ -1076,7 +1076,7 @@ HWTEST_F(SubCommandRecordTest, FileSizeOnFrequency500_DWARF_PROCESS, TestSize.Le
|
||||
*/
|
||||
HWTEST_F(SubCommandRecordTest, FileSizeOnFrequency1000_DWARF_PROCESS, TestSize.Level1)
|
||||
{
|
||||
ForkAndRunTest("-d 10 --app -f 1000 -s dwarf", true, true);
|
||||
ForkAndRunTest("-d 10 -f 1000 -s dwarf", true, true);
|
||||
std::string fileName = TEST_FILE;
|
||||
size_t fileSize = GetFileSize(fileName.c_str());
|
||||
EXPECT_LE(fileSize, TEST_SIZE_F1000_DWARF_PROCESS);
|
||||
@ -1239,6 +1239,16 @@ HWTEST_F(SubCommandRecordTest, ExcludeErrorThreadNames, TestSize.Level1)
|
||||
ForkAndRunTest("-d 2 --exclude-thread test1,test2 ", true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: ExcludeTids
|
||||
* @tc.desc: Test --exclude-tid
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SubCommandRecordTest, ExcludeTids, TestSize.Level1)
|
||||
{
|
||||
ForkAndRunTest("-d 2 -s dwarf -f 2000 --exclude-tid 200");
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: ExcludeMixedThreadName
|
||||
* @tc.desc: Test --exclude-thread option mixed correct name and error name
|
||||
@ -1463,6 +1473,96 @@ HWTEST_F(SubCommandRecordTest, TraceCommandErr, TestSize.Level1)
|
||||
{
|
||||
TestRecordCommand("-d 2 -s dwarf invalidcommand", false, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: TestInputErr
|
||||
* @tc.desc: Test input with -a
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SubCommandRecordTest, TestInputErr, TestSize.Level1)
|
||||
{
|
||||
TestRecordCommand("-d 2 -a -s dwarf -f 2000 --pipe_input", false, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: TestOutputErr
|
||||
* @tc.desc: Test output with -a
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SubCommandRecordTest, TestOutputErr, TestSize.Level1)
|
||||
{
|
||||
TestRecordCommand("-d 2 -a -s dwarf -f 2000 --pipe_output", false, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: TestBranchFilterErr
|
||||
* @tc.desc: Test branch filter with -a
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SubCommandRecordTest, TestBranchFilterErr, TestSize.Level1)
|
||||
{
|
||||
TestRecordCommand("-d 2 -a -s dwarf -f 2000 -j", false, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: TestCallStackErr
|
||||
* @tc.desc: Test call stack with -a
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SubCommandRecordTest, TestCallStackErr, TestSize.Level1)
|
||||
{
|
||||
TestRecordCommand("-d 2 -a -f 2000 --call-stack", false, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: TestEventGroupErr
|
||||
* @tc.desc: Test event group with -a
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SubCommandRecordTest, TestEventGroupErr, TestSize.Level1)
|
||||
{
|
||||
TestRecordCommand("-d 2 -a -f 2000 -g", false, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: TestExcludeThreadErr
|
||||
* @tc.desc: Test exclude-thread with -a
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SubCommandRecordTest, TestExcludeThreadErr, TestSize.Level1)
|
||||
{
|
||||
TestRecordCommand("-d 2 -a -f 2000 --exclude-thread", false, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: TestSymbolDirErr
|
||||
* @tc.desc: Test symbol-dir with -a
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SubCommandRecordTest, TestSymbolDirErr, TestSize.Level1)
|
||||
{
|
||||
TestRecordCommand("-d 2 -a -f 2000 --symbol-dir", false, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: TestControlErr
|
||||
* @tc.desc: Test control with -a
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SubCommandRecordTest, TestControlErr, TestSize.Level1)
|
||||
{
|
||||
TestRecordCommand("-d 2 -a -f 2000 --control", false, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: TestCmdlineSizeErr
|
||||
* @tc.desc: Test cmdline-size with -a
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SubCommandRecordTest, TestCmdlineSizeErr, TestSize.Level1)
|
||||
{
|
||||
TestRecordCommand("-d 2 -a -f 2000 --cmdline-size", false, false);
|
||||
}
|
||||
} // namespace HiPerf
|
||||
} // namespace Developtools
|
||||
} // namespace OHOS
|
||||
|
@ -215,7 +215,9 @@ HWTEST_F(SubCommandReportTest, TestOnSubCommand_gzip_fail, TestSize.Level1)
|
||||
StdoutRecord stdoutRecord;
|
||||
stdoutRecord.Start();
|
||||
const auto startTime = chrono::steady_clock::now();
|
||||
EXPECT_EQ(Command::DispatchCommand("report -i " + RESOURCE_PATH + "invalid_perf.data.tar.gz"), false);
|
||||
std::string cmd = "tar -czvf " + RESOURCE_PATH + "report_test.data.tar.gz " + RESOURCE_PATH + "report_test.data";
|
||||
std::system(cmd.c_str());
|
||||
EXPECT_EQ(Command::DispatchCommand("report -i " + RESOURCE_PATH + "report_test.data.tar.gz"), false);
|
||||
const auto costMs = std::chrono::duration_cast<std::chrono::milliseconds>(
|
||||
chrono::steady_clock::now() - startTime);
|
||||
EXPECT_LE(costMs.count(), DEFAULT_RUN_TIMEOUT_MS);
|
||||
@ -227,16 +229,16 @@ HWTEST_F(SubCommandReportTest, TestOnSubCommand_gzip_fail, TestSize.Level1)
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: TestOnSubCommand_gzip_fail1
|
||||
* @tc.name: TestOnSubCommand_gzip
|
||||
* @tc.desc:
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SubCommandReportTest, TestOnSubCommand_gzip_fail1, TestSize.Level1)
|
||||
HWTEST_F(SubCommandReportTest, TestOnSubCommand_gzip, TestSize.Level1)
|
||||
{
|
||||
StdoutRecord stdoutRecord;
|
||||
stdoutRecord.Start();
|
||||
const auto startTime = chrono::steady_clock::now();
|
||||
EXPECT_EQ(Command::DispatchCommand("report -i " + RESOURCE_PATH + "invalid_gzip_perf.data.tar.gz"), false);
|
||||
EXPECT_EQ(Command::DispatchCommand("report -i /data/local/tmp/perf.data.tar.gz"), true);
|
||||
const auto costMs = std::chrono::duration_cast<std::chrono::milliseconds>(
|
||||
chrono::steady_clock::now() - startTime);
|
||||
EXPECT_LE(costMs.count(), DEFAULT_RUN_TIMEOUT_MS);
|
||||
@ -1248,6 +1250,28 @@ HWTEST_F(SubCommandReportTest, TestFpUnCompress, TestSize.Level1)
|
||||
const std::string expectPercentageStr = "|- 53.27% __kmalloc_reserve";
|
||||
EXPECT_EQ(FindExpectStr(stringOut, expectPercentageStr), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: TestOnSubCommand_from_funcs_fail
|
||||
* @tc.desc:
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SubCommandReportTest, TestOnSubCommand_from_funcs_fail, TestSize.Level1)
|
||||
{
|
||||
StdoutRecord stdoutRecord;
|
||||
stdoutRecord.Start();
|
||||
const auto startTime = chrono::steady_clock::now();
|
||||
EXPECT_EQ(Command::DispatchCommand("report -i " + RESOURCE_PATH +
|
||||
"report_test.data --from_funcs"),
|
||||
false);
|
||||
const auto costMs = std::chrono::duration_cast<std::chrono::milliseconds>(
|
||||
chrono::steady_clock::now() - startTime);
|
||||
EXPECT_LE(costMs.count(), DEFAULT_RUN_TIMEOUT_MS);
|
||||
std::string stringOut = stdoutRecord.Stop();
|
||||
if (HasFailure()) {
|
||||
printf("output:\n%s", stringOut.c_str());
|
||||
}
|
||||
}
|
||||
} // namespace HiPerf
|
||||
} // namespace Developtools
|
||||
} // namespace OHOS
|
||||
|
@ -79,8 +79,6 @@
|
||||
|
||||
<option name="push" value="testdata/perfnew.data -> /data/test/resource/testdata/" src="res"/>
|
||||
<option name="push" value="testdata/report_test.data -> /data/test/resource/testdata/" src="res"/>
|
||||
<option name="push" value="testdata/invalid_gzip_perf.data.tar.gz -> /data/test/resource/testdata/" src="res"/>
|
||||
<option name="push" value="testdata/invalid_perf.data.tar.gz -> /data/test/resource/testdata/" src="res"/>
|
||||
<option name="push" value="testdata/report_test_i.txt -> /data/test/resource/testdata/" src="res"/>
|
||||
<option name="push" value="testdata/report_test_diff.txt -> /data/test/resource/testdata/" src="res"/>
|
||||
<option name="push" value="testdata/report_test_sort1.txt -> /data/test/resource/testdata/" src="res"/>
|
||||
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user