comparison truffle/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/NodeChildNoNameTest.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.dsl.Specialization; 27 import com.oracle.truffle.api.dsl.Specialization;
28 import com.oracle.truffle.api.dsl.test.NodeChildNoNameTestFactory.OneArgNoNameFactory; 28 import com.oracle.truffle.api.dsl.test.NodeChildNoNameTestFactory.OneArgNoNameFactory;
29 import com.oracle.truffle.api.dsl.test.NodeChildNoNameTestFactory.ThreeArgsNoNameFactory; 29 import com.oracle.truffle.api.dsl.test.NodeChildNoNameTestFactory.ThreeArgsNoNameFactory;
30 import com.oracle.truffle.api.dsl.test.NodeChildNoNameTestFactory.TwoArgsNoNameFactory; 30 import com.oracle.truffle.api.dsl.test.NodeChildNoNameTestFactory.TwoArgsNoNameFactory;
31 import com.oracle.truffle.api.dsl.test.TypeSystemTest.ValueNode; 31 import com.oracle.truffle.api.dsl.test.TypeSystemTest.ValueNode;
32 import com.oracle.truffle.api.dsl.test.utilities.InstrumentationTestMode;
32 import com.oracle.truffle.api.frame.VirtualFrame; 33 import com.oracle.truffle.api.frame.VirtualFrame;
34
33 import org.junit.Assert; 35 import org.junit.Assert;
36 import org.junit.Before;
34 import org.junit.Test; 37 import org.junit.Test;
35 38
36 public class NodeChildNoNameTest { 39 public class NodeChildNoNameTest {
40
41 @Before
42 public void before() throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
43 InstrumentationTestMode.set(true);
44 }
45
46 @Before
47 public void after() throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
48 InstrumentationTestMode.set(false);
49 }
37 50
38 @Test 51 @Test
39 public void testOneArg() { 52 public void testOneArg() {
40 ValueNode node = new ConstantNode(); 53 ValueNode node = new ConstantNode();
41 OneArgNoName arg = OneArgNoNameFactory.create(node); 54 OneArgNoName arg = OneArgNoNameFactory.create(node);