summaryrefslogtreecommitdiff
path: root/build.xml
diff options
context:
space:
mode:
authorGrzegorz Kossakowski <grzegorz.kossakowski@gmail.com>2012-07-16 11:22:40 +0200
committerGrzegorz Kossakowski <grzegorz.kossakowski@gmail.com>2012-07-16 11:26:21 +0200
commit2ae253bea6401f26dddf0c3b78b4e40aefbd0b18 (patch)
treeb4b9cfc2ddf7e5e8a22ab638c0ee4b39c8327ed3 /build.xml
parent39dfdb7cca23d109d07edc5884f8fb871cd0c582 (diff)
downloadscala-2ae253bea6401f26dddf0c3b78b4e40aefbd0b18.tar.gz
scala-2ae253bea6401f26dddf0c3b78b4e40aefbd0b18.tar.bz2
scala-2ae253bea6401f26dddf0c3b78b4e40aefbd0b18.zip
Partest: add `instrumented` test category.
--- (taken from README) 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.javaagent.ProfilingAgent` for details. --- A few notes on low-level details of this change: * Partest now depends on asm library for byte-code instrumentation (`build.xml`) * Build additional jar called `scala-partest-javaagent.jar` that is used with `-javaagent:` option. (`build.xml`) * Set `-javaagent:` option for all tests in `instrumented/` directory. (`RunnerManger.scala`) * Introduce a new category of tests called `instrumented`. * Add one instrumented test to demonstrate usage and test new infrastructure itself. (`InstrumentationTest.scala`) Review by @phaller.
Diffstat (limited to 'build.xml')
-rw-r--r--build.xml19
1 files changed, 16 insertions, 3 deletions
diff --git a/build.xml b/build.xml
index 0e0bda934a..8fa1b9cd76 100644
--- a/build.xml
+++ b/build.xml
@@ -1337,7 +1337,7 @@ QUICK BUILD (QUICK)
<stopwatch name="quick.scalap.timer" action="total"/>
</target>
- <target name="quick.pre-partest" depends="quick.scalap">
+ <target name="quick.pre-partest" depends="quick.scalap, asm.done">
<uptodate property="quick.partest.available" targetfile="${build-quick.dir}/partest.complete">
<srcfiles dir="${src.dir}/partest"/>
</uptodate>
@@ -1356,6 +1356,7 @@ QUICK BUILD (QUICK)
<pathelement location="${build-quick.dir}/classes/compiler"/>
<pathelement location="${build-quick.dir}/classes/scalap"/>
<pathelement location="${build-quick.dir}/classes/partest"/>
+ <path refid="asm.classpath"/>
</classpath>
<include name="**/*.java"/>
<compilerarg line="${javac.args}"/>
@@ -1575,7 +1576,14 @@ PACKED QUICK BUILD (PACK)
<target name="pack.partest" depends="pack.pre-partest" unless="pack.partest.available">
<mkdir dir="${build-pack.dir}/lib"/>
<jar destfile="${build-pack.dir}/lib/scala-partest.jar">
- <fileset dir="${build-quick.dir}/classes/partest"/>
+ <fileset dir="${build-quick.dir}/classes/partest">
+ <exclude name="scala/tools/partest/javaagent/**"/>
+ </fileset>
+ </jar>
+ <jar destfile="${build-pack.dir}/lib/scala-partest-javaagent.jar" manifest="${src.dir}/partest/scala/tools/partest/javaagent/MANIFEST.MF">
+ <fileset dir="${build-quick.dir}/classes/partest">
+ <include name="scala/tools/partest/javaagent/**"/>
+ </fileset>
</jar>
</target>
@@ -1974,7 +1982,7 @@ BOOTSTRAPPING BUILD (STRAP)
<stopwatch name="strap.scalap.timer" action="total"/>
</target>
- <target name="strap.pre-partest" depends="strap.scalap">
+ <target name="strap.pre-partest" depends="strap.scalap, asm.done">
<uptodate property="strap.partest.available" targetfile="${build-strap.dir}/partest.complete">
<srcfiles dir="${src.dir}/partest"/>
</uptodate>
@@ -1993,6 +2001,7 @@ BOOTSTRAPPING BUILD (STRAP)
<pathelement location="${build-strap.dir}/classes/compiler"/>
<pathelement location="${build-strap.dir}/classes/scalap"/>
<pathelement location="${build-strap.dir}/classes/partest"/>
+ <path refid="asm.classpath"/>
</classpath>
<include name="**/*.java"/>
<compilerarg line="${javac.args}"/>
@@ -2012,6 +2021,7 @@ BOOTSTRAPPING BUILD (STRAP)
<pathelement location="${build-strap.dir}/classes/partest"/>
<pathelement location="${ant.jar}"/>
<path refid="forkjoin.classpath"/>
+ <path refid="asm.classpath"/>
<pathelement location="${scalacheck.jar}"/>
</compilationpath>
</scalacfork>
@@ -2393,6 +2403,9 @@ BOOTRAPING TEST AND TEST SUITE
<specializedtests dir="${partest.dir}/${partest.srcdir}/specialized">
<include name="*.scala"/>
</specializedtests>
+ <instrumentedtests dir="${partest.dir}/${partest.srcdir}/instrumented">
+ <include name="*.scala"/>
+ </instrumentedtests>
<presentationtests dir="${partest.dir}/${partest.srcdir}/presentation">
<include name="*/*.scala"/>
</presentationtests>