diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2024-01-25 21:39:04 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2024-01-25 21:39:04 +0000 |
commit | 0344b03febe8107090d812706d95f1f5afbb1f22 (patch) | |
tree | 5b929bcc6607b4d772e4ba0ea4ab6da8caeb1a1e | |
parent | d85e633e1fd8c647de595a1a74dd07ce718acbb5 (diff) | |
parent | 0c62c513d96036472b0ac0c7916f0d2a240878ab (diff) | |
download | extras-0344b03febe8107090d812706d95f1f5afbb1f22.tar.gz |
Snap for 11360374 from 0c62c513d96036472b0ac0c7916f0d2a240878ab to android14-tests-release
Change-Id: Icb92f6de90d3a54c2c6f4a6f1bd85af96b74f424
-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 4ea71ad1..fef62e13 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" @@ -907,6 +908,7 @@ TEST(record_cmd, check_trampoline_after_art_jni_methods) { auto reader = RecordFileReader::CreateInstance(helper.GetDataPath()); ASSERT_TRUE(reader); ThreadTree thread_tree; + ASSERT_TRUE(reader->LoadBuildIdAndFileFeatures(thread_tree)); auto get_symbol_name = [&](ThreadEntry* thread, uint64_t ip) -> std::string { const MapEntry* map = thread_tree.FindMap(thread, ip, false); @@ -928,10 +930,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; } } } |