diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/004-ThreadStress/thread_stress.cc | 6 | ||||
| -rw-r--r-- | test/004-UnsafeTest/unsafe_test.cc | 6 | ||||
| -rw-r--r-- | test/054-uncaught/src/Main.java | 2 | ||||
| -rw-r--r-- | test/117-nopatchoat/nopatchoat.cc | 4 | ||||
| -rw-r--r-- | test/1337-gc-coverage/gc_coverage.cc | 4 | ||||
| -rw-r--r-- | test/148-multithread-gc-annotations/gc_coverage.cc | 4 | ||||
| -rw-r--r-- | test/454-get-vreg/get_vreg_jni.cc | 4 | ||||
| -rw-r--r-- | test/457-regs/regs_jni.cc | 4 | ||||
| -rw-r--r-- | test/461-get-reference-vreg/get_reference_vreg_jni.cc | 4 | ||||
| -rw-r--r-- | test/466-get-live-vreg/get_live_vreg_jni.cc | 2 | ||||
| -rw-r--r-- | test/497-inlining-and-class-loader/clear_dex_cache.cc | 12 | ||||
| -rw-r--r-- | test/543-env-long-ref/env_long_ref.cc | 4 | ||||
| -rw-r--r-- | test/566-polymorphic-inlining/polymorphic_inline.cc | 6 | ||||
| -rw-r--r-- | test/570-checker-osr/osr.cc | 2 | ||||
| -rw-r--r-- | test/595-profile-saving/profile-saving.cc | 4 | ||||
| -rw-r--r-- | test/596-app-images/app_images.cc | 6 | ||||
| -rw-r--r-- | test/Android.bp | 2 | ||||
| -rw-r--r-- | test/common/runtime_state.cc | 8 | ||||
| -rw-r--r-- | test/common/stack_inspect.cc | 4 | ||||
| -rwxr-xr-x | test/etc/run-test-jar | 18 |
20 files changed, 62 insertions, 44 deletions
diff --git a/test/004-ThreadStress/thread_stress.cc b/test/004-ThreadStress/thread_stress.cc index 573c352423..8ae3dfb540 100644 --- a/test/004-ThreadStress/thread_stress.cc +++ b/test/004-ThreadStress/thread_stress.cc @@ -19,18 +19,18 @@ #include "jni.h" #include "mirror/string.h" #include "mirror/throwable.h" -#include "scoped_thread_state_change.h" +#include "scoped_thread_state_change-inl.h" namespace art { extern "C" JNIEXPORT void JNICALL Java_Main_printString(JNIEnv*, jclass, jstring s) { ScopedObjectAccess soa(Thread::Current()); - std::cout << soa.Decode<mirror::String*>(s)->ToModifiedUtf8(); + std::cout << soa.Decode<mirror::String>(s)->ToModifiedUtf8(); } extern "C" JNIEXPORT void JNICALL Java_Main_printThrowable(JNIEnv*, jclass, jthrowable t) { ScopedObjectAccess soa(Thread::Current()); - std::cout << soa.Decode<mirror::Throwable*>(t)->Dump(); + std::cout << soa.Decode<mirror::Throwable>(t)->Dump(); } } // namespace art diff --git a/test/004-UnsafeTest/unsafe_test.cc b/test/004-UnsafeTest/unsafe_test.cc index 3b0cf235a6..4f6ae5a68d 100644 --- a/test/004-UnsafeTest/unsafe_test.cc +++ b/test/004-UnsafeTest/unsafe_test.cc @@ -20,20 +20,20 @@ #include "mirror/class.h" #include "mirror/class-inl.h" #include "mirror/object-inl.h" -#include "scoped_thread_state_change.h" +#include "scoped_thread_state_change-inl.h" namespace art { extern "C" JNIEXPORT jint JNICALL Java_Main_vmArrayBaseOffset(JNIEnv* env, jclass, jobject classObj) { ScopedObjectAccess soa(env); - mirror::Class* klass = soa.Decode<mirror::Class*>(classObj); + ObjPtr<mirror::Class> klass = soa.Decode<mirror::Class>(classObj); return mirror::Array::DataOffset( Primitive::ComponentSize(klass->GetComponentType()->GetPrimitiveType())).Int32Value(); } extern "C" JNIEXPORT jint JNICALL Java_Main_vmArrayIndexScale(JNIEnv* env, jclass, jobject classObj) { ScopedObjectAccess soa(env); - mirror::Class* klass = soa.Decode<mirror::Class*>(classObj); + ObjPtr<mirror::Class> klass = soa.Decode<mirror::Class>(classObj); return Primitive::ComponentSize(klass->GetComponentType()->GetPrimitiveType()); } diff --git a/test/054-uncaught/src/Main.java b/test/054-uncaught/src/Main.java index 90a2311306..688a2a4d79 100644 --- a/test/054-uncaught/src/Main.java +++ b/test/054-uncaught/src/Main.java @@ -41,7 +41,7 @@ public class Main { ThreadDeathHandler defHandler = new ThreadDeathHandler("DEFAULT"); ThreadDeathHandler threadHandler = new ThreadDeathHandler("THREAD"); - System.out.println("Test " + which); + System.err.println("Test " + which); switch (which) { case 1: { Thread.setDefaultUncaughtExceptionHandler(defHandler); diff --git a/test/117-nopatchoat/nopatchoat.cc b/test/117-nopatchoat/nopatchoat.cc index c6a2e9a5a8..56c0dcd41b 100644 --- a/test/117-nopatchoat/nopatchoat.cc +++ b/test/117-nopatchoat/nopatchoat.cc @@ -20,7 +20,7 @@ #include "gc/space/image_space.h" #include "mirror/class-inl.h" #include "runtime.h" -#include "scoped_thread_state_change.h" +#include "scoped_thread_state_change-inl.h" #include "thread.h" namespace art { @@ -29,7 +29,7 @@ class NoPatchoatTest { public: static const OatFile::OatDexFile* getOatDexFile(jclass cls) { ScopedObjectAccess soa(Thread::Current()); - mirror::Class* klass = soa.Decode<mirror::Class*>(cls); + ObjPtr<mirror::Class> klass = soa.Decode<mirror::Class>(cls); const DexFile& dex_file = klass->GetDexFile(); return dex_file.GetOatDexFile(); } diff --git a/test/1337-gc-coverage/gc_coverage.cc b/test/1337-gc-coverage/gc_coverage.cc index 7cf30bd5b9..1e60bd9c8e 100644 --- a/test/1337-gc-coverage/gc_coverage.cc +++ b/test/1337-gc-coverage/gc_coverage.cc @@ -17,7 +17,7 @@ #include "gc/heap.h" #include "jni.h" #include "runtime.h" -#include "scoped_thread_state_change.h" +#include "scoped_thread_state_change-inl.h" #include "thread-inl.h" namespace art { @@ -43,7 +43,7 @@ extern "C" JNIEXPORT void JNICALL Java_Main_decrementDisableMovingGC(JNIEnv*, jc extern "C" JNIEXPORT jlong JNICALL Java_Main_objectAddress(JNIEnv* env, jclass, jobject object) { ScopedObjectAccess soa(env); - return reinterpret_cast<jlong>(soa.Decode<mirror::Object*>(object)); + return reinterpret_cast<jlong>(soa.Decode<mirror::Object>(object).Decode()); } extern "C" JNIEXPORT jboolean JNICALL Java_Main_supportCollectorTransition(JNIEnv*, jclass) { diff --git a/test/148-multithread-gc-annotations/gc_coverage.cc b/test/148-multithread-gc-annotations/gc_coverage.cc index 263eefd3ab..cb12df4a8e 100644 --- a/test/148-multithread-gc-annotations/gc_coverage.cc +++ b/test/148-multithread-gc-annotations/gc_coverage.cc @@ -17,7 +17,7 @@ #include "gc/heap.h" #include "jni.h" #include "runtime.h" -#include "scoped_thread_state_change.h" +#include "scoped_thread_state_change-inl.h" #include "thread-inl.h" namespace art { @@ -35,7 +35,7 @@ extern "C" JNIEXPORT jboolean JNICALL Java_MovingGCThread_supportHomogeneousSpac extern "C" JNIEXPORT jlong JNICALL Java_MovingGCThread_objectAddress(JNIEnv* env, jclass, jobject object) { ScopedObjectAccess soa(env); - return reinterpret_cast<jlong>(soa.Decode<mirror::Object*>(object)); + return reinterpret_cast<jlong>(soa.Decode<mirror::Object>(object).Decode()); } } // namespace diff --git a/test/454-get-vreg/get_vreg_jni.cc b/test/454-get-vreg/get_vreg_jni.cc index 57627543e0..9058af43d1 100644 --- a/test/454-get-vreg/get_vreg_jni.cc +++ b/test/454-get-vreg/get_vreg_jni.cc @@ -18,7 +18,7 @@ #include "art_method-inl.h" #include "jni.h" #include "oat_quick_method_header.h" -#include "scoped_thread_state_change.h" +#include "scoped_thread_state_change-inl.h" #include "stack.h" #include "thread.h" @@ -123,7 +123,7 @@ class TestVisitor : public StackVisitor { extern "C" JNIEXPORT jint JNICALL Java_Main_doNativeCall(JNIEnv*, jobject value) { ScopedObjectAccess soa(Thread::Current()); std::unique_ptr<Context> context(Context::Create()); - TestVisitor visitor(soa.Self(), context.get(), soa.Decode<mirror::Object*>(value)); + TestVisitor visitor(soa.Self(), context.get(), soa.Decode<mirror::Object>(value).Decode()); visitor.WalkStack(); return visitor.found_method_index_; } diff --git a/test/457-regs/regs_jni.cc b/test/457-regs/regs_jni.cc index 08db7755a4..f62a77d793 100644 --- a/test/457-regs/regs_jni.cc +++ b/test/457-regs/regs_jni.cc @@ -18,7 +18,7 @@ #include "art_method-inl.h" #include "jni.h" #include "oat_quick_method_header.h" -#include "scoped_thread_state_change.h" +#include "scoped_thread_state_change-inl.h" #include "stack.h" #include "thread.h" @@ -139,7 +139,7 @@ extern "C" JNIEXPORT void JNICALL Java_PhiLiveness_regsNativeCallWithParameters( JNIEnv*, jclass value ATTRIBUTE_UNUSED, jobject main, jint int_value, jfloat float_value) { ScopedObjectAccess soa(Thread::Current()); std::unique_ptr<Context> context(Context::Create()); - CHECK(soa.Decode<mirror::Object*>(main) == nullptr); + CHECK(soa.Decode<mirror::Object>(main) == nullptr); CHECK_EQ(int_value, 0); int32_t cast = bit_cast<int32_t, float>(float_value); CHECK_EQ(cast, 0); diff --git a/test/461-get-reference-vreg/get_reference_vreg_jni.cc b/test/461-get-reference-vreg/get_reference_vreg_jni.cc index 8122c6d7cd..7b1ab9c5be 100644 --- a/test/461-get-reference-vreg/get_reference_vreg_jni.cc +++ b/test/461-get-reference-vreg/get_reference_vreg_jni.cc @@ -17,7 +17,7 @@ #include "arch/context.h" #include "art_method-inl.h" #include "jni.h" -#include "scoped_thread_state_change.h" +#include "scoped_thread_state_change-inl.h" #include "stack.h" #include "thread.h" @@ -70,7 +70,7 @@ class TestVisitor : public StackVisitor { extern "C" JNIEXPORT jint JNICALL Java_Main_doNativeCallRef(JNIEnv*, jobject value) { ScopedObjectAccess soa(Thread::Current()); std::unique_ptr<Context> context(Context::Create()); - TestVisitor visitor(soa.Self(), context.get(), soa.Decode<mirror::Object*>(value)); + TestVisitor visitor(soa.Self(), context.get(), soa.Decode<mirror::Object>(value).Decode()); visitor.WalkStack(); return visitor.found_method_index_; } diff --git a/test/466-get-live-vreg/get_live_vreg_jni.cc b/test/466-get-live-vreg/get_live_vreg_jni.cc index 3618b4f52a..d3a033b12a 100644 --- a/test/466-get-live-vreg/get_live_vreg_jni.cc +++ b/test/466-get-live-vreg/get_live_vreg_jni.cc @@ -18,7 +18,7 @@ #include "art_method-inl.h" #include "jni.h" #include "oat_quick_method_header.h" -#include "scoped_thread_state_change.h" +#include "scoped_thread_state_change-inl.h" #include "stack.h" #include "thread.h" diff --git a/test/497-inlining-and-class-loader/clear_dex_cache.cc b/test/497-inlining-and-class-loader/clear_dex_cache.cc index 1597c4a65d..3f2df29472 100644 --- a/test/497-inlining-and-class-loader/clear_dex_cache.cc +++ b/test/497-inlining-and-class-loader/clear_dex_cache.cc @@ -17,7 +17,7 @@ #include "art_method-inl.h" #include "base/enums.h" #include "jni.h" -#include "scoped_thread_state_change.h" +#include "scoped_thread_state_change-inl.h" #include "stack.h" #include "thread.h" @@ -29,7 +29,7 @@ extern "C" JNIEXPORT jobject JNICALL Java_Main_cloneResolvedMethods(JNIEnv* env, jclass, jclass cls) { ScopedObjectAccess soa(Thread::Current()); - mirror::DexCache* dex_cache = soa.Decode<mirror::Class*>(cls)->GetDexCache(); + mirror::DexCache* dex_cache = soa.Decode<mirror::Class>(cls)->GetDexCache(); size_t num_methods = dex_cache->NumResolvedMethods(); ArtMethod** methods = dex_cache->GetResolvedMethods(); CHECK_EQ(num_methods != 0u, methods != nullptr); @@ -43,7 +43,7 @@ extern "C" JNIEXPORT jobject JNICALL Java_Main_cloneResolvedMethods(JNIEnv* env, array = env->NewLongArray(num_methods); } CHECK(array != nullptr); - mirror::PointerArray* pointer_array = soa.Decode<mirror::PointerArray*>(array); + mirror::PointerArray* pointer_array = soa.Decode<mirror::PointerArray>(array).Decode(); for (size_t i = 0; i != num_methods; ++i) { ArtMethod* method = mirror::DexCache::GetElementPtrSize(methods, i, kRuntimePointerSize); pointer_array->SetElementPtrSize(i, method, kRuntimePointerSize); @@ -54,11 +54,11 @@ extern "C" JNIEXPORT jobject JNICALL Java_Main_cloneResolvedMethods(JNIEnv* env, extern "C" JNIEXPORT void JNICALL Java_Main_restoreResolvedMethods( JNIEnv*, jclass, jclass cls, jobject old_cache) { ScopedObjectAccess soa(Thread::Current()); - mirror::DexCache* dex_cache = soa.Decode<mirror::Class*>(cls)->GetDexCache(); + mirror::DexCache* dex_cache = soa.Decode<mirror::Class>(cls)->GetDexCache(); size_t num_methods = dex_cache->NumResolvedMethods(); - ArtMethod** methods = soa.Decode<mirror::Class*>(cls)->GetDexCache()->GetResolvedMethods(); + ArtMethod** methods = soa.Decode<mirror::Class>(cls)->GetDexCache()->GetResolvedMethods(); CHECK_EQ(num_methods != 0u, methods != nullptr); - mirror::PointerArray* old = soa.Decode<mirror::PointerArray*>(old_cache); + ObjPtr<mirror::PointerArray> old = soa.Decode<mirror::PointerArray>(old_cache); CHECK_EQ(methods != nullptr, old != nullptr); CHECK_EQ(num_methods, static_cast<size_t>(old->GetLength())); for (size_t i = 0; i != num_methods; ++i) { diff --git a/test/543-env-long-ref/env_long_ref.cc b/test/543-env-long-ref/env_long_ref.cc index 557def6d0a..cd127ef3cb 100644 --- a/test/543-env-long-ref/env_long_ref.cc +++ b/test/543-env-long-ref/env_long_ref.cc @@ -17,7 +17,7 @@ #include "arch/context.h" #include "art_method-inl.h" #include "jni.h" -#include "scoped_thread_state_change.h" +#include "scoped_thread_state_change-inl.h" #include "stack.h" #include "thread.h" @@ -43,7 +43,7 @@ class TestVisitor : public StackVisitor { uint32_t value = 0; CHECK(GetVReg(m, 1, kReferenceVReg, &value)); CHECK_EQ(reinterpret_cast<mirror::Object*>(value), - soa_.Decode<mirror::Object*>(expected_value_)); + soa_.Decode<mirror::Object>(expected_value_).Decode()); } return true; } diff --git a/test/566-polymorphic-inlining/polymorphic_inline.cc b/test/566-polymorphic-inlining/polymorphic_inline.cc index 89293cc38a..00c1b02675 100644 --- a/test/566-polymorphic-inlining/polymorphic_inline.cc +++ b/test/566-polymorphic-inlining/polymorphic_inline.cc @@ -20,14 +20,14 @@ #include "jit/jit_code_cache.h" #include "jit/profiling_info.h" #include "oat_quick_method_header.h" -#include "scoped_thread_state_change.h" +#include "scoped_thread_state_change-inl.h" #include "stack_map.h" namespace art { static void do_checks(jclass cls, const char* method_name) { ScopedObjectAccess soa(Thread::Current()); - mirror::Class* klass = soa.Decode<mirror::Class*>(cls); + ObjPtr<mirror::Class> klass = soa.Decode<mirror::Class>(cls); jit::Jit* jit = Runtime::Current()->GetJit(); jit::JitCodeCache* code_cache = jit->GetCodeCache(); ArtMethod* method = klass->FindDeclaredDirectMethodByName(method_name, kRuntimePointerSize); @@ -53,7 +53,7 @@ static void do_checks(jclass cls, const char* method_name) { static void allocate_profiling_info(jclass cls, const char* method_name) { ScopedObjectAccess soa(Thread::Current()); - mirror::Class* klass = soa.Decode<mirror::Class*>(cls); + ObjPtr<mirror::Class> klass = soa.Decode<mirror::Class>(cls); ArtMethod* method = klass->FindDeclaredDirectMethodByName(method_name, kRuntimePointerSize); ProfilingInfo::Create(soa.Self(), method, /* retry_allocation */ true); } diff --git a/test/570-checker-osr/osr.cc b/test/570-checker-osr/osr.cc index adda3ccb5b..50e8382ff6 100644 --- a/test/570-checker-osr/osr.cc +++ b/test/570-checker-osr/osr.cc @@ -19,7 +19,7 @@ #include "jit/jit_code_cache.h" #include "jit/profiling_info.h" #include "oat_quick_method_header.h" -#include "scoped_thread_state_change.h" +#include "scoped_thread_state_change-inl.h" #include "ScopedUtfChars.h" #include "stack_map.h" diff --git a/test/595-profile-saving/profile-saving.cc b/test/595-profile-saving/profile-saving.cc index a265dce409..bf3d812f94 100644 --- a/test/595-profile-saving/profile-saving.cc +++ b/test/595-profile-saving/profile-saving.cc @@ -24,7 +24,7 @@ #include "mirror/class-inl.h" #include "oat_file_assistant.h" #include "oat_file_manager.h" -#include "scoped_thread_state_change.h" +#include "scoped_thread_state_change-inl.h" #include "ScopedUtfChars.h" #include "thread.h" @@ -74,7 +74,7 @@ extern "C" JNIEXPORT jboolean JNICALL Java_Main_presentInProfile( ScopedUtfChars filename_chars(env, filename); CHECK(filename_chars.c_str() != nullptr); ScopedObjectAccess soa(Thread::Current()); - const DexFile* dex_file = soa.Decode<mirror::Class*>(cls)->GetDexCache()->GetDexFile(); + const DexFile* dex_file = soa.Decode<mirror::Class>(cls)->GetDexCache()->GetDexFile(); return ProfileSaver::HasSeenMethod(std::string(filename_chars.c_str()), dex_file, static_cast<uint16_t>(method_index)); diff --git a/test/596-app-images/app_images.cc b/test/596-app-images/app_images.cc index a5bbf5fbaa..78cc3fd118 100644 --- a/test/596-app-images/app_images.cc +++ b/test/596-app-images/app_images.cc @@ -26,7 +26,7 @@ #include "jni.h" #include "mirror/class.h" #include "runtime.h" -#include "scoped_thread_state_change.h" +#include "scoped_thread_state_change-inl.h" namespace art { @@ -48,13 +48,13 @@ extern "C" JNIEXPORT jboolean JNICALL Java_Main_checkAppImageLoaded(JNIEnv*, jcl extern "C" JNIEXPORT jboolean JNICALL Java_Main_checkAppImageContains(JNIEnv*, jclass, jclass c) { ScopedObjectAccess soa(Thread::Current()); - mirror::Class* klass_ptr = soa.Decode<mirror::Class*>(c); + ObjPtr<mirror::Class> klass_ptr = soa.Decode<mirror::Class>(c); for (auto* space : Runtime::Current()->GetHeap()->GetContinuousSpaces()) { if (space->IsImageSpace()) { auto* image_space = space->AsImageSpace(); const auto& image_header = image_space->GetImageHeader(); if (image_header.IsAppImage()) { - if (image_space->HasAddress(klass_ptr)) { + if (image_space->HasAddress(klass_ptr.Decode())) { return JNI_TRUE; } } diff --git a/test/Android.bp b/test/Android.bp index 72dcbba9e2..628f3772e0 100644 --- a/test/Android.bp +++ b/test/Android.bp @@ -110,7 +110,7 @@ art_cc_defaults { "-Wl,-u,Java_MyClassNatives_sbar", ], shared_libs: [ - "libcutils", + "liblog", "libdl", "libz", ], diff --git a/test/common/runtime_state.cc b/test/common/runtime_state.cc index fd1ba020dd..42481483f4 100644 --- a/test/common/runtime_state.cc +++ b/test/common/runtime_state.cc @@ -24,7 +24,7 @@ #include "mirror/class-inl.h" #include "oat_quick_method_header.h" #include "runtime.h" -#include "scoped_thread_state_change.h" +#include "scoped_thread_state_change-inl.h" #include "ScopedUtfChars.h" #include "thread-inl.h" @@ -35,7 +35,7 @@ namespace art { extern "C" JNIEXPORT jboolean JNICALL Java_Main_hasOatFile(JNIEnv* env, jclass cls) { ScopedObjectAccess soa(env); - mirror::Class* klass = soa.Decode<mirror::Class*>(cls); + ObjPtr<mirror::Class> klass = soa.Decode<mirror::Class>(cls); const DexFile& dex_file = klass->GetDexFile(); const OatFile::OatDexFile* oat_dex_file = dex_file.GetOatDexFile(); return (oat_dex_file != nullptr) ? JNI_TRUE : JNI_FALSE; @@ -75,7 +75,7 @@ extern "C" JNIEXPORT jboolean JNICALL Java_Main_isImageDex2OatEnabled(JNIEnv* en extern "C" JNIEXPORT jboolean JNICALL Java_Main_compiledWithOptimizing(JNIEnv* env, jclass cls) { ScopedObjectAccess soa(env); - mirror::Class* klass = soa.Decode<mirror::Class*>(cls); + ObjPtr<mirror::Class> klass = soa.Decode<mirror::Class>(cls); const DexFile& dex_file = klass->GetDexFile(); const OatFile::OatDexFile* oat_dex_file = dex_file.GetOatDexFile(); if (oat_dex_file == nullptr) { @@ -134,7 +134,7 @@ extern "C" JNIEXPORT void JNICALL Java_Main_ensureJitCompiled(JNIEnv* env, ScopedUtfChars chars(env, method_name); CHECK(chars.c_str() != nullptr); - method = soa.Decode<mirror::Class*>(cls)->FindDeclaredDirectMethodByName( + method = soa.Decode<mirror::Class>(cls)->FindDeclaredDirectMethodByName( chars.c_str(), kRuntimePointerSize); } diff --git a/test/common/stack_inspect.cc b/test/common/stack_inspect.cc index 85ea1c8dd1..d2aacf0562 100644 --- a/test/common/stack_inspect.cc +++ b/test/common/stack_inspect.cc @@ -21,7 +21,7 @@ #include "mirror/class-inl.h" #include "nth_caller_visitor.h" #include "runtime.h" -#include "scoped_thread_state_change.h" +#include "scoped_thread_state_change-inl.h" #include "stack.h" #include "thread-inl.h" @@ -62,7 +62,7 @@ extern "C" JNIEXPORT void JNICALL Java_Main_assertIsInterpreted(JNIEnv* env, jcl static jboolean IsManaged(JNIEnv* env, jclass cls, size_t level) { ScopedObjectAccess soa(env); - mirror::Class* klass = soa.Decode<mirror::Class*>(cls); + ObjPtr<mirror::Class> klass = soa.Decode<mirror::Class>(cls); const DexFile& dex_file = klass->GetDexFile(); const OatFile::OatDexFile* oat_dex_file = dex_file.GetOatDexFile(); if (oat_dex_file == nullptr) { diff --git a/test/etc/run-test-jar b/test/etc/run-test-jar index c51cb0db2a..d8f42a2b4b 100755 --- a/test/etc/run-test-jar +++ b/test/etc/run-test-jar @@ -404,6 +404,24 @@ if [ "$HOST" = "n" ]; then fi fi +# Prevent test from silently falling back to interpreter in no-prebuild mode. This happens +# when DEX_LOCATION path is too long, because vdex/odex filename is constructed by taking +# full path to dex, stripping leading '/', appending '@classes.vdex' and changing every +# remaining '/' into '@'. +if [ "$HOST" = "y" ]; then + max_filename_size=$(getconf NAME_MAX $DEX_LOCATION) +else + # There is no getconf on device, fallback to standard value. See NAME_MAX in kernel <linux/limits.h> + max_filename_size=255 +fi +# Compute VDEX_NAME. +DEX_LOCATION_STRIPPED="${DEX_LOCATION#/}" +VDEX_NAME="${DEX_LOCATION_STRIPPED//\//@}@$TEST_NAME.jar@classes.vdex" +if [ ${#VDEX_NAME} -gt $max_filename_size ]; then + echo "Dex location path too long." + exit 1 +fi + dex2oat_cmdline="true" mkdir_locations="${DEX_LOCATION}/dalvik-cache/$ISA" strip_cmdline="true" |