InstrumentationContext.st
changeset 2979 e4ccf860e34a
parent 2959 9c8cf9e9915f
child 2980 0202d500e04d
--- a/InstrumentationContext.st	Wed Nov 07 23:33:51 2012 +0100
+++ b/InstrumentationContext.st	Thu Nov 08 00:22:30 2012 +0100
@@ -47,6 +47,10 @@
         - it blocks measurements from other processes 
           (so code coverage is only measured when executed during a test run, not if
            executed by other processes)
+
+    the main entries are run: and runForCoverage:
+    the code must have been recompiled with instrumentation before
+    (see InstrumentingCompiler - class protocol)
 "
 ! !
 
@@ -141,6 +145,25 @@
     "
 
     "Created: / 08-08-2011 / 15:47:10 / cg"
+!
+
+runForCoverage:aBlock
+    "run aBlock with instrumentation enabled, but only for coverage (i.e. not counting)"
+
+    self new runForCoverage:aBlock.
+
+    "
+     Smalltalk loadPackage:'exept:regression'.
+     BTree withAllPrivateClasses 
+        do:[:cls | cls recompileUsingCompilerClass:InstrumentingCompiler].
+     InstrumentationContext
+        run:[ RegressionTests::BinaryTreeTester suite run ].
+     (Tools::NewSystemBrowser open)
+        switchToClass:BTree;
+        showCoverageInformation value:true
+    "
+
+    "Created: / 08-08-2011 / 15:47:10 / cg"
 ! !
 
 !InstrumentationContext class methodsFor:'utilities'!
@@ -290,14 +313,21 @@
     ].
 
     "Modified: / 17-08-2011 / 11:53:54 / cg"
+!
+
+runForCoverage:aBlock
+    "run aBlock with instrumentation enabled< but onlz for coverage (i.e. not counting)"
+
+    coverageOnly := false.
+    self run:aBlock
 ! !
 
 !InstrumentationContext class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libcomp/InstrumentationContext.st,v 1.11 2012-10-26 10:53:40 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/InstrumentationContext.st,v 1.12 2012-11-07 23:22:30 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libcomp/InstrumentationContext.st,v 1.11 2012-10-26 10:53:40 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/InstrumentationContext.st,v 1.12 2012-11-07 23:22:30 cg Exp $'
 ! !