summaryrefslogtreecommitdiff
path: root/test/files
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@epfl.ch>2012-07-16 04:59:30 -0700
committerAdriaan Moors <adriaan.moors@epfl.ch>2012-07-16 04:59:30 -0700
commit24f583a5f0bf7724b96083ed70e3953de685428c (patch)
tree5606c5826ad91f80caa8ad221999764f7585d35c /test/files
parentd6e17dcc9af46d7f92b26063366f6c8dedae58e9 (diff)
parent2ae253bea6401f26dddf0c3b78b4e40aefbd0b18 (diff)
downloadscala-24f583a5f0bf7724b96083ed70e3953de685428c.tar.gz
scala-24f583a5f0bf7724b96083ed70e3953de685428c.tar.bz2
scala-24f583a5f0bf7724b96083ed70e3953de685428c.zip
Merge pull request #913 from gkossakowski/partest-instrumented
Partest: add `instrumented` test category.
Diffstat (limited to 'test/files')
-rw-r--r--test/files/instrumented/InstrumentationTest.check4
-rw-r--r--test/files/instrumented/InstrumentationTest.scala14
-rw-r--r--test/files/instrumented/README15
3 files changed, 33 insertions, 0 deletions
diff --git a/test/files/instrumented/InstrumentationTest.check b/test/files/instrumented/InstrumentationTest.check
new file mode 100644
index 0000000000..3652df270a
--- /dev/null
+++ b/test/files/instrumented/InstrumentationTest.check
@@ -0,0 +1,4 @@
+true
+Method call statistics:
+ 1 scala/Predef$.println(Ljava/lang/Object;)V
+ 1 scala/runtime/BoxesRunTime.boxToBoolean(Z)Ljava/lang/Boolean;
diff --git a/test/files/instrumented/InstrumentationTest.scala b/test/files/instrumented/InstrumentationTest.scala
new file mode 100644
index 0000000000..ec5314c624
--- /dev/null
+++ b/test/files/instrumented/InstrumentationTest.scala
@@ -0,0 +1,14 @@
+import scala.tools.partest.instrumented.Instrumentation._
+
+/** Tests if instrumentation itself works correctly */
+object Test {
+ def main(args: Array[String]) {
+ // force predef initialization before profiling
+ Predef
+ startProfiling()
+ // should box the boolean
+ println(true)
+ stopProfiling()
+ printStatistics()
+ }
+}
diff --git a/test/files/instrumented/README b/test/files/instrumented/README
new file mode 100644
index 0000000000..32d0ef2da5
--- /dev/null
+++ b/test/files/instrumented/README
@@ -0,0 +1,15 @@
+Tests in `instrumented` directory are executed the same way as in `run` but
+they have additional byte-code instrumentation performed for profiling. You
+should put your tests in `instrumented` directory if you are interested in
+method call counts. Examples include tests for specialization (you want to
+count boxing and unboxing method calls) or high-level tests for optimizer
+where you are interested if methods are successfuly inlined (so they should
+not be called at runtime) or closures are eliminated (so no constructors
+of closures are called).
+
+Check `scala.tools.partest.instrumented.Instrumentation` to learn how to
+use the instrumentation infrastructure.
+
+The instrumentation itself is achieved by attaching a Java agent to the forked
+VM process that injects calls to profiler. Check
+`scala.tools.partest.instrumented.Instrumentation`.