Merge "Fix test in case we run the ART_TEST_TRACE tests."
diff --git a/test/545-tracing-and-jit/src/Main.java b/test/545-tracing-and-jit/src/Main.java
index d3c79ae..a2d51d5 100644
--- a/test/545-tracing-and-jit/src/Main.java
+++ b/test/545-tracing-and-jit/src/Main.java
@@ -84,6 +84,10 @@
}
} else {
if (invocationCount == 0) {
+ // When running the trace in trace mode, there is already a trace running.
+ if (VMDebug.getMethodTracingMode() != 0) {
+ VMDebug.stopMethodTracing();
+ }
VMDebug.startMethodTracing(file.getPath(), 0, 0, false, 0);
}
fillJit();
@@ -219,12 +223,14 @@
private static class VMDebug {
private static final Method startMethodTracingMethod;
private static final Method stopMethodTracingMethod;
+ private static final Method getMethodTracingModeMethod;
static {
try {
Class c = Class.forName("dalvik.system.VMDebug");
startMethodTracingMethod = c.getDeclaredMethod("startMethodTracing", String.class,
Integer.TYPE, Integer.TYPE, Boolean.TYPE, Integer.TYPE);
stopMethodTracingMethod = c.getDeclaredMethod("stopMethodTracing");
+ getMethodTracingModeMethod = c.getDeclaredMethod("getMethodTracingMode");
} catch (Exception e) {
throw new RuntimeException(e);
}
@@ -238,5 +244,8 @@
public static void stopMethodTracing() throws Exception {
stopMethodTracingMethod.invoke(null);
}
+ public static int getMethodTracingMode() throws Exception {
+ return (int) getMethodTracingModeMethod.invoke(null);
+ }
}
}