summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-05-11 23:40:15 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-05-11 23:40:15 +0000
commit03c9cb08c25fe134020771a78c605db759ab8374 (patch)
tree12811701d1e6359be392f706cc29d5521a228c04
parente94c09a0582949c6e096af5b3e6933cf560aae6a (diff)
parent477dbe7718d685e2e7300070142a7dfb256fab38 (diff)
downloadextras-03c9cb08c25fe134020771a78c605db759ab8374.tar.gz
Snap for 10113759 from 477dbe7718d685e2e7300070142a7dfb256fab38 to udc-release
Change-Id: I5e715e83b6793086a9b1416964ab0e6dbf023414
-rw-r--r--simpleperf/cmd_record_test.cpp31
-rw-r--r--simpleperf/testdata/DisplayBitmaps.apkbin2377615 -> 760019 bytes
-rw-r--r--simpleperf/testdata/DisplayBitmapsTest.apkbin2941948 -> 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
index 63b40744..2911edde 100644
--- a/simpleperf/testdata/DisplayBitmaps.apk
+++ b/simpleperf/testdata/DisplayBitmaps.apk
Binary files differ
diff --git a/simpleperf/testdata/DisplayBitmapsTest.apk b/simpleperf/testdata/DisplayBitmapsTest.apk
index 15807198..db5575ef 100644
--- a/simpleperf/testdata/DisplayBitmapsTest.apk
+++ b/simpleperf/testdata/DisplayBitmapsTest.apk
Binary files differ