Fix tests 1953, 1954, 1955 and, 1956 on --jvm
These tests check the behavior of pop-frame and should run
successfully on the RI. Unfortunately in the time since they were
added the RI changed some of its behavior around using PopFrame with
NotifyFramePopped, now crashing when this combination of behaviors is
exercised. Make the test skip these cases when running on RI.
Bug: 154802847
Test: ./test/run-test --host --jvm 1953
Change-Id: Ia375cc9d13ca67a9512aa1b279fbcff1ec2feeec
diff --git a/test/1953-pop-frame/class-loading-expected.patch b/test/1953-pop-frame/class-loading-expected.patch
index 2edef15..1a5eda7 100644
--- a/test/1953-pop-frame/class-loading-expected.patch
+++ b/test/1953-pop-frame/class-loading-expected.patch
@@ -1,4 +1,19 @@
-74a75,94
+36a37,50
+> Test stopped during notifyFramePop without exception on pop of calledFunction
+> Single call with PopFrame on StandardTestObject { cnt: 0 } base-call-count: 0
+> result is StandardTestObject { cnt: 2 } base-call count: 1
+> Test stopped during notifyFramePop without exception on pop of doNothing
+> Single call with PopFrame on StandardTestObject { cnt: 0 } base-call-count: 0
+> result is StandardTestObject { cnt: 1 } base-call count: 1
+> Test stopped during notifyFramePop with exception on pop of calledFunction
+> Single call with PopFrame on ExceptionThrowTestObject { cnt: 0 } base-call-count: 0
+> art.Test1953$ExceptionThrowTestObject$TestError thrown and caught!
+> result is ExceptionThrowTestObject { cnt: 2 } base-call count: 1
+> Test stopped during notifyFramePop with exception on pop of doThrow
+> Single call with PopFrame on ExceptionCatchTestObject { cnt: 0 } base-call-count: 0
+> art.Test1953$ExceptionCatchTestObject$TestError caught in called function.
+> result is ExceptionCatchTestObject { cnt: 1 } base-call count: 1
+60a75,94
> Test stopped during a ClassLoad event.
> Single call with PopFrame on ClassLoadObject { cnt: 0, curClass: 0} base-call-count: 0
> Failed to pop frame due to java.lang.RuntimeException: JVMTI_ERROR_OPAQUE_FRAME
diff --git a/test/1953-pop-frame/expected.txt b/test/1953-pop-frame/expected.txt
index 079768d..dafc6b4 100644
--- a/test/1953-pop-frame/expected.txt
+++ b/test/1953-pop-frame/expected.txt
@@ -34,20 +34,6 @@
Test stopped during Method Exit due to exception thrown in subroutine
Single call with PopFrame on ExceptionOnceObject { cnt: 0, throwInSub: true } base-call-count: 0
result is ExceptionOnceObject { cnt: 2, throwInSub: true } base-call count: 1
-Test stopped during notifyFramePop without exception on pop of calledFunction
-Single call with PopFrame on StandardTestObject { cnt: 0 } base-call-count: 0
-result is StandardTestObject { cnt: 2 } base-call count: 1
-Test stopped during notifyFramePop without exception on pop of doNothing
-Single call with PopFrame on StandardTestObject { cnt: 0 } base-call-count: 0
-result is StandardTestObject { cnt: 1 } base-call count: 1
-Test stopped during notifyFramePop with exception on pop of calledFunction
-Single call with PopFrame on ExceptionThrowTestObject { cnt: 0 } base-call-count: 0
-art.Test1953$ExceptionThrowTestObject$TestError thrown and caught!
-result is ExceptionThrowTestObject { cnt: 2 } base-call count: 1
-Test stopped during notifyFramePop with exception on pop of doThrow
-Single call with PopFrame on ExceptionCatchTestObject { cnt: 0 } base-call-count: 0
-art.Test1953$ExceptionCatchTestObject$TestError caught in called function.
-result is ExceptionCatchTestObject { cnt: 1 } base-call count: 1
Test stopped during ExceptionCatch event of calledFunction (catch in called function, throw in called function)
Single call with PopFrame on ExceptionThrowTestObject { cnt: 0 } base-call-count: 0
art.Test1953$ExceptionThrowTestObject$TestError caught in same function.
diff --git a/test/1953-pop-frame/src/art/Test1953.java b/test/1953-pop-frame/src/art/Test1953.java
index ff41d24..366809e 100644
--- a/test/1953-pop-frame/src/art/Test1953.java
+++ b/test/1953-pop-frame/src/art/Test1953.java
@@ -37,6 +37,7 @@
import static art.SuspendEvents.setupSuspendClassEvent;
public class Test1953 {
+ private static boolean IS_ART = System.getProperty("java.vm.name").equals("Dalvik");
public final boolean canRunClassLoadTests;
public static void doNothing() {}
@@ -801,29 +802,34 @@
(thr) -> setupSuspendMethodEvent(exceptionOnceCalledMethod, /*enter*/ false, thr),
SuspendEvents::clearSuspendMethodEvent);
- System.out.println("Test stopped during notifyFramePop without exception on pop of calledFunction");
- runTestOn(new StandardTestObject(false),
- (thr) -> setupSuspendPopFrameEvent(1, doNothingMethod, thr),
- SuspendEvents::clearSuspendPopFrameEvent);
-
- System.out.println("Test stopped during notifyFramePop without exception on pop of doNothing");
- runTestOn(new StandardTestObject(false),
- (thr) -> setupSuspendPopFrameEvent(0, doNothingMethod, thr),
- SuspendEvents::clearSuspendPopFrameEvent);
-
final Method exceptionThrowCalledMethod =
ExceptionThrowTestObject.class.getDeclaredMethod("calledFunction");
- System.out.println("Test stopped during notifyFramePop with exception on pop of calledFunction");
- runTestOn(new ExceptionThrowTestObject(false),
- (thr) -> setupSuspendPopFrameEvent(0, exceptionThrowCalledMethod, thr),
- SuspendEvents::clearSuspendPopFrameEvent);
-
final Method exceptionCatchThrowMethod =
ExceptionCatchTestObject.class.getDeclaredMethod("doThrow");
- System.out.println("Test stopped during notifyFramePop with exception on pop of doThrow");
- runTestOn(new ExceptionCatchTestObject(),
- (thr) -> setupSuspendPopFrameEvent(0, exceptionCatchThrowMethod, thr),
- SuspendEvents::clearSuspendPopFrameEvent);
+ // Disable more often then we technically need to in order to avoid the need
+ // for a huge number of possible results and allow the test to be easily
+ // used in CTS.
+ if (IS_ART && canRunClassLoadTests && CanRunClassLoadingTests()) {
+ System.out.println("Test stopped during notifyFramePop without exception on pop of calledFunction");
+ runTestOn(new StandardTestObject(false),
+ (thr) -> setupSuspendPopFrameEvent(1, doNothingMethod, thr),
+ SuspendEvents::clearSuspendPopFrameEvent);
+
+ System.out.println("Test stopped during notifyFramePop without exception on pop of doNothing");
+ runTestOn(new StandardTestObject(false),
+ (thr) -> setupSuspendPopFrameEvent(0, doNothingMethod, thr),
+ SuspendEvents::clearSuspendPopFrameEvent);
+
+ System.out.println("Test stopped during notifyFramePop with exception on pop of calledFunction");
+ runTestOn(new ExceptionThrowTestObject(false),
+ (thr) -> setupSuspendPopFrameEvent(0, exceptionThrowCalledMethod, thr),
+ SuspendEvents::clearSuspendPopFrameEvent);
+
+ System.out.println("Test stopped during notifyFramePop with exception on pop of doThrow");
+ runTestOn(new ExceptionCatchTestObject(),
+ (thr) -> setupSuspendPopFrameEvent(0, exceptionCatchThrowMethod, thr),
+ SuspendEvents::clearSuspendPopFrameEvent);
+ }
System.out.println("Test stopped during ExceptionCatch event of calledFunction " +
"(catch in called function, throw in called function)");
diff --git a/test/1954-pop-frame-jit/jvm-expected.patch b/test/1954-pop-frame-jit/jvm-expected.patch
index 718f8ad..6539d56 100644
--- a/test/1954-pop-frame-jit/jvm-expected.patch
+++ b/test/1954-pop-frame-jit/jvm-expected.patch
@@ -1,4 +1,19 @@
-75,94d74
+37,50d36
+< Test stopped during notifyFramePop without exception on pop of calledFunction
+< Single call with PopFrame on StandardTestObject { cnt: 0 } base-call-count: 0
+< result is StandardTestObject { cnt: 2 } base-call count: 1
+< Test stopped during notifyFramePop without exception on pop of doNothing
+< Single call with PopFrame on StandardTestObject { cnt: 0 } base-call-count: 0
+< result is StandardTestObject { cnt: 1 } base-call count: 1
+< Test stopped during notifyFramePop with exception on pop of calledFunction
+< Single call with PopFrame on ExceptionThrowTestObject { cnt: 0 } base-call-count: 0
+< art.Test1953$ExceptionThrowTestObject$TestError thrown and caught!
+< result is ExceptionThrowTestObject { cnt: 2 } base-call count: 1
+< Test stopped during notifyFramePop with exception on pop of doThrow
+< Single call with PopFrame on ExceptionCatchTestObject { cnt: 0 } base-call-count: 0
+< art.Test1953$ExceptionCatchTestObject$TestError caught in called function.
+< result is ExceptionCatchTestObject { cnt: 1 } base-call count: 1
+75,94d60
< Test stopped during a ClassLoad event.
< Single call with PopFrame on ClassLoadObject { cnt: 0, curClass: 0} base-call-count: 0
< Failed to pop frame due to java.lang.RuntimeException: JVMTI_ERROR_OPAQUE_FRAME
diff --git a/test/1955-pop-frame-jit-called/jvm-expected.patch b/test/1955-pop-frame-jit-called/jvm-expected.patch
index 718f8ad..6539d56 100644
--- a/test/1955-pop-frame-jit-called/jvm-expected.patch
+++ b/test/1955-pop-frame-jit-called/jvm-expected.patch
@@ -1,4 +1,19 @@
-75,94d74
+37,50d36
+< Test stopped during notifyFramePop without exception on pop of calledFunction
+< Single call with PopFrame on StandardTestObject { cnt: 0 } base-call-count: 0
+< result is StandardTestObject { cnt: 2 } base-call count: 1
+< Test stopped during notifyFramePop without exception on pop of doNothing
+< Single call with PopFrame on StandardTestObject { cnt: 0 } base-call-count: 0
+< result is StandardTestObject { cnt: 1 } base-call count: 1
+< Test stopped during notifyFramePop with exception on pop of calledFunction
+< Single call with PopFrame on ExceptionThrowTestObject { cnt: 0 } base-call-count: 0
+< art.Test1953$ExceptionThrowTestObject$TestError thrown and caught!
+< result is ExceptionThrowTestObject { cnt: 2 } base-call count: 1
+< Test stopped during notifyFramePop with exception on pop of doThrow
+< Single call with PopFrame on ExceptionCatchTestObject { cnt: 0 } base-call-count: 0
+< art.Test1953$ExceptionCatchTestObject$TestError caught in called function.
+< result is ExceptionCatchTestObject { cnt: 1 } base-call count: 1
+75,94d60
< Test stopped during a ClassLoad event.
< Single call with PopFrame on ClassLoadObject { cnt: 0, curClass: 0} base-call-count: 0
< Failed to pop frame due to java.lang.RuntimeException: JVMTI_ERROR_OPAQUE_FRAME
diff --git a/test/1956-pop-frame-jit-calling/jvm-expected.patch b/test/1956-pop-frame-jit-calling/jvm-expected.patch
index 718f8ad..6539d56 100644
--- a/test/1956-pop-frame-jit-calling/jvm-expected.patch
+++ b/test/1956-pop-frame-jit-calling/jvm-expected.patch
@@ -1,4 +1,19 @@
-75,94d74
+37,50d36
+< Test stopped during notifyFramePop without exception on pop of calledFunction
+< Single call with PopFrame on StandardTestObject { cnt: 0 } base-call-count: 0
+< result is StandardTestObject { cnt: 2 } base-call count: 1
+< Test stopped during notifyFramePop without exception on pop of doNothing
+< Single call with PopFrame on StandardTestObject { cnt: 0 } base-call-count: 0
+< result is StandardTestObject { cnt: 1 } base-call count: 1
+< Test stopped during notifyFramePop with exception on pop of calledFunction
+< Single call with PopFrame on ExceptionThrowTestObject { cnt: 0 } base-call-count: 0
+< art.Test1953$ExceptionThrowTestObject$TestError thrown and caught!
+< result is ExceptionThrowTestObject { cnt: 2 } base-call count: 1
+< Test stopped during notifyFramePop with exception on pop of doThrow
+< Single call with PopFrame on ExceptionCatchTestObject { cnt: 0 } base-call-count: 0
+< art.Test1953$ExceptionCatchTestObject$TestError caught in called function.
+< result is ExceptionCatchTestObject { cnt: 1 } base-call count: 1
+75,94d60
< Test stopped during a ClassLoad event.
< Single call with PopFrame on ClassLoadObject { cnt: 0, curClass: 0} base-call-count: 0
< Failed to pop frame due to java.lang.RuntimeException: JVMTI_ERROR_OPAQUE_FRAME
diff --git a/test/knownfailures.json b/test/knownfailures.json
index 722f866..09f5cdc 100644
--- a/test/knownfailures.json
+++ b/test/knownfailures.json
@@ -1386,10 +1386,6 @@
"960-default-smali",
"966-default-conflict",
"990-field-trace",
- "1953-pop-frame",
- "1954-pop-frame-jit",
- "1955-pop-frame-jit-called",
- "1956-pop-frame-jit-calling",
"2009-structural-local-ref",
"2011-stack-walk-concurrent-instrument",
"2012-structural-redefinition-failures-jni-id",