diff truffle/com.oracle.truffle.tools.test/src/com/oracle/truffle/tools/test/CoverageTrackerTest.java @ 22214:3aad794eec0e

Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework - introduce the Instrumenter class, held by the TruffleVM to support instrumentation services - reimplement Probe-realated services (formerly statics in Probe.java) to be provided by the Instrumenter- add new Accessors - change the TruffleVM startup sequence - change the APIs of the Debugger and many other classes
author Michael Van De Vanter <michael.van.de.vanter@oracle.com>
date Mon, 14 Sep 2015 22:59:51 -0700
parents 9c8c0937da41
children 1c0f490984d5
line wrap: on
line diff
--- a/truffle/com.oracle.truffle.tools.test/src/com/oracle/truffle/tools/test/CoverageTrackerTest.java	Mon Sep 07 17:54:35 2015 +0200
+++ b/truffle/com.oracle.truffle.tools.test/src/com/oracle/truffle/tools/test/CoverageTrackerTest.java	Mon Sep 14 22:59:51 2015 -0700
@@ -36,10 +36,11 @@
 public class CoverageTrackerTest {
 
     @Test
-    public void testNoExecution() {
+    public void testNoExecution() throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
+        final Instrumenter instrumenter = TestNodes.createInstrumenter();
         final CoverageTracker tool = new CoverageTracker();
         assertEquals(tool.getCounts().entrySet().size(), 0);
-        tool.install();
+        tool.install(instrumenter);
         assertEquals(tool.getCounts().entrySet().size(), 0);
         tool.setEnabled(false);
         assertEquals(tool.getCounts().entrySet().size(), 0);
@@ -52,37 +53,40 @@
     }
 
     @Test
-    public void testToolCreatedTooLate() {
-        final RootNode expr13rootNode = createExpr13TestRootNode();
+    public void testToolCreatedTooLate() throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
+        final Instrumenter instrumenter = TestNodes.createInstrumenter();
+        final RootNode expr13rootNode = TestNodes.createExpr13TestRootNode(instrumenter);
         final CoverageTracker tool = new CoverageTracker();
-        tool.install();
+        tool.install(instrumenter);
         assertEquals(13, expr13rootNode.execute(null));
         assertTrue(tool.getCounts().isEmpty());
         tool.dispose();
     }
 
     @Test
-    public void testToolInstalledcTooLate() {
+    public void testToolInstalledcTooLate() throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
+        final Instrumenter instrumenter = TestNodes.createInstrumenter();
         final CoverageTracker tool = new CoverageTracker();
-        final RootNode expr13rootNode = createExpr13TestRootNode();
-        tool.install();
+        final RootNode expr13rootNode = createExpr13TestRootNode(instrumenter);
+        tool.install(instrumenter);
         assertEquals(13, expr13rootNode.execute(null));
         assertTrue(tool.getCounts().isEmpty());
         tool.dispose();
     }
 
     @Test
-    public void testCountingCoverage() {
+    public void testCountingCoverage() throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
+        final Instrumenter instrumenter = TestNodes.createInstrumenter();
         final CoverageTracker tool = new CoverageTracker();
-        tool.install();
-        final RootNode expr13rootNode = createExpr13TestRootNode();
+        tool.install(instrumenter);
+        final RootNode expr13rootNode = createExpr13TestRootNode(instrumenter);
 
         // Not probed yet.
         assertEquals(13, expr13rootNode.execute(null));
         assertTrue(tool.getCounts().isEmpty());
 
         final Node addNode = expr13rootNode.getChildren().iterator().next();
-        final Probe probe = addNode.probe();
+        final Probe probe = instrumenter.probe(addNode);
 
         // Probed but not tagged yet.
         assertEquals(13, expr13rootNode.execute(null));