diff options
author | Yabin Cui <yabinc@google.com> | 2017-07-13 00:51:08 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-07-13 00:51:08 +0000 |
commit | bcde05ec437efe8059d2495bc7d487f55843d6cf (patch) | |
tree | a5f64a1db5d186cb0e5cfdb50d5a418fa4e4defb | |
parent | a69f1ec5c0cbd01bac15c7a8e2d3a1b58945af1f (diff) | |
parent | c4eb610186866cce7e96a4fd67c43730252cab99 (diff) | |
download | extras-bcde05ec437efe8059d2495bc7d487f55843d6cf.tar.gz |
Merge "simpleperf: enforce support of dwarf based callgraph." am: 1564048fd3 am: 63d9e48597 am: aedec0dc79
am: c4eb610186
Change-Id: Ic4b01a66be4dfa3b2a2f35a74c5afa1ac313b194
-rw-r--r-- | simpleperf/cmd_record_test.cpp | 72 | ||||
-rw-r--r-- | simpleperf/cmd_report_test.cpp | 22 |
2 files changed, 36 insertions, 58 deletions
diff --git a/simpleperf/cmd_record_test.cpp b/simpleperf/cmd_record_test.cpp index 571a3ca0..1cb8d1ce 100644 --- a/simpleperf/cmd_record_test.cpp +++ b/simpleperf/cmd_record_test.cpp @@ -156,49 +156,33 @@ TEST(record_cmd, system_wide_fp_callchain_sampling) { } TEST(record_cmd, dwarf_callchain_sampling) { - if (IsDwarfCallChainSamplingSupported()) { - std::vector<std::unique_ptr<Workload>> workloads; - CreateProcesses(1, &workloads); - std::string pid = std::to_string(workloads[0]->GetPid()); - ASSERT_TRUE(RunRecordCmd({"-p", pid, "--call-graph", "dwarf"})); - ASSERT_TRUE(RunRecordCmd({"-p", pid, "--call-graph", "dwarf,16384"})); - ASSERT_FALSE(RunRecordCmd({"-p", pid, "--call-graph", "dwarf,65536"})); - ASSERT_TRUE(RunRecordCmd({"-p", pid, "-g"})); - } else { - GTEST_LOG_(INFO) << "This test does nothing as dwarf callchain sampling is " - "not supported on this device."; - } + ASSERT_TRUE(IsDwarfCallChainSamplingSupported()); + std::vector<std::unique_ptr<Workload>> workloads; + CreateProcesses(1, &workloads); + std::string pid = std::to_string(workloads[0]->GetPid()); + ASSERT_TRUE(RunRecordCmd({"-p", pid, "--call-graph", "dwarf"})); + ASSERT_TRUE(RunRecordCmd({"-p", pid, "--call-graph", "dwarf,16384"})); + ASSERT_FALSE(RunRecordCmd({"-p", pid, "--call-graph", "dwarf,65536"})); + ASSERT_TRUE(RunRecordCmd({"-p", pid, "-g"})); } TEST(record_cmd, system_wide_dwarf_callchain_sampling) { - if (IsDwarfCallChainSamplingSupported()) { - TEST_IN_ROOT(RunRecordCmd({"-a", "--call-graph", "dwarf"})); - } else { - GTEST_LOG_(INFO) << "This test does nothing as dwarf callchain sampling is " - "not supported on this device."; - } + ASSERT_TRUE(IsDwarfCallChainSamplingSupported()); + TEST_IN_ROOT(RunRecordCmd({"-a", "--call-graph", "dwarf"})); } TEST(record_cmd, no_unwind_option) { - if (IsDwarfCallChainSamplingSupported()) { - ASSERT_TRUE(RunRecordCmd({"--call-graph", "dwarf", "--no-unwind"})); - } else { - GTEST_LOG_(INFO) << "This test does nothing as dwarf callchain sampling is " - "not supported on this device."; - } + ASSERT_TRUE(IsDwarfCallChainSamplingSupported()); + ASSERT_TRUE(RunRecordCmd({"--call-graph", "dwarf", "--no-unwind"})); ASSERT_FALSE(RunRecordCmd({"--no-unwind"})); } TEST(record_cmd, post_unwind_option) { - if (IsDwarfCallChainSamplingSupported()) { - std::vector<std::unique_ptr<Workload>> workloads; - CreateProcesses(1, &workloads); - std::string pid = std::to_string(workloads[0]->GetPid()); - ASSERT_TRUE(RunRecordCmd({"-p", pid, "--call-graph", "dwarf", "--post-unwind"})); - } else { - GTEST_LOG_(INFO) << "This test does nothing as dwarf callchain sampling is " - "not supported on this device."; - } + ASSERT_TRUE(IsDwarfCallChainSamplingSupported()); + std::vector<std::unique_ptr<Workload>> workloads; + CreateProcesses(1, &workloads); + std::string pid = std::to_string(workloads[0]->GetPid()); + ASSERT_TRUE(RunRecordCmd({"-p", pid, "--call-graph", "dwarf", "--post-unwind"})); ASSERT_FALSE(RunRecordCmd({"--post-unwind"})); ASSERT_FALSE( RunRecordCmd({"--call-graph", "dwarf", "--no-unwind", "--post-unwind"})); @@ -312,18 +296,16 @@ TEST(record_cmd, no_dump_symbols) { ASSERT_TRUE(RunRecordCmd({"--no-dump-symbols"}, tmpfile.path)); CheckDsoSymbolRecords(tmpfile.path, false, &success); ASSERT_TRUE(success); - if (IsDwarfCallChainSamplingSupported()) { - std::vector<std::unique_ptr<Workload>> workloads; - CreateProcesses(1, &workloads); - std::string pid = std::to_string(workloads[0]->GetPid()); - ASSERT_TRUE(RunRecordCmd({"-p", pid, "-g"}, tmpfile.path)); - bool success; - CheckDsoSymbolRecords(tmpfile.path, true, &success); - ASSERT_TRUE(success); - ASSERT_TRUE(RunRecordCmd({"-p", pid, "-g", "--no-dump-symbols"}, tmpfile.path)); - CheckDsoSymbolRecords(tmpfile.path, false, &success); - ASSERT_TRUE(success); - } + ASSERT_TRUE(IsDwarfCallChainSamplingSupported()); + std::vector<std::unique_ptr<Workload>> workloads; + CreateProcesses(1, &workloads); + std::string pid = std::to_string(workloads[0]->GetPid()); + ASSERT_TRUE(RunRecordCmd({"-p", pid, "-g"}, tmpfile.path)); + CheckDsoSymbolRecords(tmpfile.path, true, &success); + ASSERT_TRUE(success); + ASSERT_TRUE(RunRecordCmd({"-p", pid, "-g", "--no-dump-symbols"}, tmpfile.path)); + CheckDsoSymbolRecords(tmpfile.path, false, &success); + ASSERT_TRUE(success); } TEST(record_cmd, dump_kernel_symbols) { diff --git a/simpleperf/cmd_report_test.cpp b/simpleperf/cmd_report_test.cpp index bf690c0f..f1f5b1fc 100644 --- a/simpleperf/cmd_report_test.cpp +++ b/simpleperf/cmd_report_test.cpp @@ -479,19 +479,15 @@ static std::unique_ptr<Command> RecordCmd() { } TEST_F(ReportCommandTest, dwarf_callgraph) { - if (IsDwarfCallChainSamplingSupported()) { - std::vector<std::unique_ptr<Workload>> workloads; - CreateProcesses(1, &workloads); - std::string pid = std::to_string(workloads[0]->GetPid()); - TemporaryFile tmp_file; - ASSERT_TRUE( - RecordCmd()->Run({"-p", pid, "-g", "-o", tmp_file.path, "sleep", SLEEP_SEC})); - ReportRaw(tmp_file.path, {"-g"}); - ASSERT_TRUE(success); - } else { - GTEST_LOG_(INFO) << "This test does nothing as dwarf callchain sampling is " - "not supported on this device."; - } + ASSERT_TRUE(IsDwarfCallChainSamplingSupported()); + std::vector<std::unique_ptr<Workload>> workloads; + CreateProcesses(1, &workloads); + std::string pid = std::to_string(workloads[0]->GetPid()); + TemporaryFile tmp_file; + ASSERT_TRUE( + RecordCmd()->Run({"-p", pid, "-g", "-o", tmp_file.path, "sleep", SLEEP_SEC})); + ReportRaw(tmp_file.path, {"-g"}); + ASSERT_TRUE(success); } TEST_F(ReportCommandTest, report_dwarf_callgraph_of_nativelib_in_apk) { |