diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-05-11 23:40:15 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-05-11 23:40:15 +0000 |
commit | 03c9cb08c25fe134020771a78c605db759ab8374 (patch) | |
tree | 12811701d1e6359be392f706cc29d5521a228c04 | |
parent | e94c09a0582949c6e096af5b3e6933cf560aae6a (diff) | |
parent | 477dbe7718d685e2e7300070142a7dfb256fab38 (diff) | |
download | extras-03c9cb08c25fe134020771a78c605db759ab8374.tar.gz |
Snap for 10113759 from 477dbe7718d685e2e7300070142a7dfb256fab38 to udc-release
Change-Id: I5e715e83b6793086a9b1416964ab0e6dbf023414
-rw-r--r-- | simpleperf/cmd_record_test.cpp | 31 | ||||
-rw-r--r-- | simpleperf/testdata/DisplayBitmaps.apk | bin | 2377615 -> 760019 bytes | |||
-rw-r--r-- | simpleperf/testdata/DisplayBitmapsTest.apk | bin | 2941948 -> 2861529 bytes |
3 files changed, 17 insertions, 14 deletions
diff --git a/simpleperf/cmd_record_test.cpp b/simpleperf/cmd_record_test.cpp index f6f76ab5..b8300d7f 100644 --- a/simpleperf/cmd_record_test.cpp +++ b/simpleperf/cmd_record_test.cpp @@ -726,7 +726,7 @@ class RecordingAppHelper { std::vector<std::string> args = android::base::Split(record_cmd, " "); // record_cmd may end with child command. We should put output options before it. args.emplace(args.begin(), "-o"); - args.emplace(args.begin() + 1, perf_data_file_.path); + args.emplace(args.begin() + 1, GetDataPath()); return RecordCmd()->Run(args); } @@ -738,11 +738,14 @@ class RecordingAppHelper { } return success; }; - ProcessSymbolsInPerfDataFile(perf_data_file_.path, callback); + ProcessSymbolsInPerfDataFile(GetDataPath(), callback); + if (!success) { + DumpData(); + } return success; } - void DumpData() { CreateCommandInstance("report")->Run({"-i", perf_data_file_.path}); } + void DumpData() { CreateCommandInstance("report")->Run({"-i", GetDataPath()}); } std::string GetDataPath() const { return perf_data_file_.path; } @@ -766,10 +769,7 @@ static void TestRecordingApps(const std::string& app_name, const std::string& ap return strstr(name, expected_class_name.c_str()) != nullptr && strstr(name, expected_method_name.c_str()) != nullptr; }; - if (!helper.CheckData(process_symbol)) { - helper.DumpData(); - FAIL() << "Expected Java symbol doesn't exist in the profiling data"; - } + ASSERT_TRUE(helper.CheckData(process_symbol)); // Check app_package_name and app_type. auto reader = RecordFileReader::CreateInstance(helper.GetDataPath()); @@ -835,15 +835,18 @@ TEST(record_cmd, record_java_app) { } // Check perf.data by looking for java symbols. + const char* java_symbols[] = { + "androidx.test.runner", + "androidx.test.espresso", + "android.app.ActivityThread.main", + }; auto process_symbol = [&](const char* name) { -#if !defined(IN_CTS_TEST) - const char* expected_name_with_keyguard = "androidx.test.runner"; // when screen is locked - if (strstr(name, expected_name_with_keyguard) != nullptr) { - return true; + for (const char* java_symbol : java_symbols) { + if (strstr(name, java_symbol) != nullptr) { + return true; + } } -#endif - const char* expected_name = "androidx.test.espresso"; // when screen stays awake - return strstr(name, expected_name) != nullptr; + return false; }; ASSERT_TRUE(helper.CheckData(process_symbol)); #else diff --git a/simpleperf/testdata/DisplayBitmaps.apk b/simpleperf/testdata/DisplayBitmaps.apk Binary files differindex 63b40744..2911edde 100644 --- a/simpleperf/testdata/DisplayBitmaps.apk +++ b/simpleperf/testdata/DisplayBitmaps.apk diff --git a/simpleperf/testdata/DisplayBitmapsTest.apk b/simpleperf/testdata/DisplayBitmapsTest.apk Binary files differindex 15807198..db5575ef 100644 --- a/simpleperf/testdata/DisplayBitmapsTest.apk +++ b/simpleperf/testdata/DisplayBitmapsTest.apk |