summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/004-ThreadStress/src-art/Main.java (renamed from test/004-ThreadStress/src/Main.java)66
-rw-r--r--test/044-proxy/src/Main.java4
-rw-r--r--test/044-proxy/src/OOMEOnDispatch.java18
-rw-r--r--test/141-class-unload/jni_unload.cc14
-rw-r--r--test/169-threadgroup-jni/expected.txt1
-rw-r--r--test/169-threadgroup-jni/info.txt1
-rw-r--r--test/169-threadgroup-jni/jni_daemon_thread.cc65
-rw-r--r--test/169-threadgroup-jni/src/Main.java39
-rw-r--r--test/651-checker-int-simd-minmax/src/Main.java16
-rw-r--r--test/674-HelloWorld-Dm/expected.txt1
-rw-r--r--test/674-HelloWorld-Dm/info.txt1
-rw-r--r--test/674-HelloWorld-Dm/run17
-rw-r--r--test/674-HelloWorld-Dm/src/Main.java21
-rw-r--r--test/674-hotness-compiled/expected.txt1
-rw-r--r--test/674-hotness-compiled/info.txt1
-rwxr-xr-xtest/674-hotness-compiled/run17
-rw-r--r--test/674-hotness-compiled/src/Main.java46
-rw-r--r--test/Android.bp1
-rw-r--r--test/common/runtime_state.cc28
-rwxr-xr-xtest/etc/run-test-jar22
-rw-r--r--test/knownfailures.json6
-rwxr-xr-xtest/run-test3
22 files changed, 326 insertions, 63 deletions
diff --git a/test/004-ThreadStress/src/Main.java b/test/004-ThreadStress/src-art/Main.java
index c03a9120bf..a142934638 100644
--- a/test/004-ThreadStress/src/Main.java
+++ b/test/004-ThreadStress/src-art/Main.java
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+import dalvik.system.VMRuntime;
+
import java.lang.reflect.*;
import java.util.ArrayList;
import java.util.Arrays;
@@ -32,25 +34,26 @@ import java.util.concurrent.Semaphore;
// (It is important to pass Main if you want to give parameters...)
//
// ThreadStress command line parameters:
-// -n X ............ number of threads
-// -d X ............ number of daemon threads
-// -o X ............ number of overall operations
-// -t X ............ number of operations per thread
-// -p X ............ number of permits granted by semaphore
-// --dumpmap ....... print the frequency map
-// --locks-only .... select a pre-set frequency map with lock-related operations only
-// --allocs-only ... select a pre-set frequency map with allocation-related operations only
-// -oom:X .......... frequency of OOM (double)
-// -sigquit:X ...... frequency of SigQuit (double)
-// -alloc:X ........ frequency of Alloc (double)
-// -largealloc:X ... frequency of LargeAlloc (double)
-// -stacktrace:X ... frequency of StackTrace (double)
-// -exit:X ......... frequency of Exit (double)
-// -sleep:X ........ frequency of Sleep (double)
-// -wait:X ......... frequency of Wait (double)
-// -timedwait:X .... frequency of TimedWait (double)
-// -syncandwork:X .. frequency of SyncAndWork (double)
-// -queuedwait:X ... frequency of QueuedWait (double)
+// -n X .............. number of threads
+// -d X .............. number of daemon threads
+// -o X .............. number of overall operations
+// -t X .............. number of operations per thread
+// -p X .............. number of permits granted by semaphore
+// --dumpmap ......... print the frequency map
+// --locks-only ...... select a pre-set frequency map with lock-related operations only
+// --allocs-only ..... select a pre-set frequency map with allocation-related operations only
+// -oom:X ............ frequency of OOM (double)
+// -sigquit:X ........ frequency of SigQuit (double)
+// -alloc:X .......... frequency of Alloc (double)
+// -largealloc:X ..... frequency of LargeAlloc (double)
+// -nonmovingalloc:X.. frequency of NonMovingAlloc (double)
+// -stacktrace:X ..... frequency of StackTrace (double)
+// -exit:X ........... frequency of Exit (double)
+// -sleep:X .......... frequency of Sleep (double)
+// -wait:X ........... frequency of Wait (double)
+// -timedwait:X ...... frequency of TimedWait (double)
+// -syncandwork:X .... frequency of SyncAndWork (double)
+// -queuedwait:X ..... frequency of QueuedWait (double)
public class Main implements Runnable {
@@ -158,6 +161,25 @@ public class Main implements Runnable {
}
}
+ private final static class NonMovingAlloc extends Operation {
+ private final static int ALLOC_SIZE = 1024; // Needs to be small enough to not be in LOS.
+ private final static int ALLOC_COUNT = 1024;
+ private final static VMRuntime runtime = VMRuntime.getRuntime();
+
+ @Override
+ public boolean perform() {
+ try {
+ List<byte[]> l = new ArrayList<byte[]>();
+ for (int i = 0; i < ALLOC_COUNT; i++) {
+ l.add((byte[]) runtime.newNonMovableArray(byte.class, ALLOC_SIZE));
+ }
+ } catch (OutOfMemoryError e) {
+ }
+ return true;
+ }
+ }
+
+
private final static class StackTrace extends Operation {
@Override
public boolean perform() {
@@ -295,6 +317,9 @@ public class Main implements Runnable {
frequencyMap.put(new SigQuit(), 0.095); // 19/200
frequencyMap.put(new Alloc(), 0.225); // 45/200
frequencyMap.put(new LargeAlloc(), 0.05); // 10/200
+ // TODO: NonMovingAlloc operations fail an assertion with the
+ // GSS collector (see b/72738921); disable them for now.
+ frequencyMap.put(new NonMovingAlloc(), 0.0); // 0/200
frequencyMap.put(new StackTrace(), 0.1); // 20/200
frequencyMap.put(new Exit(), 0.225); // 45/200
frequencyMap.put(new Sleep(), 0.125); // 25/200
@@ -308,8 +333,9 @@ public class Main implements Runnable {
private final static Map<Operation, Double> createAllocFrequencyMap() {
Map<Operation, Double> frequencyMap = new HashMap<Operation, Double>();
frequencyMap.put(new Sleep(), 0.2); // 40/200
- frequencyMap.put(new Alloc(), 0.65); // 130/200
+ frequencyMap.put(new Alloc(), 0.575); // 115/200
frequencyMap.put(new LargeAlloc(), 0.15); // 30/200
+ frequencyMap.put(new NonMovingAlloc(), 0.075); // 15/200
return frequencyMap;
}
diff --git a/test/044-proxy/src/Main.java b/test/044-proxy/src/Main.java
index e44c122e3d..7b70e65b8c 100644
--- a/test/044-proxy/src/Main.java
+++ b/test/044-proxy/src/Main.java
@@ -54,4 +54,8 @@ public class Main {
private static final HashMap<String, String> proxyClassNameMap = new HashMap<String, String>();
private static int uniqueTestProxyClassNum = 0;
+
+ static native void startJit();
+ static native void stopJit();
+ static native void waitForCompilation();
}
diff --git a/test/044-proxy/src/OOMEOnDispatch.java b/test/044-proxy/src/OOMEOnDispatch.java
index 94f267980d..2ee57926ae 100644
--- a/test/044-proxy/src/OOMEOnDispatch.java
+++ b/test/044-proxy/src/OOMEOnDispatch.java
@@ -32,6 +32,11 @@ public class OOMEOnDispatch implements InvocationHandler {
OOMEInterface.class.getClassLoader(), new Class[] { OOMEInterface.class },
handler);
+ // Stop the JIT to be sure nothing is running that could be resolving classes or causing
+ // verification.
+ Main.stopJit();
+ Main.waitForCompilation();
+
int l = 1024 * 1024;
while (l > 8) {
try {
@@ -40,17 +45,6 @@ public class OOMEOnDispatch implements InvocationHandler {
l = l/2;
}
}
- // Have an extra run with the exact size of Method objects. The above loop should have
- // filled with enough large objects for simplicity and speed, but ensure exact allocation
- // size.
- final int methodAsByteArrayLength = 40 - 12; // Method size - byte array overhead.
- for (;;) {
- try {
- storage.add(new byte[methodAsByteArrayLength]);
- } catch (OutOfMemoryError e) {
- break;
- }
- }
try {
inf.foo();
@@ -60,6 +54,8 @@ public class OOMEOnDispatch implements InvocationHandler {
storage.clear();
System.out.println("Received OOME");
}
+
+ Main.startJit();
}
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
diff --git a/test/141-class-unload/jni_unload.cc b/test/141-class-unload/jni_unload.cc
index 355457d68d..894ae8b0d7 100644
--- a/test/141-class-unload/jni_unload.cc
+++ b/test/141-class-unload/jni_unload.cc
@@ -32,19 +32,5 @@ extern "C" JNIEXPORT void JNICALL Java_IntHolder_waitForCompilation(JNIEnv*, jcl
}
}
-extern "C" JNIEXPORT void JNICALL Java_Main_stopJit(JNIEnv*, jclass) {
- jit::Jit* jit = Runtime::Current()->GetJit();
- if (jit != nullptr) {
- jit->Stop();
- }
-}
-
-extern "C" JNIEXPORT void JNICALL Java_Main_startJit(JNIEnv*, jclass) {
- jit::Jit* jit = Runtime::Current()->GetJit();
- if (jit != nullptr) {
- jit->Start();
- }
-}
-
} // namespace
} // namespace art
diff --git a/test/169-threadgroup-jni/expected.txt b/test/169-threadgroup-jni/expected.txt
new file mode 100644
index 0000000000..6a5618ebc6
--- /dev/null
+++ b/test/169-threadgroup-jni/expected.txt
@@ -0,0 +1 @@
+JNI_OnLoad called
diff --git a/test/169-threadgroup-jni/info.txt b/test/169-threadgroup-jni/info.txt
new file mode 100644
index 0000000000..b4c77e232b
--- /dev/null
+++ b/test/169-threadgroup-jni/info.txt
@@ -0,0 +1 @@
+Ensure that attached threads are correctly handled in ThreadGroups.
diff --git a/test/169-threadgroup-jni/jni_daemon_thread.cc b/test/169-threadgroup-jni/jni_daemon_thread.cc
new file mode 100644
index 0000000000..94902dcf2c
--- /dev/null
+++ b/test/169-threadgroup-jni/jni_daemon_thread.cc
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <jni.h>
+#include <nativehelper/scoped_local_ref.h>
+#include <pthread.h>
+
+#include <android-base/logging.h>
+
+namespace art {
+
+static JavaVM* vm = nullptr;
+
+static void* Runner(void* arg) {
+ CHECK(vm != nullptr);
+
+ jobject thread_group = reinterpret_cast<jobject>(arg);
+ JNIEnv* env = nullptr;
+ JavaVMAttachArgs args = { JNI_VERSION_1_6, __FUNCTION__, thread_group };
+ int attach_result = vm->AttachCurrentThread(&env, &args);
+ CHECK_EQ(attach_result, 0);
+
+ {
+ ScopedLocalRef<jclass> klass(env, env->FindClass("Main"));
+ CHECK(klass != nullptr);
+
+ jmethodID id = env->GetStaticMethodID(klass.get(), "runFromNative", "()V");
+ CHECK(id != nullptr);
+
+ env->CallStaticVoidMethod(klass.get(), id);
+ }
+
+ int detach_result = vm->DetachCurrentThread();
+ CHECK_EQ(detach_result, 0);
+ return nullptr;
+}
+
+extern "C" JNIEXPORT void JNICALL Java_Main_testNativeThread(
+ JNIEnv* env, jclass, jobject thread_group) {
+ CHECK_EQ(env->GetJavaVM(&vm), 0);
+ jobject global_thread_group = env->NewGlobalRef(thread_group);
+
+ pthread_t pthread;
+ int pthread_create_result = pthread_create(&pthread, nullptr, Runner, global_thread_group);
+ CHECK_EQ(pthread_create_result, 0);
+ int pthread_join_result = pthread_join(pthread, nullptr);
+ CHECK_EQ(pthread_join_result, 0);
+
+ env->DeleteGlobalRef(global_thread_group);
+}
+
+} // namespace art
diff --git a/test/169-threadgroup-jni/src/Main.java b/test/169-threadgroup-jni/src/Main.java
new file mode 100644
index 0000000000..2cd1fcfa24
--- /dev/null
+++ b/test/169-threadgroup-jni/src/Main.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class Main {
+ public static void main(String[] args) throws Exception {
+ System.loadLibrary(args[0]);
+
+ ThreadGroup group = new ThreadGroup("Test group");
+ group.setDaemon(true);
+
+ testNativeThread(group);
+
+ if (!executed) {
+ throw new IllegalStateException("Expected runFromNative to be done.");
+ }
+ if (!group.isDestroyed()) {
+ throw new IllegalStateException("Threadgroup should be destroyed.");
+ }
+ }
+
+ private static boolean executed = false;
+ private static void runFromNative() {
+ executed = true;
+ }
+ private static native void testNativeThread(ThreadGroup group);
+}
diff --git a/test/651-checker-int-simd-minmax/src/Main.java b/test/651-checker-int-simd-minmax/src/Main.java
index 66343adaa8..cfa0ae7dca 100644
--- a/test/651-checker-int-simd-minmax/src/Main.java
+++ b/test/651-checker-int-simd-minmax/src/Main.java
@@ -27,10 +27,10 @@ public class Main {
/// CHECK-DAG: ArraySet [{{l\d+}},<<Phi>>,<<Min>>] loop:<<Loop>> outer_loop:none
//
/// CHECK-START-{ARM,ARM64,MIPS64}: void Main.doitMin(int[], int[], int[]) loop_optimization (after)
- /// CHECK-DAG: <<Get1:d\d+>> VecLoad loop:<<Loop:B\d+>> outer_loop:none
- /// CHECK-DAG: <<Get2:d\d+>> VecLoad loop:<<Loop>> outer_loop:none
- /// CHECK-DAG: <<Min:d\d+>> VecMin [<<Get1>>,<<Get2>>] unsigned:false loop:<<Loop>> outer_loop:none
- /// CHECK-DAG: VecStore [{{l\d+}},{{i\d+}},<<Min>>] loop:<<Loop>> outer_loop:none
+ /// CHECK-DAG: <<Get1:d\d+>> VecLoad loop:<<Loop:B\d+>> outer_loop:none
+ /// CHECK-DAG: <<Get2:d\d+>> VecLoad loop:<<Loop>> outer_loop:none
+ /// CHECK-DAG: <<Min:d\d+>> VecMin [<<Get1>>,<<Get2>>] packed_type:Int32 loop:<<Loop>> outer_loop:none
+ /// CHECK-DAG: VecStore [{{l\d+}},{{i\d+}},<<Min>>] loop:<<Loop>> outer_loop:none
private static void doitMin(int[] x, int[] y, int[] z) {
int min = Math.min(x.length, Math.min(y.length, z.length));
for (int i = 0; i < min; i++) {
@@ -46,10 +46,10 @@ public class Main {
/// CHECK-DAG: ArraySet [{{l\d+}},<<Phi>>,<<Max>>] loop:<<Loop>> outer_loop:none
//
/// CHECK-START-{ARM,ARM64,MIPS64}: void Main.doitMax(int[], int[], int[]) loop_optimization (after)
- /// CHECK-DAG: <<Get1:d\d+>> VecLoad loop:<<Loop:B\d+>> outer_loop:none
- /// CHECK-DAG: <<Get2:d\d+>> VecLoad loop:<<Loop>> outer_loop:none
- /// CHECK-DAG: <<Max:d\d+>> VecMax [<<Get1>>,<<Get2>>] unsigned:false loop:<<Loop>> outer_loop:none
- /// CHECK-DAG: VecStore [{{l\d+}},{{i\d+}},<<Max>>] loop:<<Loop>> outer_loop:none
+ /// CHECK-DAG: <<Get1:d\d+>> VecLoad loop:<<Loop:B\d+>> outer_loop:none
+ /// CHECK-DAG: <<Get2:d\d+>> VecLoad loop:<<Loop>> outer_loop:none
+ /// CHECK-DAG: <<Max:d\d+>> VecMax [<<Get1>>,<<Get2>>] packed_type:Int32 loop:<<Loop>> outer_loop:none
+ /// CHECK-DAG: VecStore [{{l\d+}},{{i\d+}},<<Max>>] loop:<<Loop>> outer_loop:none
private static void doitMax(int[] x, int[] y, int[] z) {
int min = Math.min(x.length, Math.min(y.length, z.length));
for (int i = 0; i < min; i++) {
diff --git a/test/674-HelloWorld-Dm/expected.txt b/test/674-HelloWorld-Dm/expected.txt
new file mode 100644
index 0000000000..af5626b4a1
--- /dev/null
+++ b/test/674-HelloWorld-Dm/expected.txt
@@ -0,0 +1 @@
+Hello, world!
diff --git a/test/674-HelloWorld-Dm/info.txt b/test/674-HelloWorld-Dm/info.txt
new file mode 100644
index 0000000000..3a769c48a6
--- /dev/null
+++ b/test/674-HelloWorld-Dm/info.txt
@@ -0,0 +1 @@
+Hello World test with --dm-file passed to dex2oat.
diff --git a/test/674-HelloWorld-Dm/run b/test/674-HelloWorld-Dm/run
new file mode 100644
index 0000000000..199ffc31e1
--- /dev/null
+++ b/test/674-HelloWorld-Dm/run
@@ -0,0 +1,17 @@
+#!/bin/bash
+#
+# Copyright (C) 2018 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+exec ${RUN} --dm "${@}"
diff --git a/test/674-HelloWorld-Dm/src/Main.java b/test/674-HelloWorld-Dm/src/Main.java
new file mode 100644
index 0000000000..1ef6289559
--- /dev/null
+++ b/test/674-HelloWorld-Dm/src/Main.java
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class Main {
+ public static void main(String[] args) {
+ System.out.println("Hello, world!");
+ }
+}
diff --git a/test/674-hotness-compiled/expected.txt b/test/674-hotness-compiled/expected.txt
new file mode 100644
index 0000000000..6a5618ebc6
--- /dev/null
+++ b/test/674-hotness-compiled/expected.txt
@@ -0,0 +1 @@
+JNI_OnLoad called
diff --git a/test/674-hotness-compiled/info.txt b/test/674-hotness-compiled/info.txt
new file mode 100644
index 0000000000..e2cf59a093
--- /dev/null
+++ b/test/674-hotness-compiled/info.txt
@@ -0,0 +1 @@
+Test for the --count-hotness-in-compiled-code compiler option.
diff --git a/test/674-hotness-compiled/run b/test/674-hotness-compiled/run
new file mode 100755
index 0000000000..85e8e3b13f
--- /dev/null
+++ b/test/674-hotness-compiled/run
@@ -0,0 +1,17 @@
+#!/bin/bash
+#
+# Copyright (C) 2018 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+${RUN} "$@" -Xcompiler-option --count-hotness-in-compiled-code
diff --git a/test/674-hotness-compiled/src/Main.java b/test/674-hotness-compiled/src/Main.java
new file mode 100644
index 0000000000..76ec92777f
--- /dev/null
+++ b/test/674-hotness-compiled/src/Main.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class Main {
+ public static void $noinline$hotnessCount() {
+ }
+
+ public static void $noinline$hotnessCountWithLoop() {
+ for (int i = 0; i < 100; i++) {
+ $noinline$hotnessCount();
+ }
+ }
+
+ public static void main(String[] args) {
+ System.loadLibrary(args[0]);
+ if (!isAotCompiled(Main.class, "main")) {
+ return;
+ }
+ $noinline$hotnessCount();
+ int counter = getHotnessCounter(Main.class, "$noinline$hotnessCount");
+ if (counter == 0) {
+ throw new Error("Expected hotness counter to be updated");
+ }
+
+ $noinline$hotnessCountWithLoop();
+ if (getHotnessCounter(Main.class, "$noinline$hotnessCountWithLoop") <= counter) {
+ throw new Error("Expected hotness counter of a loop to be greater than without loop");
+ }
+ }
+
+ public static native int getHotnessCounter(Class<?> cls, String methodName);
+ public static native boolean isAotCompiled(Class<?> cls, String methodName);
+}
diff --git a/test/Android.bp b/test/Android.bp
index 2985077cc4..72e8eee95a 100644
--- a/test/Android.bp
+++ b/test/Android.bp
@@ -373,6 +373,7 @@ cc_defaults {
"149-suspend-all-stress/suspend_all.cc",
"154-gc-loop/heap_interface.cc",
"167-visit-locks/visit_locks.cc",
+ "169-threadgroup-jni/jni_daemon_thread.cc",
"203-multi-checkpoint/multi_checkpoint.cc",
"305-other-fault-handler/fault_handler.cc",
"454-get-vreg/get_vreg_jni.cc",
diff --git a/test/common/runtime_state.cc b/test/common/runtime_state.cc
index c2408b0d2f..298a2f0033 100644
--- a/test/common/runtime_state.cc
+++ b/test/common/runtime_state.cc
@@ -251,13 +251,6 @@ extern "C" JNIEXPORT int JNICALL Java_Main_getHotnessCounter(JNIEnv* env,
jclass,
jclass cls,
jstring method_name) {
- jit::Jit* jit = Runtime::Current()->GetJit();
- if (jit == nullptr) {
- // The hotness counter is valid only under JIT.
- // If we don't JIT return 0 to match test expectations.
- return 0;
- }
-
ArtMethod* method = nullptr;
{
ScopedObjectAccess soa(Thread::Current());
@@ -297,4 +290,25 @@ extern "C" JNIEXPORT jboolean JNICALL Java_Main_isClassMoveable(JNIEnv*,
return runtime->GetHeap()->IsMovableObject(klass);
}
+extern "C" JNIEXPORT void JNICALL Java_Main_waitForCompilation(JNIEnv*, jclass) {
+ jit::Jit* jit = Runtime::Current()->GetJit();
+ if (jit != nullptr) {
+ jit->WaitForCompilationToFinish(Thread::Current());
+ }
+}
+
+extern "C" JNIEXPORT void JNICALL Java_Main_stopJit(JNIEnv*, jclass) {
+ jit::Jit* jit = Runtime::Current()->GetJit();
+ if (jit != nullptr) {
+ jit->Stop();
+ }
+}
+
+extern "C" JNIEXPORT void JNICALL Java_Main_startJit(JNIEnv*, jclass) {
+ jit::Jit* jit = Runtime::Current()->GetJit();
+ if (jit != nullptr) {
+ jit->Start();
+ }
+}
+
} // namespace art
diff --git a/test/etc/run-test-jar b/test/etc/run-test-jar
index 5e40b86aa0..ea2d464d24 100755
--- a/test/etc/run-test-jar
+++ b/test/etc/run-test-jar
@@ -64,6 +64,7 @@ ARGS=""
EXTERNAL_LOG_TAGS="n" # if y respect externally set ANDROID_LOG_TAGS.
DRY_RUN="n" # if y prepare to run the test but don't run it.
TEST_VDEX="n"
+TEST_DM="n"
TEST_IS_NDEBUG="n"
APP_IMAGE="y"
JVMTI_STRESS="n"
@@ -346,6 +347,9 @@ while true; do
elif [ "x$1" = "x--vdex" ]; then
TEST_VDEX="y"
shift
+ elif [ "x$1" = "x--dm" ]; then
+ TEST_DM="y"
+ shift
elif [ "x$1" = "x--vdex-filter" ]; then
shift
option="$1"
@@ -436,7 +440,13 @@ if [ "$DEBUGGER" = "y" ]; then
msg " adb forward tcp:$PORT tcp:$PORT"
fi
msg " jdb -attach localhost:$PORT"
- DEBUGGER_OPTS="-agentlib:jdwp=transport=dt_socket,address=$PORT,server=y,suspend=y"
+ if [ "$USE_JVM" = "n" ]; then
+ # TODO We should switch over to using the jvmti agent by default.
+ # Need to tell the runtime to enable the internal jdwp implementation.
+ DEBUGGER_OPTS="-XjdwpOptions:transport=dt_socket,address=$PORT,server=y,suspend=y -XjdwpProvider:internal"
+ else
+ DEBUGGER_OPTS="-agentlib:jdwp=transport=dt_socket,address=$PORT,server=y,suspend=y"
+ fi
elif [ "$DEBUGGER" = "agent" ]; then
PORT=12345
# TODO Support ddms connection and support target.
@@ -672,6 +682,7 @@ fi
profman_cmdline="true"
dex2oat_cmdline="true"
vdex_cmdline="true"
+dm_cmdline="true"
mkdir_locations="${mkdir_locations} ${DEX_LOCATION}/dalvik-cache/$ISA"
strip_cmdline="true"
sync_cmdline="true"
@@ -735,6 +746,10 @@ if [ "$PREBUILD" = "y" ]; then
vdex_cmdline="${dex2oat_cmdline} ${VDEX_FILTER} --input-vdex=$DEX_LOCATION/oat/$ISA/$TEST_NAME.vdex --output-vdex=$DEX_LOCATION/oat/$ISA/$TEST_NAME.vdex"
elif [ "$TEST_VDEX" = "y" ]; then
vdex_cmdline="${dex2oat_cmdline} ${VDEX_FILTER} --input-vdex=$DEX_LOCATION/oat/$ISA/$TEST_NAME.vdex"
+ elif [ "$TEST_DM" = "y" ]; then
+ dex2oat_cmdline="${dex2oat_cmdline} --output-vdex=$DEX_LOCATION/oat/$ISA/primary.vdex"
+ dm_cmdline="zip -qj $DEX_LOCATION/oat/$ISA/$TEST_NAME.dm $DEX_LOCATION/oat/$ISA/primary.vdex"
+ vdex_cmdline="${dex2oat_cmdline} --dump-timings --dm-file=$DEX_LOCATION/oat/$ISA/$TEST_NAME.dm"
elif [ "$PROFILE" = "y" ] || [ "$RANDOM_PROFILE" = "y" ]; then
vdex_cmdline="${dex2oat_cmdline} --input-vdex=$DEX_LOCATION/oat/$ISA/$TEST_NAME.vdex --output-vdex=$DEX_LOCATION/oat/$ISA/$TEST_NAME.vdex"
fi
@@ -782,6 +797,7 @@ dalvikvm_cmdline="$INVOKE_WITH $GDB $ANDROID_ROOT/bin/$DALVIKVM \
# Remove whitespace.
dex2oat_cmdline=$(echo $dex2oat_cmdline)
dalvikvm_cmdline=$(echo $dalvikvm_cmdline)
+dm_cmdline=$(echo $dm_cmdline)
vdex_cmdline=$(echo $vdex_cmdline)
profman_cmdline=$(echo $profman_cmdline)
@@ -851,6 +867,7 @@ if [ "$HOST" = "n" ]; then
export PATH=$ANDROID_ROOT/bin:$PATH && \
$profman_cmdline && \
$dex2oat_cmdline && \
+ $dm_cmdline && \
$vdex_cmdline && \
$strip_cmdline && \
$sync_cmdline && \
@@ -927,7 +944,7 @@ else
fi
if [ "$DEV_MODE" = "y" ]; then
- echo "mkdir -p ${mkdir_locations} && $profman_cmdline && $dex2oat_cmdline && $vdex_cmdline && $strip_cmdline && $sync_cmdline && $cmdline"
+ echo "mkdir -p ${mkdir_locations} && $profman_cmdline && $dex2oat_cmdline && $dm_cmdline && $vdex_cmdline && $strip_cmdline && $sync_cmdline && $cmdline"
fi
cd $ANDROID_BUILD_TOP
@@ -943,6 +960,7 @@ else
mkdir -p ${mkdir_locations} || exit 1
$profman_cmdline || { echo "Profman failed." >&2 ; exit 2; }
$dex2oat_cmdline || { echo "Dex2oat failed." >&2 ; exit 2; }
+ $dm_cmdline || { echo "Dex2oat failed." >&2 ; exit 2; }
$vdex_cmdline || { echo "Dex2oat failed." >&2 ; exit 2; }
$strip_cmdline || { echo "Strip failed." >&2 ; exit 3; }
$sync_cmdline || { echo "Sync failed." >&2 ; exit 4; }
diff --git a/test/knownfailures.json b/test/knownfailures.json
index 3a21753f99..83ac068109 100644
--- a/test/knownfailures.json
+++ b/test/knownfailures.json
@@ -656,6 +656,10 @@
"tests": "661-oat-writer-layout",
"variant": "interp-ac | interpreter | jit | no-dex2oat | no-prebuild | no-image | trace | redefine-stress | jvmti-stress",
"description": ["Test is designed to only check --compiler-filter=speed"]
+ },
+ {
+ "tests": "674-HelloWorld-Dm",
+ "variant": "target",
+ "description": ["Requires zip, which isn't available on device"]
}
-
]
diff --git a/test/run-test b/test/run-test
index a453f22e29..6bcb9cdabb 100755
--- a/test/run-test
+++ b/test/run-test
@@ -427,6 +427,9 @@ while true; do
elif [ "x$1" = "x--vdex" ]; then
run_args="${run_args} --vdex"
shift
+ elif [ "x$1" = "x--dm" ]; then
+ run_args="${run_args} --dm"
+ shift
elif [ "x$1" = "x--vdex-filter" ]; then
shift
filter=$1