Browse Source

upgraded for new resource-copying API's and also testing nested paths and refid's.

tags/v1_1_0_RC1
wisberg 21 years ago
parent
commit
57129e35ce
2 changed files with 124 additions and 19 deletions
  1. 74
    6
      taskdefs/testdata/incTest/incTest.xml
  2. 50
    13
      taskdefs/testdata/incTest/readme-incTest.html

+ 74
- 6
taskdefs/testdata/incTest/incTest.xml View File

@@ -1,6 +1,14 @@

<!-- to test incremental task, run setup then test -->
<project default="test" basedir=".">

<path id="aspectjrt.path">
<pathelement location="${basedir}/../../../lib/test/aspectjrt.jar"/>
</path>
<path id="aspects.path">
<pathelement location="${basedir}/output/aspects.jar"/>
</path>

<target name="init">
<property name="td"
location="${basedir}/../.."/>
@@ -21,16 +29,74 @@
</classpath>
</taskdef>
</target>
<target name="clean" depends="init">
<delete quiet="on">
<fileset dir="${test.dir}/classes"/>
<fileset dir="${test.dir}/injars"/>
</delete>
</target>

<target name="test-both" depends="init">
<mkdir dir="${test.dir}/injars"/>
<iajc outjar="${test.dir}/injars/both.jar"
failonerror="true">
<sourceroots>
<pathelement path="${test.dir}/injarSrc/one"/>
<pathelement path="${test.dir}/injarSrc/two"/>
</sourceroots>
<classpath>
<pathelement path="${td}/../lib/test/aspectjrt.jar"/>
</classpath>
</iajc>
</target>
<target name="test-all" depends="init">
<mkdir dir="${test.dir}/injars"/>
<mkdir dir="${test.dir}/output"/>
<iajc outjar="${test.dir}/injars/all-one.jar"
classpath="${td}/../lib/test/aspectjrt.jar"
sourceroots="${test.dir}/injarSrc/one"
failonerror="true"/>
<iajc outjar="${test.dir}/output/aspect.jar"
failonerror="true"
classpathref="aspectjrt.path"
srcdir="${test.dir}/src">
<include name="TraceMains.java"/>
</iajc>
<iajc outjar="${test.dir}/output/all.jar"
sourcerootcopyfilter="**/*.java"
copyinjars="true"
failonerror="true">
<classpath>
<pathelement path="${td}/../lib/test/aspectjrt.jar"/>
</classpath>
<aspectpath refid="aspects.path"/>
<sourceroots>
<pathelement path="${test.dir}/injarSrc/two"/>
<pathelement path="${test.dir}/src"/>
</sourceroots>
<injars>
<pathelement path="${test.dir}/injars/all-one.jar"/>
</injars>
</iajc>
</target>
<target name="setup" depends="init"
description="create input jars">
<mkdir dir="${test.dir}/injars"/>
<iajc outjar="${test.dir}/injars/both.jar"
classpath="${td}/../lib/test/aspectjrt.jar"
sourceroots="${test.dir}/injarSrc/one,${test.dir}/injarSrc/two"
failonerror="true"/>
<iajc outjar="${test.dir}/injars/oneClasses.jar"
classpath="${td}/../lib/test/aspectjrt.jar"
sourceroots="${test.dir}/injarSrc/one"/>
sourceroots="${test.dir}/injarSrc/one"
failonerror="true"/>
<iajc outjar="${test.dir}/injars/twoClasses.jar"
classpath="${td}/../lib/test/aspectjrt.jar"
sourceroots="${test.dir}/injarSrc/two"/>
sourceroots="${test.dir}/injarSrc/two"
failonerror="true"/>
<zip zipfile="${test.dir}/injars/one.jar">
<zipfileset src="${test.dir}/injars/oneClasses.jar"/>
<fileset dir="${test.dir}/injarSrc/one"
@@ -50,20 +116,22 @@
</target>

<target name="test" depends="init">
<mkdir dir="${test.dir}/output"/>
<mkdir dir="${test.dir}/output/classes"/>
<property name="tag.file"
location="${test.dir}/output/tagFile.txt"/>
<echo message="edit to recompile, delete to quit"
file="${tag.file}"/>
<echo message="update to recompile, delete to quit: ${tag.file}"/>
<iajc outjar="${test.dir}/output/outjar.jar"
<iajc classpath="${td}/../lib/test/aspectjrt.jar"
outjar="${test.dir}/output/outjar.jar"
injars="${test.dir}/injars/one.jar;${test.dir}/injars/two.jar"
classpath="${td}/../lib/test/aspectjrt.jar"
sourceroots="${test.dir}/src"
xCopyInjars="true"
copyInjars="true"
sourceRootCopyFilter="**/*.java,**/CVS/*"
tagFile="${tag.file}"
verbose="on"/>
<!--
destDir="${test.dir}/output/classes"
incremental="true"
-->
</target>

