diff options
author | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2024-04-19 01:23:16 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2024-04-19 01:23:16 +0000 |
commit | 57b29e5ba9c9d0717fc2626f5313ffeef6727087 (patch) | |
tree | ea2a2b1ec3b6e1e2e0c196c03d60a94ac7176b82 | |
parent | bc87a068b500b2ce254c89fdd0e154914e441102 (diff) | |
parent | 5cec5340a8977c303bf0b215b76b58825a694f53 (diff) | |
download | extras-android13-tests-dev.tar.gz |
Merge "Merge "Merge "simpleperf: Fix flaky test check_trampoline_after_art_jni_methods" into android12-tests-dev am: e4cc9c7725" into android12L-tests-dev am: 6b5a8b2336" into android13-tests-devandroid13-tests-dev
-rw-r--r-- | simpleperf/cmd_record_test.cpp | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/simpleperf/cmd_record_test.cpp b/simpleperf/cmd_record_test.cpp index d3071a30..f74bdec9 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" @@ -899,10 +900,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; } } } |