Mercurial > hg > truffle
comparison truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/ChildNodeTest.java @ 22241:14e6dfb1ef05
Truffle/Testing: massive rework of tests to accommodate recent instrumentation change with respect to "applyInstrumentation"
- Caused by lack of a "vm" known to the Accessor during most testing, making the Instrumenter unavailable, which is now required to create a CallTarget
- Modified the Instrumenter/Accessor with a static field that can be reflectively "poked" with a vm value for testing
- Create a pair of methods to globally enable/disable testing mode to modify that static field and restore it when tests complete.
author | Michael Van De Vanter <michael.van.de.vanter@oracle.com> |
---|---|
date | Tue, 22 Sep 2015 20:31:19 -0700 |
parents | dc83cc1f94f2 |
children | 0d36601f233e |
comparison
equal
deleted
inserted
replaced
22240:f78c72e2e0b6 | 22241:14e6dfb1ef05 |
---|---|
27 import com.oracle.truffle.api.TruffleRuntime; | 27 import com.oracle.truffle.api.TruffleRuntime; |
28 import com.oracle.truffle.api.frame.VirtualFrame; | 28 import com.oracle.truffle.api.frame.VirtualFrame; |
29 import com.oracle.truffle.api.nodes.Node; | 29 import com.oracle.truffle.api.nodes.Node; |
30 import com.oracle.truffle.api.nodes.Node.Child; | 30 import com.oracle.truffle.api.nodes.Node.Child; |
31 import com.oracle.truffle.api.nodes.RootNode; | 31 import com.oracle.truffle.api.nodes.RootNode; |
32 import com.oracle.truffle.api.test.utilities.InstrumentationTestMode; | |
33 | |
32 import java.util.Iterator; | 34 import java.util.Iterator; |
35 | |
36 import org.junit.After; | |
33 import org.junit.Assert; | 37 import org.junit.Assert; |
38 import org.junit.Before; | |
34 import org.junit.Test; | 39 import org.junit.Test; |
35 | 40 |
36 /** | 41 /** |
37 * <h3>Creating a Child Node</h3> | 42 * <h3>Creating a Child Node</h3> |
38 * | 43 * |
52 * The next part of the Truffle API introduction is at | 57 * The next part of the Truffle API introduction is at |
53 * {@link com.oracle.truffle.api.test.ChildrenNodesTest}. | 58 * {@link com.oracle.truffle.api.test.ChildrenNodesTest}. |
54 * </p> | 59 * </p> |
55 */ | 60 */ |
56 public class ChildNodeTest { | 61 public class ChildNodeTest { |
62 | |
63 @Before | |
64 public void before() throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException { | |
65 InstrumentationTestMode.set(true); | |
66 } | |
67 | |
68 @After | |
69 public void after() throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException { | |
70 InstrumentationTestMode.set(false); | |
71 } | |
57 | 72 |
58 @Test | 73 @Test |
59 public void test() { | 74 public void test() { |
60 TruffleRuntime runtime = Truffle.getRuntime(); | 75 TruffleRuntime runtime = Truffle.getRuntime(); |
61 TestChildNode leftChild = new TestChildNode(); | 76 TestChildNode leftChild = new TestChildNode(); |