+ 50
- 13
taskdefs/testdata/incTest/readme-incTest.html View File

@@ -2,17 +2,31 @@
<title>Incremental test of AjcTask Ant task</title>
<body>
<h2>Incremental test of AjcTask Ant task</h2>
This directory contains files for manually testing the
incremental behavior of the AjcTask Ant task.
It has an Ant script which builds two input jars
This directory contains files for manually testing
two AjcTask Ant task facilities:
<ul>
<li>incremental builds, using tag file or input stream
(supported directly by the compiler)
</li>
<li>resource copying using input jars or source roots
and output jar or directory
(only supported in the Ant task).
</li>
</ul>

<a href="incTest.xml">incTest.xml</a>
is an Ant script which builds two input jars
and runs an incremental test using a tag file.
<p>
The results must be verified by hand manually at present;
This test should be updated to run automatically.
This test should be updated to run using JUnit like
<a href="../../testsrc/org/aspectj/tools/ant/taskdefs/AjcTaskTest.java">
AjcTaskTest.java</a>.


<h3>Sample procedure</h3>
This shows how to set up the test and check whether
the incremental tag file and injar-copying features work.
the incremental tag file and resource-copying features work.
Throughout, <code>{ant}</code> is assumed to be
<code>../../../lib/ant/bin/ant</code> and the directory
is assumed to be this directory, with the Ant build script
@@ -49,11 +63,14 @@ The task will do an initial compilation and silently wait.
the execution of any static main(String[]) method.
<p>
</li>
<li>Also test that the injar files were copied to the output jar.
The non-.class files in <a href="injarSrc">injarSrc/</a>
should be included in the output jar:
<li>Check that the output jar got the injar and src files:

<pre> jar tf output/outjar.jar</pre>
<p>
The output should list the
non-.class files in <a href="injarSrc">injarSrc/</a>
and the non CVS/.java files in the <a href="src">src/</a> dir.
<p>
</li>
<li>To test incremental compiles,
edit the aspect <a href="src/TraceMains.java">src/TraceMains.java</a>
@@ -65,18 +82,33 @@ The task will do an initial compilation and silently wait.
</li>
<li>Test the generated output jar again
to see if the changes are reflected in the runtime behavior
and if the non-.class files are being copied correctly.
and if files are being copied correctly.
<p>
</li>
<li>Repeat this process until satisfied. Delete the tagfile to quit:
<pre> rm output/tagfile.txt</pre>
<p>
</li>
<li>Also run the targets <code>test-all</code>
and <code>test-both</code>.
<p>
</li>
</ol>

To test the <code>-incremental</code> option or to test without
copying input jar files or using an output jar, edit the
<a href="incTest.xml">incTest.xml</a> script and redo the test.
Many combination of the option variants are possible.
Test the relevant ones by editing the
<a href="incTest.xml">incTest.xml</a> script
and redoing the test.
<p>
<table cellpadding="1" border="1">
<tr><th>Option</th><th>Variants</th></tr>
<tr><td>incremental</td><td>none, -incremental, -tagFile</td></tr>
<tr><td>output</td><td>none (default "."), destDir, output jar</td></tr>
<tr><td>injars</td><td>none, one, two</td></tr>
<tr><td>injar copying</td><td>off (default), on</td></tr>
<tr><td>source resource copying</td><td>off (default), various patterns</td></tr>
</table>

<p>

<h3>Clean-up</h3>
@@ -84,14 +116,19 @@ Take care to preserve CVS state after running this test.
It calls on you to edit checked-in files and generates files
to local repository directories. The best thing is to delete
the <code>output</code> and <code>injars</code> directories
(using the <code>clean</code> task)
and revert to repository forms for sources (unless fixing them).

<h3>Upgrade</h3>
This needs to be upgraded to run manually.
This needs to be upgraded to run automatically.
There is a file/tree-comparison utility to revive from the
aspectj-attic which can be used to compare expected and actual
results of the jar files. Setting up the tasks to run incrementally
might be done using the parallel task, but...
<p>
In any case, the nested options tested here should move
to non-incremental JUnit tests.
<p>
<hr>
</body>
</html>

Loading…
Cancel
Save