comparison truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/InterfaceChildFieldTest.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
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.NodeInterface; 30 import com.oracle.truffle.api.nodes.NodeInterface;
31 import com.oracle.truffle.api.nodes.NodeUtil; 31 import com.oracle.truffle.api.nodes.NodeUtil;
32 import com.oracle.truffle.api.nodes.RootNode; 32 import com.oracle.truffle.api.nodes.RootNode;
33 import com.oracle.truffle.api.test.utilities.InstrumentationTestMode;
34
33 import java.util.Iterator; 35 import java.util.Iterator;
36
37 import org.junit.After;
34 import org.junit.Assert; 38 import org.junit.Assert;
39 import org.junit.Before;
35 import org.junit.Test; 40 import org.junit.Test;
36 41
37 /** 42 /**
38 * Test child fields declared with interface types instead of {@link Node} subclasses. 43 * Test child fields declared with interface types instead of {@link Node} subclasses.
39 */ 44 */
40 public class InterfaceChildFieldTest { 45 public class InterfaceChildFieldTest {
46
47 @Before
48 public void before() throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
49 InstrumentationTestMode.set(true);
50 }
51
52 @After
53 public void after() throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
54 InstrumentationTestMode.set(false);
55 }
41 56
42 @Test 57 @Test
43 public void testChild() { 58 public void testChild() {
44 TruffleRuntime runtime = Truffle.getRuntime(); 59 TruffleRuntime runtime = Truffle.getRuntime();
45 TestChildInterface leftChild = new TestLeafNode(); 60 TestChildInterface leftChild = new TestLeafNode();