1*288bf522SAndroid Build Coastguard Worker /*
2*288bf522SAndroid Build Coastguard Worker * Copyright (C) 2015 The Android Open Source Project
3*288bf522SAndroid Build Coastguard Worker *
4*288bf522SAndroid Build Coastguard Worker * Licensed under the Apache License, Version 2.0 (the "License");
5*288bf522SAndroid Build Coastguard Worker * you may not use this file except in compliance with the License.
6*288bf522SAndroid Build Coastguard Worker * You may obtain a copy of the License at
7*288bf522SAndroid Build Coastguard Worker *
8*288bf522SAndroid Build Coastguard Worker * http://www.apache.org/licenses/LICENSE-2.0
9*288bf522SAndroid Build Coastguard Worker *
10*288bf522SAndroid Build Coastguard Worker * Unless required by applicable law or agreed to in writing, software
11*288bf522SAndroid Build Coastguard Worker * distributed under the License is distributed on an "AS IS" BASIS,
12*288bf522SAndroid Build Coastguard Worker * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*288bf522SAndroid Build Coastguard Worker * See the License for the specific language governing permissions and
14*288bf522SAndroid Build Coastguard Worker * limitations under the License.
15*288bf522SAndroid Build Coastguard Worker */
16*288bf522SAndroid Build Coastguard Worker
17*288bf522SAndroid Build Coastguard Worker #include <gtest/gtest.h>
18*288bf522SAndroid Build Coastguard Worker
19*288bf522SAndroid Build Coastguard Worker #include <set>
20*288bf522SAndroid Build Coastguard Worker #include <unordered_map>
21*288bf522SAndroid Build Coastguard Worker
22*288bf522SAndroid Build Coastguard Worker #include <android-base/file.h>
23*288bf522SAndroid Build Coastguard Worker #include <android-base/parseint.h>
24*288bf522SAndroid Build Coastguard Worker #include <android-base/strings.h>
25*288bf522SAndroid Build Coastguard Worker #include <android-base/test_utils.h>
26*288bf522SAndroid Build Coastguard Worker
27*288bf522SAndroid Build Coastguard Worker #include "RegEx.h"
28*288bf522SAndroid Build Coastguard Worker #include "command.h"
29*288bf522SAndroid Build Coastguard Worker #include "get_test_data.h"
30*288bf522SAndroid Build Coastguard Worker #include "perf_regs.h"
31*288bf522SAndroid Build Coastguard Worker #include "read_apk.h"
32*288bf522SAndroid Build Coastguard Worker #include "test_util.h"
33*288bf522SAndroid Build Coastguard Worker
34*288bf522SAndroid Build Coastguard Worker using namespace simpleperf;
35*288bf522SAndroid Build Coastguard Worker
ReportCmd()36*288bf522SAndroid Build Coastguard Worker static std::unique_ptr<Command> ReportCmd() {
37*288bf522SAndroid Build Coastguard Worker return CreateCommandInstance("report");
38*288bf522SAndroid Build Coastguard Worker }
39*288bf522SAndroid Build Coastguard Worker
40*288bf522SAndroid Build Coastguard Worker // @CddTest = 6.1/C-0-2
41*288bf522SAndroid Build Coastguard Worker class ReportCommandTest : public ::testing::Test {
42*288bf522SAndroid Build Coastguard Worker protected:
Report(const std::string & perf_data,const std::vector<std::string> & add_args=std::vector<std::string> (),bool with_symfs=true)43*288bf522SAndroid Build Coastguard Worker void Report(const std::string& perf_data,
44*288bf522SAndroid Build Coastguard Worker const std::vector<std::string>& add_args = std::vector<std::string>(),
45*288bf522SAndroid Build Coastguard Worker bool with_symfs = true) {
46*288bf522SAndroid Build Coastguard Worker ReportRaw(GetTestData(perf_data), add_args, with_symfs);
47*288bf522SAndroid Build Coastguard Worker }
48*288bf522SAndroid Build Coastguard Worker
ReportRaw(const std::string & perf_data,const std::vector<std::string> & add_args=std::vector<std::string> (),bool with_symfs=true)49*288bf522SAndroid Build Coastguard Worker void ReportRaw(const std::string& perf_data,
50*288bf522SAndroid Build Coastguard Worker const std::vector<std::string>& add_args = std::vector<std::string>(),
51*288bf522SAndroid Build Coastguard Worker bool with_symfs = true) {
52*288bf522SAndroid Build Coastguard Worker success = false;
53*288bf522SAndroid Build Coastguard Worker TemporaryFile tmp_file;
54*288bf522SAndroid Build Coastguard Worker std::vector<std::string> args = {"-i", perf_data, "-o", tmp_file.path};
55*288bf522SAndroid Build Coastguard Worker
56*288bf522SAndroid Build Coastguard Worker if (with_symfs) {
57*288bf522SAndroid Build Coastguard Worker args.emplace_back("--symfs");
58*288bf522SAndroid Build Coastguard Worker args.emplace_back(GetTestDataDir());
59*288bf522SAndroid Build Coastguard Worker }
60*288bf522SAndroid Build Coastguard Worker
61*288bf522SAndroid Build Coastguard Worker args.insert(args.end(), add_args.begin(), add_args.end());
62*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(ReportCmd()->Run(args));
63*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(android::base::ReadFileToString(tmp_file.path, &content));
64*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(!content.empty());
65*288bf522SAndroid Build Coastguard Worker std::vector<std::string> raw_lines = android::base::Split(content, "\n");
66*288bf522SAndroid Build Coastguard Worker lines.clear();
67*288bf522SAndroid Build Coastguard Worker for (const auto& line : raw_lines) {
68*288bf522SAndroid Build Coastguard Worker std::string s = android::base::Trim(line);
69*288bf522SAndroid Build Coastguard Worker if (!s.empty()) {
70*288bf522SAndroid Build Coastguard Worker lines.push_back(s);
71*288bf522SAndroid Build Coastguard Worker }
72*288bf522SAndroid Build Coastguard Worker }
73*288bf522SAndroid Build Coastguard Worker ASSERT_GE(lines.size(), 2u);
74*288bf522SAndroid Build Coastguard Worker success = true;
75*288bf522SAndroid Build Coastguard Worker }
76*288bf522SAndroid Build Coastguard Worker
GetSampleCount()77*288bf522SAndroid Build Coastguard Worker size_t GetSampleCount() {
78*288bf522SAndroid Build Coastguard Worker auto regex = RegEx::Create(R"(Samples: (\d+))");
79*288bf522SAndroid Build Coastguard Worker auto match = regex->SearchAll(content);
80*288bf522SAndroid Build Coastguard Worker if (match->IsValid()) {
81*288bf522SAndroid Build Coastguard Worker size_t count;
82*288bf522SAndroid Build Coastguard Worker if (android::base::ParseUint(match->GetField(1), &count)) {
83*288bf522SAndroid Build Coastguard Worker return count;
84*288bf522SAndroid Build Coastguard Worker }
85*288bf522SAndroid Build Coastguard Worker }
86*288bf522SAndroid Build Coastguard Worker return 0;
87*288bf522SAndroid Build Coastguard Worker }
88*288bf522SAndroid Build Coastguard Worker
89*288bf522SAndroid Build Coastguard Worker std::string content;
90*288bf522SAndroid Build Coastguard Worker std::vector<std::string> lines;
91*288bf522SAndroid Build Coastguard Worker bool success;
92*288bf522SAndroid Build Coastguard Worker };
93*288bf522SAndroid Build Coastguard Worker
94*288bf522SAndroid Build Coastguard Worker // @CddTest = 6.1/C-0-2
TEST_F(ReportCommandTest,no_option)95*288bf522SAndroid Build Coastguard Worker TEST_F(ReportCommandTest, no_option) {
96*288bf522SAndroid Build Coastguard Worker Report(PERF_DATA);
97*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
98*288bf522SAndroid Build Coastguard Worker ASSERT_NE(content.find("GlobalFunc"), std::string::npos);
99*288bf522SAndroid Build Coastguard Worker }
100*288bf522SAndroid Build Coastguard Worker
101*288bf522SAndroid Build Coastguard Worker // @CddTest = 6.1/C-0-2
TEST_F(ReportCommandTest,report_symbol_from_elf_file_with_mini_debug_info)102*288bf522SAndroid Build Coastguard Worker TEST_F(ReportCommandTest, report_symbol_from_elf_file_with_mini_debug_info) {
103*288bf522SAndroid Build Coastguard Worker Report(PERF_DATA_WITH_MINI_DEBUG_INFO);
104*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
105*288bf522SAndroid Build Coastguard Worker ASSERT_NE(content.find("GlobalFunc"), std::string::npos);
106*288bf522SAndroid Build Coastguard Worker }
107*288bf522SAndroid Build Coastguard Worker
108*288bf522SAndroid Build Coastguard Worker // @CddTest = 6.1/C-0-2
TEST_F(ReportCommandTest,sort_option_pid)109*288bf522SAndroid Build Coastguard Worker TEST_F(ReportCommandTest, sort_option_pid) {
110*288bf522SAndroid Build Coastguard Worker Report(PERF_DATA, {"--sort", "pid"});
111*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
112*288bf522SAndroid Build Coastguard Worker size_t line_index = 0;
113*288bf522SAndroid Build Coastguard Worker while (line_index < lines.size() && lines[line_index].find("Pid") == std::string::npos) {
114*288bf522SAndroid Build Coastguard Worker line_index++;
115*288bf522SAndroid Build Coastguard Worker }
116*288bf522SAndroid Build Coastguard Worker ASSERT_LT(line_index + 2, lines.size());
117*288bf522SAndroid Build Coastguard Worker }
118*288bf522SAndroid Build Coastguard Worker
119*288bf522SAndroid Build Coastguard Worker // @CddTest = 6.1/C-0-2
TEST_F(ReportCommandTest,sort_option_more_than_one)120*288bf522SAndroid Build Coastguard Worker TEST_F(ReportCommandTest, sort_option_more_than_one) {
121*288bf522SAndroid Build Coastguard Worker Report(PERF_DATA, {"--sort", "comm,pid,dso,symbol"});
122*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
123*288bf522SAndroid Build Coastguard Worker size_t line_index = 0;
124*288bf522SAndroid Build Coastguard Worker while (line_index < lines.size() && lines[line_index].find("Overhead") == std::string::npos) {
125*288bf522SAndroid Build Coastguard Worker line_index++;
126*288bf522SAndroid Build Coastguard Worker }
127*288bf522SAndroid Build Coastguard Worker ASSERT_LT(line_index + 1, lines.size());
128*288bf522SAndroid Build Coastguard Worker ASSERT_NE(lines[line_index].find("Command"), std::string::npos);
129*288bf522SAndroid Build Coastguard Worker ASSERT_NE(lines[line_index].find("Pid"), std::string::npos);
130*288bf522SAndroid Build Coastguard Worker ASSERT_NE(lines[line_index].find("Shared Object"), std::string::npos);
131*288bf522SAndroid Build Coastguard Worker ASSERT_NE(lines[line_index].find("Symbol"), std::string::npos);
132*288bf522SAndroid Build Coastguard Worker ASSERT_EQ(lines[line_index].find("Tid"), std::string::npos);
133*288bf522SAndroid Build Coastguard Worker }
134*288bf522SAndroid Build Coastguard Worker
135*288bf522SAndroid Build Coastguard Worker // @CddTest = 6.1/C-0-2
TEST_F(ReportCommandTest,children_option)136*288bf522SAndroid Build Coastguard Worker TEST_F(ReportCommandTest, children_option) {
137*288bf522SAndroid Build Coastguard Worker Report(CALLGRAPH_FP_PERF_DATA, {"--children", "--sort", "symbol"});
138*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
139*288bf522SAndroid Build Coastguard Worker std::unordered_map<std::string, std::pair<double, double>> map;
140*288bf522SAndroid Build Coastguard Worker for (size_t i = 0; i < lines.size(); ++i) {
141*288bf522SAndroid Build Coastguard Worker char name[1024];
142*288bf522SAndroid Build Coastguard Worker std::pair<double, double> pair;
143*288bf522SAndroid Build Coastguard Worker if (sscanf(lines[i].c_str(), "%lf%%%lf%%%s", &pair.first, &pair.second, name) == 3) {
144*288bf522SAndroid Build Coastguard Worker map.insert(std::make_pair(name, pair));
145*288bf522SAndroid Build Coastguard Worker }
146*288bf522SAndroid Build Coastguard Worker }
147*288bf522SAndroid Build Coastguard Worker ASSERT_NE(map.find("GlobalFunc"), map.end());
148*288bf522SAndroid Build Coastguard Worker ASSERT_NE(map.find("main"), map.end());
149*288bf522SAndroid Build Coastguard Worker auto func_pair = map["GlobalFunc"];
150*288bf522SAndroid Build Coastguard Worker auto main_pair = map["main"];
151*288bf522SAndroid Build Coastguard Worker ASSERT_GE(main_pair.first, func_pair.first);
152*288bf522SAndroid Build Coastguard Worker ASSERT_GE(func_pair.first, func_pair.second);
153*288bf522SAndroid Build Coastguard Worker ASSERT_GE(func_pair.second, main_pair.second);
154*288bf522SAndroid Build Coastguard Worker }
155*288bf522SAndroid Build Coastguard Worker
CheckCalleeMode(std::vector<std::string> & lines)156*288bf522SAndroid Build Coastguard Worker static bool CheckCalleeMode(std::vector<std::string>& lines) {
157*288bf522SAndroid Build Coastguard Worker bool found = false;
158*288bf522SAndroid Build Coastguard Worker for (size_t i = 0; i + 1 < lines.size(); ++i) {
159*288bf522SAndroid Build Coastguard Worker if (lines[i].find("GlobalFunc") != std::string::npos &&
160*288bf522SAndroid Build Coastguard Worker lines[i + 1].find("main") != std::string::npos) {
161*288bf522SAndroid Build Coastguard Worker found = true;
162*288bf522SAndroid Build Coastguard Worker break;
163*288bf522SAndroid Build Coastguard Worker }
164*288bf522SAndroid Build Coastguard Worker }
165*288bf522SAndroid Build Coastguard Worker return found;
166*288bf522SAndroid Build Coastguard Worker }
167*288bf522SAndroid Build Coastguard Worker
CheckCallerMode(std::vector<std::string> & lines)168*288bf522SAndroid Build Coastguard Worker static bool CheckCallerMode(std::vector<std::string>& lines) {
169*288bf522SAndroid Build Coastguard Worker bool found = false;
170*288bf522SAndroid Build Coastguard Worker for (size_t i = 0; i + 1 < lines.size(); ++i) {
171*288bf522SAndroid Build Coastguard Worker if (lines[i].find("main") != std::string::npos &&
172*288bf522SAndroid Build Coastguard Worker lines[i + 1].find("GlobalFunc") != std::string::npos) {
173*288bf522SAndroid Build Coastguard Worker found = true;
174*288bf522SAndroid Build Coastguard Worker break;
175*288bf522SAndroid Build Coastguard Worker }
176*288bf522SAndroid Build Coastguard Worker }
177*288bf522SAndroid Build Coastguard Worker return found;
178*288bf522SAndroid Build Coastguard Worker }
179*288bf522SAndroid Build Coastguard Worker
180*288bf522SAndroid Build Coastguard Worker // @CddTest = 6.1/C-0-2
TEST_F(ReportCommandTest,callgraph_option)181*288bf522SAndroid Build Coastguard Worker TEST_F(ReportCommandTest, callgraph_option) {
182*288bf522SAndroid Build Coastguard Worker Report(CALLGRAPH_FP_PERF_DATA, {"-g"});
183*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
184*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(CheckCallerMode(lines));
185*288bf522SAndroid Build Coastguard Worker Report(CALLGRAPH_FP_PERF_DATA, {"-g", "callee"});
186*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
187*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(CheckCalleeMode(lines));
188*288bf522SAndroid Build Coastguard Worker Report(CALLGRAPH_FP_PERF_DATA, {"-g", "caller"});
189*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
190*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(CheckCallerMode(lines));
191*288bf522SAndroid Build Coastguard Worker }
192*288bf522SAndroid Build Coastguard Worker
AllItemsWithString(std::vector<std::string> & lines,const std::vector<std::string> & strs)193*288bf522SAndroid Build Coastguard Worker static bool AllItemsWithString(std::vector<std::string>& lines,
194*288bf522SAndroid Build Coastguard Worker const std::vector<std::string>& strs) {
195*288bf522SAndroid Build Coastguard Worker size_t line_index = 0;
196*288bf522SAndroid Build Coastguard Worker while (line_index < lines.size() && lines[line_index].find("Overhead") == std::string::npos) {
197*288bf522SAndroid Build Coastguard Worker line_index++;
198*288bf522SAndroid Build Coastguard Worker }
199*288bf522SAndroid Build Coastguard Worker if (line_index == lines.size() || line_index + 1 == lines.size()) {
200*288bf522SAndroid Build Coastguard Worker return false;
201*288bf522SAndroid Build Coastguard Worker }
202*288bf522SAndroid Build Coastguard Worker line_index++;
203*288bf522SAndroid Build Coastguard Worker for (; line_index < lines.size(); ++line_index) {
204*288bf522SAndroid Build Coastguard Worker bool exist = false;
205*288bf522SAndroid Build Coastguard Worker for (auto& s : strs) {
206*288bf522SAndroid Build Coastguard Worker if (lines[line_index].find(s) != std::string::npos) {
207*288bf522SAndroid Build Coastguard Worker exist = true;
208*288bf522SAndroid Build Coastguard Worker break;
209*288bf522SAndroid Build Coastguard Worker }
210*288bf522SAndroid Build Coastguard Worker }
211*288bf522SAndroid Build Coastguard Worker if (!exist) {
212*288bf522SAndroid Build Coastguard Worker return false;
213*288bf522SAndroid Build Coastguard Worker }
214*288bf522SAndroid Build Coastguard Worker }
215*288bf522SAndroid Build Coastguard Worker return true;
216*288bf522SAndroid Build Coastguard Worker }
217*288bf522SAndroid Build Coastguard Worker
218*288bf522SAndroid Build Coastguard Worker // @CddTest = 6.1/C-0-2
TEST_F(ReportCommandTest,pid_filter_option)219*288bf522SAndroid Build Coastguard Worker TEST_F(ReportCommandTest, pid_filter_option) {
220*288bf522SAndroid Build Coastguard Worker Report(PERF_DATA_WITH_MULTIPLE_PIDS_AND_TIDS, {"--sort", "pid"});
221*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
222*288bf522SAndroid Build Coastguard Worker ASSERT_FALSE(AllItemsWithString(lines, {"17441"}));
223*288bf522SAndroid Build Coastguard Worker ASSERT_FALSE(AllItemsWithString(lines, {"17441", "17443"}));
224*288bf522SAndroid Build Coastguard Worker Report(PERF_DATA_WITH_MULTIPLE_PIDS_AND_TIDS, {"--sort", "pid", "--pids", "17441"});
225*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
226*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(AllItemsWithString(lines, {"17441"}));
227*288bf522SAndroid Build Coastguard Worker Report(PERF_DATA_WITH_MULTIPLE_PIDS_AND_TIDS, {"--sort", "pid", "--pids", "17441,17443"});
228*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
229*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(AllItemsWithString(lines, {"17441", "17443"}));
230*288bf522SAndroid Build Coastguard Worker
231*288bf522SAndroid Build Coastguard Worker // Test that --pids option is not the same as --tids option.
232*288bf522SAndroid Build Coastguard Worker // Thread 17445 and 17441 are in process 17441.
233*288bf522SAndroid Build Coastguard Worker Report(PERF_DATA_WITH_MULTIPLE_PIDS_AND_TIDS, {"--sort", "tid", "--pids", "17441"});
234*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
235*288bf522SAndroid Build Coastguard Worker ASSERT_NE(content.find("17441"), std::string::npos);
236*288bf522SAndroid Build Coastguard Worker ASSERT_NE(content.find("17445"), std::string::npos);
237*288bf522SAndroid Build Coastguard Worker }
238*288bf522SAndroid Build Coastguard Worker
239*288bf522SAndroid Build Coastguard Worker // @CddTest = 6.1/C-0-2
TEST_F(ReportCommandTest,wrong_pid_filter_option)240*288bf522SAndroid Build Coastguard Worker TEST_F(ReportCommandTest, wrong_pid_filter_option) {
241*288bf522SAndroid Build Coastguard Worker ASSERT_EXIT(
242*288bf522SAndroid Build Coastguard Worker {
243*288bf522SAndroid Build Coastguard Worker Report(PERF_DATA_WITH_MULTIPLE_PIDS_AND_TIDS, {"--pids", "2,bogus"});
244*288bf522SAndroid Build Coastguard Worker exit(success ? 0 : 1);
245*288bf522SAndroid Build Coastguard Worker },
246*288bf522SAndroid Build Coastguard Worker testing::ExitedWithCode(1), "invalid pid: bogus");
247*288bf522SAndroid Build Coastguard Worker }
248*288bf522SAndroid Build Coastguard Worker
249*288bf522SAndroid Build Coastguard Worker // @CddTest = 6.1/C-0-2
TEST_F(ReportCommandTest,tid_filter_option)250*288bf522SAndroid Build Coastguard Worker TEST_F(ReportCommandTest, tid_filter_option) {
251*288bf522SAndroid Build Coastguard Worker Report(PERF_DATA_WITH_MULTIPLE_PIDS_AND_TIDS, {"--sort", "tid"});
252*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
253*288bf522SAndroid Build Coastguard Worker ASSERT_FALSE(AllItemsWithString(lines, {"17441"}));
254*288bf522SAndroid Build Coastguard Worker ASSERT_FALSE(AllItemsWithString(lines, {"17441", "17445"}));
255*288bf522SAndroid Build Coastguard Worker Report(PERF_DATA_WITH_MULTIPLE_PIDS_AND_TIDS, {"--sort", "tid", "--tids", "17441"});
256*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
257*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(AllItemsWithString(lines, {"17441"}));
258*288bf522SAndroid Build Coastguard Worker Report(PERF_DATA_WITH_MULTIPLE_PIDS_AND_TIDS, {"--sort", "tid", "--tids", "17441,17445"});
259*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
260*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(AllItemsWithString(lines, {"17441", "17445"}));
261*288bf522SAndroid Build Coastguard Worker }
262*288bf522SAndroid Build Coastguard Worker
263*288bf522SAndroid Build Coastguard Worker // @CddTest = 6.1/C-0-2
TEST_F(ReportCommandTest,wrong_tid_filter_option)264*288bf522SAndroid Build Coastguard Worker TEST_F(ReportCommandTest, wrong_tid_filter_option) {
265*288bf522SAndroid Build Coastguard Worker ASSERT_EXIT(
266*288bf522SAndroid Build Coastguard Worker {
267*288bf522SAndroid Build Coastguard Worker Report(PERF_DATA_WITH_MULTIPLE_PIDS_AND_TIDS, {"--tids", "2,bogus"});
268*288bf522SAndroid Build Coastguard Worker exit(success ? 0 : 1);
269*288bf522SAndroid Build Coastguard Worker },
270*288bf522SAndroid Build Coastguard Worker testing::ExitedWithCode(1), "Invalid tid 'bogus'");
271*288bf522SAndroid Build Coastguard Worker }
272*288bf522SAndroid Build Coastguard Worker
273*288bf522SAndroid Build Coastguard Worker // @CddTest = 6.1/C-0-2
TEST_F(ReportCommandTest,comm_filter_option)274*288bf522SAndroid Build Coastguard Worker TEST_F(ReportCommandTest, comm_filter_option) {
275*288bf522SAndroid Build Coastguard Worker Report(PERF_DATA, {"--sort", "comm"});
276*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
277*288bf522SAndroid Build Coastguard Worker ASSERT_FALSE(AllItemsWithString(lines, {"t1"}));
278*288bf522SAndroid Build Coastguard Worker ASSERT_FALSE(AllItemsWithString(lines, {"t1", "t2"}));
279*288bf522SAndroid Build Coastguard Worker Report(PERF_DATA, {"--sort", "comm", "--comms", "t1"});
280*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
281*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(AllItemsWithString(lines, {"t1"}));
282*288bf522SAndroid Build Coastguard Worker Report(PERF_DATA, {"--sort", "comm", "--comms", "t1,t2"});
283*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
284*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(AllItemsWithString(lines, {"t1", "t2"}));
285*288bf522SAndroid Build Coastguard Worker }
286*288bf522SAndroid Build Coastguard Worker
287*288bf522SAndroid Build Coastguard Worker // @CddTest = 6.1/C-0-2
TEST_F(ReportCommandTest,dso_filter_option)288*288bf522SAndroid Build Coastguard Worker TEST_F(ReportCommandTest, dso_filter_option) {
289*288bf522SAndroid Build Coastguard Worker Report(PERF_DATA, {"--sort", "dso"});
290*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
291*288bf522SAndroid Build Coastguard Worker ASSERT_FALSE(AllItemsWithString(lines, {"/t1"}));
292*288bf522SAndroid Build Coastguard Worker ASSERT_FALSE(AllItemsWithString(lines, {"/t1", "/t2"}));
293*288bf522SAndroid Build Coastguard Worker Report(PERF_DATA, {"--sort", "dso", "--dsos", "/t1"});
294*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
295*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(AllItemsWithString(lines, {"/t1"}));
296*288bf522SAndroid Build Coastguard Worker Report(PERF_DATA, {"--sort", "dso", "--dsos", "/t1,/t2"});
297*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
298*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(AllItemsWithString(lines, {"/t1", "/t2"}));
299*288bf522SAndroid Build Coastguard Worker }
300*288bf522SAndroid Build Coastguard Worker
301*288bf522SAndroid Build Coastguard Worker // @CddTest = 6.1/C-0-2
TEST_F(ReportCommandTest,symbol_filter_option)302*288bf522SAndroid Build Coastguard Worker TEST_F(ReportCommandTest, symbol_filter_option) {
303*288bf522SAndroid Build Coastguard Worker Report(PERF_DATA_WITH_SYMBOLS, {"--sort", "symbol"});
304*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
305*288bf522SAndroid Build Coastguard Worker ASSERT_FALSE(AllItemsWithString(lines, {"func2(int, int)"}));
306*288bf522SAndroid Build Coastguard Worker ASSERT_FALSE(AllItemsWithString(lines, {"main", "func2(int, int)"}));
307*288bf522SAndroid Build Coastguard Worker Report(PERF_DATA_WITH_SYMBOLS, {"--sort", "symbol", "--symbols", "func2(int, int)"});
308*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
309*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(AllItemsWithString(lines, {"func2(int, int)"}));
310*288bf522SAndroid Build Coastguard Worker Report(PERF_DATA_WITH_SYMBOLS, {"--sort", "symbol", "--symbols", "main;func2(int, int)"});
311*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
312*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(AllItemsWithString(lines, {"main", "func2(int, int)"}));
313*288bf522SAndroid Build Coastguard Worker }
314*288bf522SAndroid Build Coastguard Worker
315*288bf522SAndroid Build Coastguard Worker // @CddTest = 6.1/C-0-2
TEST_F(ReportCommandTest,dso_symbol_filter_with_children_option)316*288bf522SAndroid Build Coastguard Worker TEST_F(ReportCommandTest, dso_symbol_filter_with_children_option) {
317*288bf522SAndroid Build Coastguard Worker // dso and symbol filter should filter different layers of the callchain separately.
318*288bf522SAndroid Build Coastguard Worker Report("perf_display_bitmaps.data", {"--dsos", "/apex/com.android.runtime/lib64/libart.so",
319*288bf522SAndroid Build Coastguard Worker "--children", "--raw-period", "--sort", "dso"});
320*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
321*288bf522SAndroid Build Coastguard Worker ASSERT_NE(content.find("63500000 43250000 /apex/com.android.runtime/lib64/libart.so"),
322*288bf522SAndroid Build Coastguard Worker std::string::npos);
323*288bf522SAndroid Build Coastguard Worker
324*288bf522SAndroid Build Coastguard Worker Report("perf_display_bitmaps.data",
325*288bf522SAndroid Build Coastguard Worker {"--symbols", "MterpInvokeVirtual", "--children", "--raw-period", "--sort", "symbol"});
326*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
327*288bf522SAndroid Build Coastguard Worker ASSERT_NE(content.find("51500000 2500000 MterpInvokeVirtual"), std::string::npos);
328*288bf522SAndroid Build Coastguard Worker }
329*288bf522SAndroid Build Coastguard Worker
330*288bf522SAndroid Build Coastguard Worker // @CddTest = 6.1/C-0-2
TEST_F(ReportCommandTest,use_branch_address)331*288bf522SAndroid Build Coastguard Worker TEST_F(ReportCommandTest, use_branch_address) {
332*288bf522SAndroid Build Coastguard Worker Report(BRANCH_PERF_DATA, {"-b", "--sort", "symbol_from,symbol_to"});
333*288bf522SAndroid Build Coastguard Worker std::set<std::pair<std::string, std::string>> hit_set;
334*288bf522SAndroid Build Coastguard Worker bool after_overhead = false;
335*288bf522SAndroid Build Coastguard Worker for (const auto& line : lines) {
336*288bf522SAndroid Build Coastguard Worker if (!after_overhead && line.find("Overhead") != std::string::npos) {
337*288bf522SAndroid Build Coastguard Worker after_overhead = true;
338*288bf522SAndroid Build Coastguard Worker } else if (after_overhead) {
339*288bf522SAndroid Build Coastguard Worker char from[80];
340*288bf522SAndroid Build Coastguard Worker char to[80];
341*288bf522SAndroid Build Coastguard Worker if (sscanf(line.c_str(), "%*f%%%s%s", from, to) == 2) {
342*288bf522SAndroid Build Coastguard Worker hit_set.insert(std::make_pair<std::string, std::string>(from, to));
343*288bf522SAndroid Build Coastguard Worker }
344*288bf522SAndroid Build Coastguard Worker }
345*288bf522SAndroid Build Coastguard Worker }
346*288bf522SAndroid Build Coastguard Worker ASSERT_NE(hit_set.find(std::make_pair<std::string, std::string>("GlobalFunc", "CalledFunc")),
347*288bf522SAndroid Build Coastguard Worker hit_set.end());
348*288bf522SAndroid Build Coastguard Worker ASSERT_NE(hit_set.find(std::make_pair<std::string, std::string>("CalledFunc", "GlobalFunc")),
349*288bf522SAndroid Build Coastguard Worker hit_set.end());
350*288bf522SAndroid Build Coastguard Worker }
351*288bf522SAndroid Build Coastguard Worker
352*288bf522SAndroid Build Coastguard Worker // @CddTest = 6.1/C-0-2
TEST_F(ReportCommandTest,report_symbols_of_nativelib_in_apk)353*288bf522SAndroid Build Coastguard Worker TEST_F(ReportCommandTest, report_symbols_of_nativelib_in_apk) {
354*288bf522SAndroid Build Coastguard Worker Report(NATIVELIB_IN_APK_PERF_DATA);
355*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
356*288bf522SAndroid Build Coastguard Worker ASSERT_NE(content.find(GetUrlInApk(APK_FILE, NATIVELIB_IN_APK)), std::string::npos);
357*288bf522SAndroid Build Coastguard Worker ASSERT_NE(content.find("Func2"), std::string::npos);
358*288bf522SAndroid Build Coastguard Worker }
359*288bf522SAndroid Build Coastguard Worker
360*288bf522SAndroid Build Coastguard Worker // @CddTest = 6.1/C-0-2
TEST_F(ReportCommandTest,report_more_than_one_event_types)361*288bf522SAndroid Build Coastguard Worker TEST_F(ReportCommandTest, report_more_than_one_event_types) {
362*288bf522SAndroid Build Coastguard Worker Report(PERF_DATA_WITH_TWO_EVENT_TYPES);
363*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
364*288bf522SAndroid Build Coastguard Worker size_t pos = 0;
365*288bf522SAndroid Build Coastguard Worker ASSERT_NE(pos = content.find("cpu-cycles", pos), std::string::npos);
366*288bf522SAndroid Build Coastguard Worker ASSERT_NE(pos = content.find("Samples:", pos), std::string::npos);
367*288bf522SAndroid Build Coastguard Worker ASSERT_NE(pos = content.find("cpu-clock", pos), std::string::npos);
368*288bf522SAndroid Build Coastguard Worker ASSERT_NE(pos = content.find("Samples:", pos), std::string::npos);
369*288bf522SAndroid Build Coastguard Worker }
370*288bf522SAndroid Build Coastguard Worker
371*288bf522SAndroid Build Coastguard Worker // @CddTest = 6.1/C-0-2
TEST_F(ReportCommandTest,report_kernel_symbol)372*288bf522SAndroid Build Coastguard Worker TEST_F(ReportCommandTest, report_kernel_symbol) {
373*288bf522SAndroid Build Coastguard Worker Report(PERF_DATA_WITH_KERNEL_SYMBOL);
374*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
375*288bf522SAndroid Build Coastguard Worker ASSERT_NE(content.find("perf_event_aux"), std::string::npos);
376*288bf522SAndroid Build Coastguard Worker }
377*288bf522SAndroid Build Coastguard Worker
378*288bf522SAndroid Build Coastguard Worker // @CddTest = 6.1/C-0-2
TEST_F(ReportCommandTest,report_dumped_symbols)379*288bf522SAndroid Build Coastguard Worker TEST_F(ReportCommandTest, report_dumped_symbols) {
380*288bf522SAndroid Build Coastguard Worker Report(PERF_DATA_WITH_SYMBOLS);
381*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
382*288bf522SAndroid Build Coastguard Worker ASSERT_NE(content.find("main"), std::string::npos);
383*288bf522SAndroid Build Coastguard Worker Report(PERF_DATA_WITH_SYMBOLS_FOR_NONZERO_MINVADDR_DSO);
384*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
385*288bf522SAndroid Build Coastguard Worker ASSERT_NE(content.find("memcpy"), std::string::npos);
386*288bf522SAndroid Build Coastguard Worker }
387*288bf522SAndroid Build Coastguard Worker
388*288bf522SAndroid Build Coastguard Worker // @CddTest = 6.1/C-0-2
TEST_F(ReportCommandTest,report_dumped_symbols_with_symfs_dir)389*288bf522SAndroid Build Coastguard Worker TEST_F(ReportCommandTest, report_dumped_symbols_with_symfs_dir) {
390*288bf522SAndroid Build Coastguard Worker // Check if we can report symbols when they appear both in perf.data and symfs dir.
391*288bf522SAndroid Build Coastguard Worker Report(PERF_DATA_WITH_SYMBOLS, {"--symfs", GetTestDataDir()});
392*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
393*288bf522SAndroid Build Coastguard Worker ASSERT_NE(content.find("main"), std::string::npos);
394*288bf522SAndroid Build Coastguard Worker }
395*288bf522SAndroid Build Coastguard Worker
396*288bf522SAndroid Build Coastguard Worker // @CddTest = 6.1/C-0-2
TEST_F(ReportCommandTest,report_dumped_symbols_with_symdir)397*288bf522SAndroid Build Coastguard Worker TEST_F(ReportCommandTest, report_dumped_symbols_with_symdir) {
398*288bf522SAndroid Build Coastguard Worker // Check if we can report symbols by specifying symdir.
399*288bf522SAndroid Build Coastguard Worker Report(PERF_DATA, {"--symdir", GetTestDataDir()}, false);
400*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
401*288bf522SAndroid Build Coastguard Worker ASSERT_NE(content.find("GlobalFunc"), std::string::npos);
402*288bf522SAndroid Build Coastguard Worker }
403*288bf522SAndroid Build Coastguard Worker
404*288bf522SAndroid Build Coastguard Worker // @CddTest = 6.1/C-0-2
TEST_F(ReportCommandTest,report_without_symfs_dir)405*288bf522SAndroid Build Coastguard Worker TEST_F(ReportCommandTest, report_without_symfs_dir) {
406*288bf522SAndroid Build Coastguard Worker TemporaryFile tmpfile;
407*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(ReportCmd()->Run({"-i", GetTestData(PERF_DATA), "-o", tmpfile.path}));
408*288bf522SAndroid Build Coastguard Worker }
409*288bf522SAndroid Build Coastguard Worker
410*288bf522SAndroid Build Coastguard Worker // @CddTest = 6.1/C-0-2
TEST_F(ReportCommandTest,report_sort_vaddr_in_file)411*288bf522SAndroid Build Coastguard Worker TEST_F(ReportCommandTest, report_sort_vaddr_in_file) {
412*288bf522SAndroid Build Coastguard Worker Report(PERF_DATA, {"--sort", "vaddr_in_file"});
413*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
414*288bf522SAndroid Build Coastguard Worker ASSERT_NE(content.find("VaddrInFile"), std::string::npos);
415*288bf522SAndroid Build Coastguard Worker }
416*288bf522SAndroid Build Coastguard Worker
417*288bf522SAndroid Build Coastguard Worker // @CddTest = 6.1/C-0-2
TEST_F(ReportCommandTest,check_build_id)418*288bf522SAndroid Build Coastguard Worker TEST_F(ReportCommandTest, check_build_id) {
419*288bf522SAndroid Build Coastguard Worker Report(PERF_DATA_FOR_BUILD_ID_CHECK, {"--symfs", GetTestData(CORRECT_SYMFS_FOR_BUILD_ID_CHECK)});
420*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
421*288bf522SAndroid Build Coastguard Worker ASSERT_NE(content.find("main"), std::string::npos);
422*288bf522SAndroid Build Coastguard Worker ASSERT_EXIT(
423*288bf522SAndroid Build Coastguard Worker {
424*288bf522SAndroid Build Coastguard Worker Report(PERF_DATA_FOR_BUILD_ID_CHECK,
425*288bf522SAndroid Build Coastguard Worker {"--symfs", GetTestData(WRONG_SYMFS_FOR_BUILD_ID_CHECK)});
426*288bf522SAndroid Build Coastguard Worker if (!success) {
427*288bf522SAndroid Build Coastguard Worker exit(1);
428*288bf522SAndroid Build Coastguard Worker }
429*288bf522SAndroid Build Coastguard Worker if (content.find("main") != std::string::npos) {
430*288bf522SAndroid Build Coastguard Worker exit(2);
431*288bf522SAndroid Build Coastguard Worker }
432*288bf522SAndroid Build Coastguard Worker exit(0);
433*288bf522SAndroid Build Coastguard Worker },
434*288bf522SAndroid Build Coastguard Worker testing::ExitedWithCode(0), "failed to read symbols from /elf_for_build_id_check");
435*288bf522SAndroid Build Coastguard Worker }
436*288bf522SAndroid Build Coastguard Worker
437*288bf522SAndroid Build Coastguard Worker // @CddTest = 6.1/C-0-2
TEST_F(ReportCommandTest,no_show_ip_option)438*288bf522SAndroid Build Coastguard Worker TEST_F(ReportCommandTest, no_show_ip_option) {
439*288bf522SAndroid Build Coastguard Worker Report(PERF_DATA);
440*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
441*288bf522SAndroid Build Coastguard Worker ASSERT_EQ(content.find("unknown"), std::string::npos);
442*288bf522SAndroid Build Coastguard Worker Report(PERF_DATA, {"--no-show-ip"});
443*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
444*288bf522SAndroid Build Coastguard Worker ASSERT_NE(content.find("unknown"), std::string::npos);
445*288bf522SAndroid Build Coastguard Worker }
446*288bf522SAndroid Build Coastguard Worker
447*288bf522SAndroid Build Coastguard Worker // @CddTest = 6.1/C-0-2
TEST_F(ReportCommandTest,read_elf_file_warning)448*288bf522SAndroid Build Coastguard Worker TEST_F(ReportCommandTest, read_elf_file_warning) {
449*288bf522SAndroid Build Coastguard Worker ASSERT_EXIT(
450*288bf522SAndroid Build Coastguard Worker {
451*288bf522SAndroid Build Coastguard Worker Report(PERF_DATA, {"--symfs", GetTestData(SYMFS_FOR_READ_ELF_FILE_WARNING)});
452*288bf522SAndroid Build Coastguard Worker if (!success) {
453*288bf522SAndroid Build Coastguard Worker exit(1);
454*288bf522SAndroid Build Coastguard Worker }
455*288bf522SAndroid Build Coastguard Worker if (content.find("GlobalFunc") != std::string::npos) {
456*288bf522SAndroid Build Coastguard Worker exit(2);
457*288bf522SAndroid Build Coastguard Worker }
458*288bf522SAndroid Build Coastguard Worker exit(0);
459*288bf522SAndroid Build Coastguard Worker },
460*288bf522SAndroid Build Coastguard Worker testing::ExitedWithCode(0), "failed to read symbols from /elf: File not found");
461*288bf522SAndroid Build Coastguard Worker }
462*288bf522SAndroid Build Coastguard Worker
463*288bf522SAndroid Build Coastguard Worker // @CddTest = 6.1/C-0-2
TEST_F(ReportCommandTest,report_data_generated_by_linux_perf)464*288bf522SAndroid Build Coastguard Worker TEST_F(ReportCommandTest, report_data_generated_by_linux_perf) {
465*288bf522SAndroid Build Coastguard Worker Report(PERF_DATA_GENERATED_BY_LINUX_PERF);
466*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
467*288bf522SAndroid Build Coastguard Worker }
468*288bf522SAndroid Build Coastguard Worker
469*288bf522SAndroid Build Coastguard Worker // @CddTest = 6.1/C-0-2
TEST_F(ReportCommandTest,max_stack_and_percent_limit_option)470*288bf522SAndroid Build Coastguard Worker TEST_F(ReportCommandTest, max_stack_and_percent_limit_option) {
471*288bf522SAndroid Build Coastguard Worker Report(PERF_DATA_MAX_STACK_AND_PERCENT_LIMIT, {"-g"});
472*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
473*288bf522SAndroid Build Coastguard Worker ASSERT_NE(content.find("89.03"), std::string::npos);
474*288bf522SAndroid Build Coastguard Worker
475*288bf522SAndroid Build Coastguard Worker Report(PERF_DATA_MAX_STACK_AND_PERCENT_LIMIT, {"-g", "--max-stack", "0"});
476*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
477*288bf522SAndroid Build Coastguard Worker ASSERT_EQ(content.find("89.03"), std::string::npos);
478*288bf522SAndroid Build Coastguard Worker Report(PERF_DATA_MAX_STACK_AND_PERCENT_LIMIT, {"-g", "--max-stack", "2"});
479*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
480*288bf522SAndroid Build Coastguard Worker ASSERT_NE(content.find("89.03"), std::string::npos);
481*288bf522SAndroid Build Coastguard Worker
482*288bf522SAndroid Build Coastguard Worker Report(PERF_DATA_MAX_STACK_AND_PERCENT_LIMIT, {"-g", "--percent-limit", "90"});
483*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
484*288bf522SAndroid Build Coastguard Worker ASSERT_EQ(content.find("89.03"), std::string::npos);
485*288bf522SAndroid Build Coastguard Worker Report(PERF_DATA_MAX_STACK_AND_PERCENT_LIMIT, {"-g", "--percent-limit", "70"});
486*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
487*288bf522SAndroid Build Coastguard Worker ASSERT_NE(content.find("89.03"), std::string::npos);
488*288bf522SAndroid Build Coastguard Worker }
489*288bf522SAndroid Build Coastguard Worker
490*288bf522SAndroid Build Coastguard Worker // @CddTest = 6.1/C-0-2
TEST_F(ReportCommandTest,percent_limit_option)491*288bf522SAndroid Build Coastguard Worker TEST_F(ReportCommandTest, percent_limit_option) {
492*288bf522SAndroid Build Coastguard Worker Report(PERF_DATA);
493*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
494*288bf522SAndroid Build Coastguard Worker ASSERT_NE(content.find("7.70%"), std::string::npos);
495*288bf522SAndroid Build Coastguard Worker ASSERT_NE(content.find("3.23%"), std::string::npos);
496*288bf522SAndroid Build Coastguard Worker Report(PERF_DATA, {"--percent-limit", "3.24"});
497*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
498*288bf522SAndroid Build Coastguard Worker ASSERT_NE(content.find("7.70%"), std::string::npos);
499*288bf522SAndroid Build Coastguard Worker ASSERT_EQ(content.find("3.23%"), std::string::npos);
500*288bf522SAndroid Build Coastguard Worker }
501*288bf522SAndroid Build Coastguard Worker
502*288bf522SAndroid Build Coastguard Worker // @CddTest = 6.1/C-0-2
TEST_F(ReportCommandTest,kallsyms_option)503*288bf522SAndroid Build Coastguard Worker TEST_F(ReportCommandTest, kallsyms_option) {
504*288bf522SAndroid Build Coastguard Worker Report(PERF_DATA, {"--kallsyms", GetTestData("kallsyms")});
505*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
506*288bf522SAndroid Build Coastguard Worker ASSERT_NE(content.find("FakeKernelSymbol"), std::string::npos);
507*288bf522SAndroid Build Coastguard Worker }
508*288bf522SAndroid Build Coastguard Worker
509*288bf522SAndroid Build Coastguard Worker // @CddTest = 6.1/C-0-2
TEST_F(ReportCommandTest,invalid_perf_data)510*288bf522SAndroid Build Coastguard Worker TEST_F(ReportCommandTest, invalid_perf_data) {
511*288bf522SAndroid Build Coastguard Worker ASSERT_FALSE(ReportCmd()->Run({"-i", GetTestData(INVALID_PERF_DATA)}));
512*288bf522SAndroid Build Coastguard Worker }
513*288bf522SAndroid Build Coastguard Worker
514*288bf522SAndroid Build Coastguard Worker // @CddTest = 6.1/C-0-2
TEST_F(ReportCommandTest,raw_period_option)515*288bf522SAndroid Build Coastguard Worker TEST_F(ReportCommandTest, raw_period_option) {
516*288bf522SAndroid Build Coastguard Worker Report(PERF_DATA, {"--raw-period"});
517*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
518*288bf522SAndroid Build Coastguard Worker ASSERT_NE(content.find("GlobalFunc"), std::string::npos);
519*288bf522SAndroid Build Coastguard Worker ASSERT_EQ(content.find('%'), std::string::npos);
520*288bf522SAndroid Build Coastguard Worker }
521*288bf522SAndroid Build Coastguard Worker
522*288bf522SAndroid Build Coastguard Worker // @CddTest = 6.1/C-0-2
TEST_F(ReportCommandTest,full_callgraph_option)523*288bf522SAndroid Build Coastguard Worker TEST_F(ReportCommandTest, full_callgraph_option) {
524*288bf522SAndroid Build Coastguard Worker Report(CALLGRAPH_FP_PERF_DATA, {"-g"});
525*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
526*288bf522SAndroid Build Coastguard Worker ASSERT_NE(content.find("skipped in brief callgraph mode"), std::string::npos);
527*288bf522SAndroid Build Coastguard Worker Report(CALLGRAPH_FP_PERF_DATA, {"-g", "--full-callgraph"});
528*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
529*288bf522SAndroid Build Coastguard Worker ASSERT_EQ(content.find("skipped in brief callgraph mode"), std::string::npos);
530*288bf522SAndroid Build Coastguard Worker }
531*288bf522SAndroid Build Coastguard Worker
532*288bf522SAndroid Build Coastguard Worker // @CddTest = 6.1/C-0-2
TEST_F(ReportCommandTest,report_offcpu_time)533*288bf522SAndroid Build Coastguard Worker TEST_F(ReportCommandTest, report_offcpu_time) {
534*288bf522SAndroid Build Coastguard Worker Report(PERF_DATA_WITH_TRACE_OFFCPU, {"--children"});
535*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
536*288bf522SAndroid Build Coastguard Worker ASSERT_NE(content.find("Time in ns"), std::string::npos);
537*288bf522SAndroid Build Coastguard Worker bool found = false;
538*288bf522SAndroid Build Coastguard Worker for (auto& line : lines) {
539*288bf522SAndroid Build Coastguard Worker if (line.find("SleepFunction") != std::string::npos) {
540*288bf522SAndroid Build Coastguard Worker ASSERT_NE(line.find("38.76%"), std::string::npos);
541*288bf522SAndroid Build Coastguard Worker found = true;
542*288bf522SAndroid Build Coastguard Worker break;
543*288bf522SAndroid Build Coastguard Worker }
544*288bf522SAndroid Build Coastguard Worker }
545*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(found);
546*288bf522SAndroid Build Coastguard Worker }
547*288bf522SAndroid Build Coastguard Worker
548*288bf522SAndroid Build Coastguard Worker // @CddTest = 6.1/C-0-2
TEST_F(ReportCommandTest,report_big_trace_data)549*288bf522SAndroid Build Coastguard Worker TEST_F(ReportCommandTest, report_big_trace_data) {
550*288bf522SAndroid Build Coastguard Worker Report(PERF_DATA_WITH_BIG_TRACE_DATA);
551*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
552*288bf522SAndroid Build Coastguard Worker }
553*288bf522SAndroid Build Coastguard Worker
554*288bf522SAndroid Build Coastguard Worker // @CddTest = 6.1/C-0-2
TEST_F(ReportCommandTest,csv_option)555*288bf522SAndroid Build Coastguard Worker TEST_F(ReportCommandTest, csv_option) {
556*288bf522SAndroid Build Coastguard Worker Report(PERF_DATA, {"--csv"});
557*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
558*288bf522SAndroid Build Coastguard Worker ASSERT_NE(content.find("EventCount,EventName"), std::string::npos);
559*288bf522SAndroid Build Coastguard Worker
560*288bf522SAndroid Build Coastguard Worker Report(CALLGRAPH_FP_PERF_DATA, {"--children", "--csv"});
561*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
562*288bf522SAndroid Build Coastguard Worker ASSERT_NE(content.find("AccEventCount,SelfEventCount,EventName"), std::string::npos);
563*288bf522SAndroid Build Coastguard Worker }
564*288bf522SAndroid Build Coastguard Worker
565*288bf522SAndroid Build Coastguard Worker // @CddTest = 6.1/C-0-2
TEST_F(ReportCommandTest,csv_separator_option)566*288bf522SAndroid Build Coastguard Worker TEST_F(ReportCommandTest, csv_separator_option) {
567*288bf522SAndroid Build Coastguard Worker Report(PERF_DATA, {"--csv", "--csv-separator", ";"});
568*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
569*288bf522SAndroid Build Coastguard Worker ASSERT_NE(content.find("EventCount;EventName"), std::string::npos);
570*288bf522SAndroid Build Coastguard Worker ASSERT_NE(content.find(";cpu-cycles"), std::string::npos);
571*288bf522SAndroid Build Coastguard Worker }
572*288bf522SAndroid Build Coastguard Worker
573*288bf522SAndroid Build Coastguard Worker // @CddTest = 6.1/C-0-2
TEST_F(ReportCommandTest,dso_path_for_jit_cache)574*288bf522SAndroid Build Coastguard Worker TEST_F(ReportCommandTest, dso_path_for_jit_cache) {
575*288bf522SAndroid Build Coastguard Worker Report("perf_with_jit_symbol.data", {"--sort", "dso"});
576*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
577*288bf522SAndroid Build Coastguard Worker ASSERT_NE(content.find("[JIT app cache]"), std::string::npos);
578*288bf522SAndroid Build Coastguard Worker
579*288bf522SAndroid Build Coastguard Worker // Check if we can filter dso by "[JIT app cache]".
580*288bf522SAndroid Build Coastguard Worker Report("perf_with_jit_symbol.data", {"--dsos", "[JIT app cache]"});
581*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
582*288bf522SAndroid Build Coastguard Worker ASSERT_NE(content.find("[JIT app cache]"), std::string::npos);
583*288bf522SAndroid Build Coastguard Worker }
584*288bf522SAndroid Build Coastguard Worker
585*288bf522SAndroid Build Coastguard Worker // @CddTest = 6.1/C-0-2
TEST_F(ReportCommandTest,generic_jit_symbols)586*288bf522SAndroid Build Coastguard Worker TEST_F(ReportCommandTest, generic_jit_symbols) {
587*288bf522SAndroid Build Coastguard Worker Report("perf_with_generic_git_symbols.data", {"--sort", "symbol"});
588*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
589*288bf522SAndroid Build Coastguard Worker ASSERT_NE(std::string::npos, content.find("generic_jit_symbol_one"));
590*288bf522SAndroid Build Coastguard Worker }
591*288bf522SAndroid Build Coastguard Worker
592*288bf522SAndroid Build Coastguard Worker // @CddTest = 6.1/C-0-2
TEST_F(ReportCommandTest,cpu_option)593*288bf522SAndroid Build Coastguard Worker TEST_F(ReportCommandTest, cpu_option) {
594*288bf522SAndroid Build Coastguard Worker Report("perf.data");
595*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
596*288bf522SAndroid Build Coastguard Worker ASSERT_EQ(2409, GetSampleCount());
597*288bf522SAndroid Build Coastguard Worker Report("perf.data", {"--cpu", "2"});
598*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
599*288bf522SAndroid Build Coastguard Worker ASSERT_EQ(603, GetSampleCount());
600*288bf522SAndroid Build Coastguard Worker Report("perf.data", {"--cpu", "2-6,16"});
601*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
602*288bf522SAndroid Build Coastguard Worker ASSERT_EQ(1806, GetSampleCount());
603*288bf522SAndroid Build Coastguard Worker Report("perf.data", {"--cpu", "2-6", "--cpu", "16"});
604*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
605*288bf522SAndroid Build Coastguard Worker ASSERT_EQ(1806, GetSampleCount());
606*288bf522SAndroid Build Coastguard Worker ASSERT_FALSE(ReportCmd()->Run({"-i", GetTestData("perf.data"), "--cpu", "-2"}));
607*288bf522SAndroid Build Coastguard Worker }
608*288bf522SAndroid Build Coastguard Worker
609*288bf522SAndroid Build Coastguard Worker // @CddTest = 6.1/C-0-2
TEST_F(ReportCommandTest,print_event_count_option)610*288bf522SAndroid Build Coastguard Worker TEST_F(ReportCommandTest, print_event_count_option) {
611*288bf522SAndroid Build Coastguard Worker // Report record file not recorded with --add-counter.
612*288bf522SAndroid Build Coastguard Worker Report("perf.data", {"--print-event-count"});
613*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
614*288bf522SAndroid Build Coastguard Worker ASSERT_NE(content.find("EventCount"), std::string::npos);
615*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(
616*288bf522SAndroid Build Coastguard Worker RegEx::Create(R"(325005586\s+elf\s+26083\s+26083\s+/elf\s+GlobalFunc)")->Search(content));
617*288bf522SAndroid Build Coastguard Worker
618*288bf522SAndroid Build Coastguard Worker // Report record file recorded with --add-counter.
619*288bf522SAndroid Build Coastguard Worker const std::string record_file = "perf_with_add_counter.data";
620*288bf522SAndroid Build Coastguard Worker Report(record_file, {"--print-event-count"});
621*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
622*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(RegEx::Create(R"(EventCount_cpu-cycles\s+EventCount_instructions)")->Search(content));
623*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(
624*288bf522SAndroid Build Coastguard Worker RegEx::Create(R"(175099\s+140443\s+sleep\s+689664\s+689664.+_dl_addr)")->Search(content));
625*288bf522SAndroid Build Coastguard Worker
626*288bf522SAndroid Build Coastguard Worker // Report accumulated event counts.
627*288bf522SAndroid Build Coastguard Worker Report(record_file, {"--print-event-count", "--children"});
628*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
629*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(
630*288bf522SAndroid Build Coastguard Worker RegEx::Create(
631*288bf522SAndroid Build Coastguard Worker R"(AccEventCount_cpu-cycles\s+SelfEventCount_cpu-cycles\s+AccEventCount_instructions\s+)"
632*288bf522SAndroid Build Coastguard Worker R"(SelfEventCount_instructions)")
633*288bf522SAndroid Build Coastguard Worker ->Search(content));
634*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(
635*288bf522SAndroid Build Coastguard Worker RegEx::Create(R"(175099\s+175099\s+140443\s+140443\s+sleep\s+689664\s+689664.+_dl_addr)")
636*288bf522SAndroid Build Coastguard Worker ->Search(content));
637*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(
638*288bf522SAndroid Build Coastguard Worker RegEx::Create(R"(366116\s+0\s+297474\s+0\s+sleep\s+689664\s+689664.+__libc_start_main)")
639*288bf522SAndroid Build Coastguard Worker ->Search(content));
640*288bf522SAndroid Build Coastguard Worker }
641*288bf522SAndroid Build Coastguard Worker
642*288bf522SAndroid Build Coastguard Worker // @CddTest = 6.1/C-0-2
TEST_F(ReportCommandTest,exclude_include_pid_options)643*288bf522SAndroid Build Coastguard Worker TEST_F(ReportCommandTest, exclude_include_pid_options) {
644*288bf522SAndroid Build Coastguard Worker Report(PERF_DATA_WITH_MULTIPLE_PIDS_AND_TIDS, {"--sort", "pid", "--exclude-pid", "17441"});
645*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
646*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(AllItemsWithString(lines, {"17443", "17444"}));
647*288bf522SAndroid Build Coastguard Worker Report(PERF_DATA_WITH_MULTIPLE_PIDS_AND_TIDS, {"--sort", "pid", "--include-pid", "17441"});
648*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
649*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(AllItemsWithString(lines, {"17441"}));
650*288bf522SAndroid Build Coastguard Worker }
651*288bf522SAndroid Build Coastguard Worker
652*288bf522SAndroid Build Coastguard Worker // @CddTest = 6.1/C-0-2
TEST_F(ReportCommandTest,exclude_include_tid_options)653*288bf522SAndroid Build Coastguard Worker TEST_F(ReportCommandTest, exclude_include_tid_options) {
654*288bf522SAndroid Build Coastguard Worker Report(PERF_DATA_WITH_MULTIPLE_PIDS_AND_TIDS,
655*288bf522SAndroid Build Coastguard Worker {"--sort", "tid", "--exclude-tid", "17441,17443,17444"});
656*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
657*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(AllItemsWithString(lines, {"17445", "17446", "17447"}));
658*288bf522SAndroid Build Coastguard Worker Report(PERF_DATA_WITH_MULTIPLE_PIDS_AND_TIDS,
659*288bf522SAndroid Build Coastguard Worker {"--sort", "tid", "--include-tid", "17441,17443,17444"});
660*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
661*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(AllItemsWithString(lines, {"17441", "17443", "17444"}));
662*288bf522SAndroid Build Coastguard Worker }
663*288bf522SAndroid Build Coastguard Worker
664*288bf522SAndroid Build Coastguard Worker // @CddTest = 6.1/C-0-2
TEST_F(ReportCommandTest,exclude_include_process_name_options)665*288bf522SAndroid Build Coastguard Worker TEST_F(ReportCommandTest, exclude_include_process_name_options) {
666*288bf522SAndroid Build Coastguard Worker Report(PERF_DATA_WITH_MULTIPLE_PIDS_AND_TIDS, {"--sort", "comm", "--exclude-process-name", "t1"});
667*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
668*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(AllItemsWithString(lines, {"simpleperf"}));
669*288bf522SAndroid Build Coastguard Worker Report(PERF_DATA_WITH_MULTIPLE_PIDS_AND_TIDS, {"--sort", "comm", "--include-process-name", "t1"});
670*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
671*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(AllItemsWithString(lines, {"t1"}));
672*288bf522SAndroid Build Coastguard Worker }
673*288bf522SAndroid Build Coastguard Worker
674*288bf522SAndroid Build Coastguard Worker // @CddTest = 6.1/C-0-2
TEST_F(ReportCommandTest,exclude_include_thread_name_options)675*288bf522SAndroid Build Coastguard Worker TEST_F(ReportCommandTest, exclude_include_thread_name_options) {
676*288bf522SAndroid Build Coastguard Worker Report(PERF_DATA_WITH_MULTIPLE_PIDS_AND_TIDS, {"--sort", "comm", "--exclude-thread-name", "t1"});
677*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
678*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(AllItemsWithString(lines, {"simpleperf"}));
679*288bf522SAndroid Build Coastguard Worker Report(PERF_DATA_WITH_MULTIPLE_PIDS_AND_TIDS, {"--sort", "comm", "--include-thread-name", "t1"});
680*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
681*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(AllItemsWithString(lines, {"t1"}));
682*288bf522SAndroid Build Coastguard Worker }
683*288bf522SAndroid Build Coastguard Worker
684*288bf522SAndroid Build Coastguard Worker // @CddTest = 6.1/C-0-2
TEST_F(ReportCommandTest,filter_file_option)685*288bf522SAndroid Build Coastguard Worker TEST_F(ReportCommandTest, filter_file_option) {
686*288bf522SAndroid Build Coastguard Worker std::string filter_data =
687*288bf522SAndroid Build Coastguard Worker "GLOBAL_BEGIN 684943449406175\n"
688*288bf522SAndroid Build Coastguard Worker "GLOBAL_END 684943449406176";
689*288bf522SAndroid Build Coastguard Worker TemporaryFile tmpfile;
690*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(android::base::WriteStringToFd(filter_data, tmpfile.fd));
691*288bf522SAndroid Build Coastguard Worker Report("perf_display_bitmaps.data", {"--filter-file", tmpfile.path});
692*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
693*288bf522SAndroid Build Coastguard Worker ASSERT_EQ(GetSampleCount(), 1);
694*288bf522SAndroid Build Coastguard Worker
695*288bf522SAndroid Build Coastguard Worker // PERF_DATA uses clock perf, which doesn't match the default clock in filter data.
696*288bf522SAndroid Build Coastguard Worker CapturedStderr capture;
697*288bf522SAndroid Build Coastguard Worker ASSERT_FALSE(ReportCmd()->Run({"-i", GetTestData(PERF_DATA), "--filter-file", tmpfile.path}));
698*288bf522SAndroid Build Coastguard Worker capture.Stop();
699*288bf522SAndroid Build Coastguard Worker ASSERT_NE(capture.str().find("doesn't match clock used in time filter"), std::string::npos);
700*288bf522SAndroid Build Coastguard Worker }
701*288bf522SAndroid Build Coastguard Worker
702*288bf522SAndroid Build Coastguard Worker #if defined(__linux__)
703*288bf522SAndroid Build Coastguard Worker #include "event_selection_set.h"
704*288bf522SAndroid Build Coastguard Worker
RecordCmd()705*288bf522SAndroid Build Coastguard Worker static std::unique_ptr<Command> RecordCmd() {
706*288bf522SAndroid Build Coastguard Worker return CreateCommandInstance("record");
707*288bf522SAndroid Build Coastguard Worker }
708*288bf522SAndroid Build Coastguard Worker
709*288bf522SAndroid Build Coastguard Worker // @CddTest = 6.1/C-0-2
TEST_F(ReportCommandTest,dwarf_callgraph)710*288bf522SAndroid Build Coastguard Worker TEST_F(ReportCommandTest, dwarf_callgraph) {
711*288bf522SAndroid Build Coastguard Worker TEST_REQUIRE_HW_COUNTER();
712*288bf522SAndroid Build Coastguard Worker OMIT_TEST_ON_NON_NATIVE_ABIS();
713*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(IsDwarfCallChainSamplingSupported());
714*288bf522SAndroid Build Coastguard Worker std::vector<std::unique_ptr<Workload>> workloads;
715*288bf522SAndroid Build Coastguard Worker CreateProcesses(1, &workloads);
716*288bf522SAndroid Build Coastguard Worker std::string pid = std::to_string(workloads[0]->GetPid());
717*288bf522SAndroid Build Coastguard Worker TemporaryFile tmp_file;
718*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(RecordCmd()->Run({"-p", pid, "-g", "-o", tmp_file.path, "sleep", SLEEP_SEC}));
719*288bf522SAndroid Build Coastguard Worker ReportRaw(tmp_file.path, {"-g"});
720*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
721*288bf522SAndroid Build Coastguard Worker }
722*288bf522SAndroid Build Coastguard Worker
723*288bf522SAndroid Build Coastguard Worker // @CddTest = 6.1/C-0-2
TEST_F(ReportCommandTest,report_dwarf_callgraph_of_nativelib_in_apk)724*288bf522SAndroid Build Coastguard Worker TEST_F(ReportCommandTest, report_dwarf_callgraph_of_nativelib_in_apk) {
725*288bf522SAndroid Build Coastguard Worker Report(NATIVELIB_IN_APK_PERF_DATA, {"-g"});
726*288bf522SAndroid Build Coastguard Worker ASSERT_NE(content.find(GetUrlInApk(APK_FILE, NATIVELIB_IN_APK)), std::string::npos);
727*288bf522SAndroid Build Coastguard Worker ASSERT_NE(content.find("Func2"), std::string::npos);
728*288bf522SAndroid Build Coastguard Worker ASSERT_NE(content.find("Func1"), std::string::npos);
729*288bf522SAndroid Build Coastguard Worker ASSERT_NE(content.find("GlobalFunc"), std::string::npos);
730*288bf522SAndroid Build Coastguard Worker }
731*288bf522SAndroid Build Coastguard Worker
732*288bf522SAndroid Build Coastguard Worker // @CddTest = 6.1/C-0-2
TEST_F(ReportCommandTest,exclude_kernel_callchain)733*288bf522SAndroid Build Coastguard Worker TEST_F(ReportCommandTest, exclude_kernel_callchain) {
734*288bf522SAndroid Build Coastguard Worker TEST_REQUIRE_HW_COUNTER();
735*288bf522SAndroid Build Coastguard Worker TEST_REQUIRE_HOST_ROOT();
736*288bf522SAndroid Build Coastguard Worker OMIT_TEST_ON_NON_NATIVE_ABIS();
737*288bf522SAndroid Build Coastguard Worker std::vector<std::unique_ptr<Workload>> workloads;
738*288bf522SAndroid Build Coastguard Worker CreateProcesses(1, &workloads);
739*288bf522SAndroid Build Coastguard Worker std::string pid = std::to_string(workloads[0]->GetPid());
740*288bf522SAndroid Build Coastguard Worker TemporaryFile tmpfile;
741*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(RecordCmd()->Run({"--trace-offcpu", "-e", "cpu-clock:u", "-p", pid, "--duration", "2",
742*288bf522SAndroid Build Coastguard Worker "-o", tmpfile.path, "-g"}));
743*288bf522SAndroid Build Coastguard Worker ReportRaw(tmpfile.path, {"-g"});
744*288bf522SAndroid Build Coastguard Worker ASSERT_TRUE(success);
745*288bf522SAndroid Build Coastguard Worker ASSERT_EQ(content.find("[kernel.kallsyms]"), std::string::npos);
746*288bf522SAndroid Build Coastguard Worker }
747*288bf522SAndroid Build Coastguard Worker
748*288bf522SAndroid Build Coastguard Worker #endif
749