summaryrefslogtreecommitdiff
path: root/runtime/reflection_test.cc
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2022-09-27 11:24:07 +0200
committer VladimĂ­r Marko <vmarko@google.com> 2022-09-28 07:19:04 +0000
commit51d4445f215d4a301fc72ba7a79e9ca8532b525b (patch)
treed67db44aa0b2cc26255b7ca1b80117c551ebe193 /runtime/reflection_test.cc
parente6e6bee183bf69cf313a3b942a84cd18cbaae31c (diff)
Move ReflectionTest.StaticMainMethod to compiler/.
And clean up some related code. Test: m test-art-host-gtest Test: atest art_standalone_runtime_tests Test: atest art_standalone_compiler_tests Test: atest ArtGtestsTargetChroot Change-Id: I6b60e553dad7111f6247fbd873cd46af11f00276
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);
}