summaryrefslogtreecommitdiff
path: root/runtime/reflection_test.cc
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2022-09-28 08:30:41 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2022-09-28 08:30:41 +0000
commitaa54c808cd00f0951ee9c6290ae185d5fcad0d7c (patch)
treed67db44aa0b2cc26255b7ca1b80117c551ebe193 /runtime/reflection_test.cc
parent033d8590c034cf70ccc87a59151f9d7faf879f51 (diff)
parentf033a451bf35e3814a7f5c188d3e2051c1aafbe3 (diff)
Move ReflectionTest.StaticMainMethod to compiler/. am: 51d4445f21 am: f033a451bf
Original change: https://android-review.googlesource.com/c/platform/art/+/2232131 Change-Id: I7fdfc599ef97ebc7dcd254ac651e8ee48be1e6ff Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Diffstat (limited to 'runtime/reflection_test.cc')
-rw-r--r--runtime/reflection_test.cc36
1 files changed, 4 insertions, 32 deletions
diff --git a/runtime/reflection_test.cc b/runtime/reflection_test.cc
index 8a7685578e..4a24d2aab6 100644
--- a/runtime/reflection_test.cc
+++ b/runtime/reflection_test.cc
@@ -21,7 +21,7 @@
#include "art_method-inl.h"
#include "base/enums.h"
-#include "common_compiler_test.h"
+#include "common_runtime_test.h"
#include "dex/descriptors_names.h"
#include "jni/java_vm_ext.h"
#include "jni/jni_internal.h"
@@ -31,11 +31,10 @@
namespace art {
-// TODO: Convert to CommonRuntimeTest. Currently CompileDirectMethod is used in one test.
-class ReflectionTest : public CommonCompilerTest {
+class ReflectionTest : public CommonRuntimeTest {
protected:
void SetUp() override {
- CommonCompilerTest::SetUp();
+ CommonRuntimeTest::SetUp();
vm_ = Runtime::Current()->GetJavaVM();
@@ -76,7 +75,7 @@ class ReflectionTest : public CommonCompilerTest {
void TearDown() override {
CleanUpJniEnv();
- CommonCompilerTest::TearDown();
+ CommonRuntimeTest::TearDown();
}
jclass GetPrimitiveClass(char descriptor) {
@@ -511,33 +510,6 @@ class ReflectionTest : public CommonCompilerTest {
jclass sioobe_;
};
-TEST_F(ReflectionTest, StaticMainMethod) {
- ScopedObjectAccess soa(Thread::Current());
- jobject jclass_loader = LoadDex("Main");
- StackHandleScope<1> hs(soa.Self());
- Handle<mirror::ClassLoader> class_loader(
- hs.NewHandle(soa.Decode<mirror::ClassLoader>(jclass_loader)));
- CompileDirectMethod(class_loader, "Main", "main", "([Ljava/lang/String;)V");
-
- ObjPtr<mirror::Class> klass = class_linker_->FindClass(soa.Self(), "LMain;", class_loader);
- ASSERT_TRUE(klass != nullptr);
-
- ArtMethod* method = klass->FindClassMethod("main",
- "([Ljava/lang/String;)V",
- kRuntimePointerSize);
- ASSERT_TRUE(method != nullptr);
- ASSERT_TRUE(method->IsStatic());
-
- // Start runtime.
- bool started = runtime_->Start();
- CHECK(started);
- soa.Self()->TransitionFromSuspendedToRunnable();
-
- jvalue args[1];
- args[0].l = nullptr;
- InvokeWithJValues(soa, nullptr, jni::EncodeArtMethod(method), args);
-}
-
TEST_F(ReflectionTest, StaticNopMethod) {
InvokeNopMethod(true);
}