summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Nicolas Geoffray <ngeoffray@google.com> 2025-01-23 07:50:45 -0800
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2025-01-23 07:50:45 -0800
commit01c01e77cb876e678a9b72a2e1402cea17f93d54 (patch)
treed45dc5b3af576a5a34cdc24286e678aa524b0bc6
parent40e0f5439f4346820b3d77930d062697e32ae93d (diff)
parentd41c821a0f66b6d9a2746b6883ad2d7da33ef5d9 (diff)
Manually initialize WellKnownClasses required by tests. am: 70292c9cea am: d41c821a0f
Original change: https://android-review.googlesource.com/c/platform/art/+/3459708 Change-Id: I26205bb99add6ffbe8bfe3df85047d960a85fe03 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--cmdline/cmdline.h5
-rw-r--r--dex2oat/linker/image_write_read_test.cc2
2 files changed, 7 insertions, 0 deletions
diff --git a/cmdline/cmdline.h b/cmdline/cmdline.h
index 39fcaebd63..20f5dbed7f 100644
--- a/cmdline/cmdline.h
+++ b/cmdline/cmdline.h
@@ -33,9 +33,11 @@
#include "base/logging.h"
#include "base/mutex.h"
#include "base/utils.h"
+#include "jni/jni_env_ext.h"
#include "noop_compiler_callbacks.h"
#include "oat/oat_file_assistant_context.h"
#include "runtime.h"
+#include "well_known_classes.h"
#if !defined(NDEBUG)
#define DBG_LOG LOG(INFO)
@@ -85,6 +87,9 @@ static Runtime* StartRuntime(const std::vector<std::string>& boot_image_location
return nullptr;
}
+ // Need well-known-classes.
+ WellKnownClasses::Init(Thread::Current()->GetJniEnv());
+
// Runtime::Create acquired the mutator_lock_ that is normally given away when we Runtime::Start,
// give it away now and then switch to a more manageable ScopedObjectAccess.
Thread::Current()->TransitionFromRunnableToSuspended(ThreadState::kNative);
diff --git a/dex2oat/linker/image_write_read_test.cc b/dex2oat/linker/image_write_read_test.cc
index aadcbea894..d7fb242fc9 100644
--- a/dex2oat/linker/image_write_read_test.cc
+++ b/dex2oat/linker/image_write_read_test.cc
@@ -78,6 +78,8 @@ void ImageWriteReadTest::TestWriteRead(ImageHeader::StorageMode storage_mode,
return;
}
runtime_.reset(Runtime::Current());
+ // Need well-known-classes.
+ WellKnownClasses::Init(Thread::Current()->GetJniEnv());
// Runtime::Create acquired the mutator_lock_ that is normally given away when we Runtime::Start,
// give it away now and then switch to a more managable ScopedObjectAccess.
Thread::Current()->TransitionFromRunnableToSuspended(ThreadState::kNative);