summaryrefslogtreecommitdiffstats
path: root/runtime/common_test.h
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2014-01-02 17:36:41 -0800
committerIan Rogers <irogers@google.com>2014-01-03 10:51:59 -0800
commit1d99e4549309d05007d041d058b1878de88e9585 (patch)
tree3c5508e7f4084b124532aabaa39fdea10eb1788c /runtime/common_test.h
parent5de028bf066052afd15c6733a4e6edfe91ad222c (diff)
downloadart-1d99e4549309d05007d041d058b1878de88e9585.zip
art-1d99e4549309d05007d041d058b1878de88e9585.tar.gz
art-1d99e4549309d05007d041d058b1878de88e9585.tar.bz2
Disallow JNI NewObjectArray of primitive types.
Also, make jni_internal_test execute via the interpreter rather than compile methods. Add tests for passing negative array sizes to JNI routines new functions. Re-enable the tests NewStringNullCharsNonzeroLength and NewDirectBuffer_GetDirectBufferAddress_GetDirectBufferCapacity. Test and explicitly fail if the initial value argument to NewObjectArray isn't assignable to that type of array. Use unchecked ObjectArray::Set with NewObjectArray with an initial value. Change-Id: If3491cb5f974b42cf70c1b850819265f9963ee48
Diffstat (limited to 'runtime/common_test.h')
-rw-r--r--runtime/common_test.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/runtime/common_test.h b/runtime/common_test.h
index a3cbde3..ee95d5b 100644
--- a/runtime/common_test.h
+++ b/runtime/common_test.h
@@ -296,7 +296,6 @@ class CommonTest : public testing::Test {
void MakeExecutable(mirror::ArtMethod* method) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
CHECK(method != NULL);
- LOG(INFO) << "MakeExecutable " << PrettyMethod(method);
const CompiledMethod* compiled_method = NULL;
if (!method->IsAbstract()) {
@@ -325,7 +324,6 @@ class CommonTest : public testing::Test {
const void* method_code;
// No code? You must mean to go into the interpreter.
method_code = GetCompiledCodeToInterpreterBridge();
- LOG(INFO) << "MakeExecutable " << PrettyMethod(method) << " code=" << method_code;
OatFile::OatMethod oat_method = CreateOatMethod(method_code,
kStackAlignment,
0,
@@ -382,6 +380,20 @@ class CommonTest : public testing::Test {
setenv("ANDROID_DATA", android_data.c_str(), 1);
}
+ void MakeExecutable(mirror::ClassLoader* class_loader, const char* class_name)
+ SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
+ std::string class_descriptor(DotToDescriptor(class_name));
+ SirtRef<mirror::ClassLoader> loader(Thread::Current(), class_loader);
+ mirror::Class* klass = class_linker_->FindClass(class_descriptor.c_str(), loader);
+ CHECK(klass != NULL) << "Class not found " << class_name;
+ for (size_t i = 0; i < klass->NumDirectMethods(); i++) {
+ MakeExecutable(klass->GetDirectMethod(i));
+ }
+ for (size_t i = 0; i < klass->NumVirtualMethods(); i++) {
+ MakeExecutable(klass->GetVirtualMethod(i));
+ }
+ }
+
protected:
static bool IsHost() {
return (getenv("ANDROID_BUILD_TOP") != NULL);