diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2024-04-19 20:18:20 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2024-04-19 20:18:20 +0000 |
commit | 3a470d649080cb6792a6580a02fde9425ebe4b2f (patch) | |
tree | 7ea40063f69b4be43d0488d6c6ffe7c47a3de187 | |
parent | 1d163f5f506d86b9a1b9ec94bd43bacb0ba9fd36 (diff) | |
parent | d47d68068bfd5bdc93c333b3a5f44b5820828eda (diff) | |
download | extras-android12-tests-release.tar.gz |
Merge "Snap for 11738211 from e4cc9c7725b420215d194e5b3b72235ef6efb1a2 to android12-tests-release" into android12-tests-releaseandroid12-tests-release
-rw-r--r-- | simpleperf/cmd_record_test.cpp | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/simpleperf/cmd_record_test.cpp b/simpleperf/cmd_record_test.cpp index c4d347fa..e21cb86b 100644 --- a/simpleperf/cmd_record_test.cpp +++ b/simpleperf/cmd_record_test.cpp @@ -34,6 +34,7 @@ #include <android-base/test_utils.h> #include "ETMRecorder.h" +#include "JITDebugReader.h" #include "ProbeEvents.h" #include "cmd_record_impl.h" #include "command.h" @@ -860,6 +861,7 @@ TEST(record_cmd, check_trampoline_after_art_jni_methods) { auto reader = RecordFileReader::CreateInstance(helper.GetDataPath()); ASSERT_TRUE(reader); ThreadTree thread_tree; + reader->LoadBuildIdAndFileFeatures(thread_tree); auto get_symbol_name = [&](ThreadEntry* thread, uint64_t ip) -> std::string { const MapEntry* map = thread_tree.FindMap(thread, ip, false); @@ -881,10 +883,23 @@ TEST(record_cmd, check_trampoline_after_art_jni_methods) { if (android::base::StartsWith(sym_name, "art::Method_invoke") && i + 1 < ips.size()) { has_check = true; std::string name = get_symbol_name(thread, ips[i + 1]); - if (!android::base::EndsWith(name, "jni_trampoline")) { - GTEST_LOG_(ERROR) << "unexpected symbol after art::Method_invoke: " << name; - return false; + if (android::base::EndsWith(name, "jni_trampoline")) { + continue; } + // When the jni_trampoline function is from JIT cache, we may not get map info in time. + // To avoid test flakiness, we accept this. + // Case 1: It doesn't hit any maps. + if (name == "unknown") { + continue; + } + // Case 2: It hits an old map for JIT cache. + if (const MapEntry* map = thread_tree.FindMap(thread, ips[i + 1], false); + JITDebugReader::IsPathInJITSymFile(map->dso->Path())) { + continue; + } + + GTEST_LOG_(ERROR) << "unexpected symbol after art::Method_invoke: " << name; + return false; } } } |