Signed-off-by: Vegard Nossum <vegard.nos...@gmail.com>
---
 Makefile                                     |    1 +
 regression/jvm/InvokestaticPatchingTest.java |   34 ++++++++++++++++++++++++++
 regression/run-suite.sh                      |    1 +
 3 files changed, 36 insertions(+), 0 deletions(-)
 create mode 100644 regression/jvm/InvokestaticPatchingTest.java

diff --git a/Makefile b/Makefile
index 43d907c..cced880 100644
--- a/Makefile
+++ b/Makefile
@@ -210,6 +210,7 @@ REGRESSION_TEST_SUITE_CLASSES = \
        regression/jvm/BranchTest.class \
        regression/jvm/GetstaticPatchingTest.class \
        regression/jvm/PutstaticPatchingTest.class \
+       regression/jvm/InvokestaticPatchingTest.class \
        regression/jvm/ObjectArrayTest.class \
        regression/jvm/ExitStatusIsOneTest.class \
        regression/jvm/ExitStatusIsZeroTest.class \
diff --git a/regression/jvm/InvokestaticPatchingTest.java 
b/regression/jvm/InvokestaticPatchingTest.java
new file mode 100644
index 0000000..410c091
--- /dev/null
+++ b/regression/jvm/InvokestaticPatchingTest.java
@@ -0,0 +1,34 @@
+package jvm;
+
+public class InvokestaticPatchingTest extends TestCase {
+    static boolean clinit_run = false;
+
+    private static class X {
+        static {
+            clinit_run = true;
+        }
+
+        static void f() {
+        }
+    }
+
+    public static void main(String[] args) {
+        int i = 0;
+
+        /* Should not trap, therefore clinit_run remains false */
+        assertFalse(clinit_run);
+        X x = null;
+        assertFalse(clinit_run);
+
+        /* Should trap, therefore clinit_run becomes true */
+        X.f();
+        assertTrue(clinit_run);
+
+        clinit_run = false;
+        /* Should not trap, therefore clinit_run remains false */
+        X.f();
+        assertFalse(clinit_run);
+
+        exit();
+    }
+}
diff --git a/regression/run-suite.sh b/regression/run-suite.sh
index 3ec6fff..aa83d3d 100755
--- a/regression/run-suite.sh
+++ b/regression/run-suite.sh
@@ -59,6 +59,7 @@ if [ -z "$CLASS_LIST" ]; then
     run_java jvm.ExitStatusIsOneTest 1
     run_java jvm.GetstaticPatchingTest 0
     run_java jvm.PutstaticPatchingTest 0
+    run_java jvm.InvokestaticPatchingTest 0
     run_java jvm.LoadConstantsTest 0
     run_java jvm.IntegerArithmeticTest 0
     run_java jvm.LongArithmeticTest 0
-- 
1.6.0.4


------------------------------------------------------------------------------
_______________________________________________
Jatovm-devel mailing list
Jatovm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jatovm-devel

Reply via email to