Mercurial > hg > truffle
comparison truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/ChildrenNodesTest.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 |
---|---|
26 import com.oracle.truffle.api.Truffle; | 26 import com.oracle.truffle.api.Truffle; |
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.RootNode; | 30 import com.oracle.truffle.api.nodes.RootNode; |
31 import com.oracle.truffle.api.test.utilities.InstrumentationTestMode; | |
32 | |
31 import java.util.Iterator; | 33 import java.util.Iterator; |
34 | |
35 import org.junit.After; | |
32 import org.junit.Assert; | 36 import org.junit.Assert; |
37 import org.junit.Before; | |
33 import org.junit.Test; | 38 import org.junit.Test; |
34 | 39 |
35 /** | 40 /** |
36 * <h3>Creating an Array of Children Nodes</h3> | 41 * <h3>Creating an Array of Children Nodes</h3> |
37 * | 42 * |
48 * The next part of the Truffle API introduction is at | 53 * The next part of the Truffle API introduction is at |
49 * {@link com.oracle.truffle.api.test.FinalFieldTest}. | 54 * {@link com.oracle.truffle.api.test.FinalFieldTest}. |
50 * </p> | 55 * </p> |
51 */ | 56 */ |
52 public class ChildrenNodesTest { | 57 public class ChildrenNodesTest { |
58 | |
59 @Before | |
60 public void before() throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException { | |
61 InstrumentationTestMode.set(true); | |
62 } | |
63 | |
64 @After | |
65 public void after() throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException { | |
66 InstrumentationTestMode.set(false); | |
67 } | |
53 | 68 |
54 @Test | 69 @Test |
55 public void test() { | 70 public void test() { |
56 TruffleRuntime runtime = Truffle.getRuntime(); | 71 TruffleRuntime runtime = Truffle.getRuntime(); |
57 TestChildNode firstChild = new TestChildNode(); | 72 TestChildNode firstChild = new TestChildNode(); |