aboutsummaryrefslogtreecommitdiffstats
path: root/tests/product
diff options
context:
space:
mode:
Diffstat (limited to 'tests/product')
-rw-r--r--tests/product/ant-example.xml343
-rw-r--r--tests/product/build.dtd2
-rw-r--r--tests/product/expect.zipbin0 -> 17065 bytes
-rw-r--r--tests/product/index.txt59
-rw-r--r--tests/product/makeTestBat.sh124
-rw-r--r--tests/product/new-test-taskdefs.xml561
-rw-r--r--tests/product/product-properties.xml416
-rw-r--r--tests/product/product-test.xml293
-rw-r--r--tests/product/test-taskdefs.xml466
-rw-r--r--tests/product/testScripts/ajcCommandLineTest.sh179
-rw-r--r--tests/product/testScripts/ajdocTests.sh148
-rw-r--r--tests/product/testScripts/argfiles.sh301
-rw-r--r--tests/product/testScripts/cmdline11/app/Main.java62
-rw-r--r--tests/product/testScripts/cmdline11/myprofile/MyProfile.java13
-rw-r--r--tests/product/testScripts/cmdline11/profile/Profile.java39
-rw-r--r--tests/product/testScripts/cmdline11/script.sh117
-rw-r--r--tests/product/testScripts/publicIntroduction.sh128
17 files changed, 3251 insertions, 0 deletions
diff --git a/tests/product/ant-example.xml b/tests/product/ant-example.xml
new file mode 100644
index 000000000..1dda5c944
--- /dev/null
+++ b/tests/product/ant-example.xml
@@ -0,0 +1,343 @@
+<!-- -*- Mode: SGML; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- -->
+<!-- -->
+<!-- This file is part of the compiler and core tools for the AspectJ(tm) -->
+<!-- programming language; see http://aspectj.org -->
+<!-- -->
+<!-- The contents of this file are subject to the Mozilla Public License -->
+<!-- Version 1.1 (the "License"); you may not use this file except in -->
+<!-- compliance with the License. You may obtain a copy of the License at -->
+<!-- either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. -->
+<!-- -->
+<!-- Software distributed under the License is distributed on an "AS IS" basis, -->
+<!-- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -->
+<!-- for the specific language governing rights and limitations under the -->
+<!-- License. -->
+<!-- -->
+<!-- The Original Code is AspectJ. -->
+<!-- -->
+<!-- The Initial Developer of the Original Code is Xerox Corporation. Portions -->
+<!-- created by Xerox Corporation are Copyright (C) 1999, 2000 Xerox Corporation. -->
+<!-- All Rights Reserved. -->
+
+<!-- todo: non-distribution license?? -->
+
+<!DOCTYPE build SYSTEM "build.dtd">
+
+<project name="ant-example" default="test" basedir=".">
+
+ <!-- define target init.product -->
+ &aspectj_initProduct;
+
+ <!-- ========================================================================== -->
+ <!-- Init -->
+ <!-- ========================================================================== -->
+ <target name="init" depends="init.product"
+ description="caller must define jdk.tools.jar and product.dir or run from product.dir">
+ <echo message="init ant-examples.xml"/>
+ <!-- directory produced during test install -->
+ <property name="ajx.base.dir"
+ location="${productTest.output.dir}/ajx-output"/>
+ <property name="ajx.expect.dir"
+ location="${productTest.expect.dir}/ajx"/>
+ <property name="noclass"
+ value="noclass"/>
+ <property name="noclass.dir"
+ location="${productTest.output.dir}/${noclass}"/>
+ <property name="aj.public.taskdef.package"
+ value="org.aspectj.tools.ant.taskdef"/>
+ <property name="taskdef.classpath"
+ value="${product.taskdefs.jar}${PS}${product.tools.jar}${PS}${jdk.tools.jar}"/>
+ </target>
+
+ <target name="init.taskdefs" depends="init,product.taskdefs.jar,product.tools.jar">
+ <!-- define taskdefs used here - requires jars, etc. -->
+ <taskdef name="ajc"
+ classname="${aj.public.taskdef.package}.Ajc" >
+ <classpath>
+ <pathelement path="${product.taskdefs.jar}"/>
+ <pathelement path="${product.tools.jar}"/>
+ <pathelement path="${jdk.tools.jar}"/>
+ </classpath>
+ </taskdef>
+ <taskdef name="ajdoc"
+ classname="${aj.public.taskdef.package}.Ajdoc">
+ <classpath>
+ <pathelement path="${product.taskdefs.jar}"/>
+ <pathelement path="${product.tools.jar}"/>
+ <pathelement path="${jdk.tools.jar}"/>
+ </classpath>
+ </taskdef>
+ </target>
+
+
+ <!-- ========================================================================== -->
+ <!-- Clean everything in created dirs -->
+ <!-- ========================================================================== -->
+
+ <target name="clean" depends="init"
+ description="clean output created by this script">
+ <antcall target="mkdir"><param name="dir" value="${ajx.base.dir}"/>
+ </antcall>
+ <antcall target="mkdir"><param name="dir" value="${noclass.dir}"/>
+ </antcall>
+ </target>
+
+ <target name="noclass.setup" depends="init"
+ description="setup no-op dummy class to invoke when test class n/a or requires gui">
+ <echo file="${noclass}.java">
+ public class ${noclass} { public static void main(String[]args){}}
+ </echo>
+ <mkdir dir="${noclass.dir}"/>
+ <delete dir="${noclass.dir}"/>
+ <mkdir dir="${noclass.dir}"/>
+ <javac srcdir="."
+ includes="${noclass}.java"
+ destdir="${noclass.dir}"
+ failonerror="true"/>
+ <delete file="${noclass}.java"/>
+ <echo message=" todo check file: ${noclass}.java"/>
+ <java classname="${noclass}"
+ failonerror="true"
+ classpath="${noclass.dir}"/>
+ </target>
+
+ <!-- ========================================================================== -->
+ <!-- Run tests -->
+ <!-- ========================================================================== -->
+ <target name="Ajx" depends="init.taskdefs"
+ description="for {example}, compile {list}, doc {list}, and run {class}">
+ <echo message="##### START Ajx example=${example} list=${list} class=${class}" />
+ <property name="exdir"
+ value="${ajx.base.dir}/${example}"/>
+ <property name="expect.exdir" value="${ajx.expect.dir}/${example}"/>
+ <mkdir dir="${exdir}/classes"/>
+ <mkdir dir="${exdir}/output"/>
+ <mkdir dir="${exdir}/docs"/>
+ <delete dir="${exdir}/classes"/>
+ <delete dir="${exdir}/output"/>
+ <delete dir="${exdir}/docs"/>
+ <mkdir dir="${exdir}/classes"/>
+ <mkdir dir="${exdir}/output"/>
+ <mkdir dir="${exdir}/docs"/>
+
+ <echo message="##################### Ajx ajc ${list}"/>
+ <ajc
+ destdir="${exdir}/classes"
+ argfile="${list}"
+ failonerror="false" >
+ <classpath>
+ <pathelement location="${product.rt.jar}" />
+ <pathelement location="${jdk.tools.jar}" /> <!-- to compile ajdoc -->
+ </classpath>
+ </ajc>
+ <!-- copying resources, etc. as javac does todo weak -->
+ <copy todir="${exdir}/classes">
+ <fileset dir="${srcDir}"
+ includes="**/*.properties,**/*.gif,**/*.jpg,**/*.props" />
+ </copy>
+
+ <echo message="##################### Ajx ajdoc ${list} "/>
+ <ajdoc fork="yes"
+ private="yes"
+ verbose="yes"
+ sourcepath="${product.examples.dir}"
+ destdir="${exdir}/docs"
+ argfile="${list}"
+ classpath="${product.rt.jar}${PS}${jdk.tools.jar}"
+ failonerror="false" >
+ <!-- internalclasspath
+ internalclasspath="${taskdef.classpath}"
+ is required now - but still not producing docs
+ <classpath>
+ <pathelement location="${product.rt.jar}" />
+ </classpath>
+ -->
+ </ajdoc>
+
+ <echo message="##################### Ajx run ${class} START - output in ${exdir}/output/out.txt"/>
+ <java classname="${class}"
+ output="${exdir}/output/out.txt"
+ fork="yes"
+ failonerror="false" >
+ <!-- fork because ajc does a System.exit -->
+ <classpath>
+ <pathelement location="${exdir}/classes"/>
+ <pathelement location="${product.rt.jar}"/>
+ <pathelement location="${noclass.dir}"/>
+ <pathelement location="${jdk.tools.jar}" /> <!-- to run ajdoc and old ajc -->
+ </classpath>
+ </java>
+ <echo message="##################### Ajx run ${class} STOP"/>
+ <echo message="##################### Ajx run ${class} check output START "/>
+ <comparefiles rhsFile="${exdir}/output/out.txt"
+ lhsFile="${expect.exdir}/output/out.txt"/>
+ <echo message="##################### Ajx run ${class} check output STOP "/>
+ <echo message="##### FINISH Ajx example=${example} list=${list} class=${class}" />
+ </target>
+
+ <target name="test" depends="test.examples,test.sources"/>
+
+ <target name="test.sources" depends="init,noclass.setup,productTest.expect.dir"
+ description="compile, doc, and run the tools-source targets using taskdefs" >
+ <property name="tools.src.dir"
+ location="${product.source.tools.dir}/src"/>
+ <antcall target="Ajx">
+ <param name="list" value="${tools.src.dir}/runtime.lst"/>
+ <param name="example" value="source-tools-runtime"/>
+ <param name="class" value="${noclass}"/>
+ <param name="srcDir" value="${tools.src.dir}"/>
+ </antcall>
+ <antcall target="Ajx">
+ <param name="list" value="${tools.src.dir}/ajc.lst"/>
+ <param name="example" value="source-tools-ajc"/>
+ <param name="class" value="org.aspectj.tools.ajc.Main"/>
+ <param name="srcDir" value="${tools.src.dir}"/>
+ <!-- ajc does a System.exit -->
+ </antcall>
+ <antcall target="Ajx">
+ <param name="list" value="${tools.src.dir}/tools.lst"/>
+ <param name="example" value="source-tools-all"/>
+ <param name="class" value="${noclass}"/>
+ <param name="srcDir" value="${tools.src.dir}"/>
+ </antcall>
+ <antcall target="Ajx">
+ <param name="list" value="${tools.src.dir}/ajbrowser.lst"/>
+ <param name="example" value="source-tools-ajbrowser"/>
+ <param name="class" value="${noclass}"/>
+ <param name="srcDir" value="${tools.src.dir}"/>
+ </antcall>
+ <antcall target="Ajx">
+ <param name="list" value="${tools.src.dir}/ajdoc.lst"/>
+ <param name="example" value="source-tools-ajdoc"/>
+ <param name="class" value="org.aspectj.tools.ajdoc.Main"/>
+ <param name="srcDir" value="${tools.src.dir}"/>
+ </antcall>
+ </target>
+
+ <target name="test.examples" depends="init,noclass.setup,productTest.expect.dir"
+ description="compile, doc, and run the valid examples using taskdefs" >
+ <antcall target="Ajx">
+ <param name="list" value="bean/files.lst"/>
+ <param name="example" value="bean"/>
+ <param name="class" value="bean.Demo"/>
+ <param name="srcDir" value="."/>
+ </antcall>
+ <antcall target="Ajx">
+ <param name="list" value="coordination/lib.lst"/>
+ <param name="example" value="coordination"/>
+ <param name="class" value="${noclass}"/>
+ <param name="srcDir" value="."/>
+ </antcall>
+ <antcall target="Ajx">
+ <param name="list" value="introduction/files.lst"/>
+ <param name="example" value="introduction-point"/>
+ <param name="class" value="introduction.Point"/>
+ <param name="srcDir" value="."/>
+ </antcall>
+ <antcall target="Ajx">
+ <param name="list" value="introduction/files.lst"/>
+ <param name="example" value="introduction-cloneablepoint"/>
+ <param name="class" value="introduction.CloneablePoint"/>
+ <param name="srcDir" value="."/>
+ </antcall>
+ <antcall target="Ajx">
+ <param name="list" value="introduction/files.lst"/>
+ <param name="example" value="introduction-comparablepoint"/>
+ <param name="class" value="introduction.ComparablePoint"/>
+ <param name="srcDir" value="."/>
+ </antcall>
+ <antcall target="Ajx">
+ <param name="list" value="introduction/files.lst"/>
+ <param name="example" value="introduction-hashablepoint"/>
+ <param name="class" value="introduction.HashablePoint"/>
+ <param name="srcDir" value="."/>
+ </antcall>
+ <antcall target="Ajx">
+ <param name="list" value="observer/files.lst"/>
+ <param name="example" value="observer"/>
+ <param name="class" value="${noclass}"/>
+ <param name="srcDir" value="."/>
+ <!-- uses gui: param name="class" value="observer.Demo" -->
+ </antcall>
+ <antcall target="Ajx">
+ <param name="list" value="spacewar/debug.lst"/>
+ <param name="example" value="spacewar-debug"/>
+ <param name="class" value="${noclass}"/>
+ <param name="srcDir" value="."/>
+ </antcall>
+ <antcall target="Ajx">
+ <param name="list" value="spacewar/demo.lst"/>
+ <param name="example" value="spacewar-demo"/>
+ <param name="class" value="${noclass}"/>
+ <param name="srcDir" value="."/>
+ </antcall>
+ <antcall target="Ajx">
+ <param name="list" value="telecom/basic.lst"/>
+ <param name="example" value="telecom-basic"/>
+ <param name="class" value="telecom.BasicSimulation"/>
+ <param name="srcDir" value="."/>
+ </antcall>
+ <antcall target="Ajx">
+ <param name="list" value="telecom/billing.lst"/>
+ <param name="example" value="telecom-billing"/>
+ <param name="class" value="telecom.BillingSimulation"/>
+ <param name="srcDir" value="."/>
+ </antcall>
+ <antcall target="Ajx">
+ <param name="list" value="telecom/timing.lst"/>
+ <param name="example" value="telecom-timing"/>
+ <param name="class" value="telecom.TimingSimulation"/>
+ <param name="srcDir" value="."/>
+ </antcall>
+ <!-- timeserver not in product - todo check
+ <antcall target="Ajx">
+ <param name="list" value="timeserver/abort.lst"/>
+ <param name="example" value="timeserver-abort"/>
+ <param name="class" value="${noclass}"/>
+ <param name="srcDir" value="."/>
+ </antcall>
+ <antcall target="Ajx">
+ <param name="list" value="timeserver/retry.lst"/>
+ <param name="example" value="timeserver-retry"/>
+ <param name="class" value="${noclass}"/>
+ <param name="srcDir" value="."/>
+ </antcall>
+ -->
+ <antcall target="Ajx">
+ <param name="list" value="tjp/files.lst"/>
+ <param name="example" value="tjp"/>
+ <param name="class" value="tjp.Demo"/>
+ <param name="srcDir" value="."/>
+ </antcall>
+ <antcall target="Ajx">
+ <param name="list" value="tracing/notrace.lst"/>
+ <param name="example" value="tracing-none"/>
+ <param name="class" value="tracing.ExampleMain"/>
+ <param name="srcDir" value="."/>
+ </antcall>
+ <antcall target="Ajx">
+ <param name="list" value="tracing/tracelib.lst"/>
+ <param name="example" value="tracing-ExampleMain"/>
+ <param name="class" value="tracing.ExampleMain"/>
+ <param name="srcDir" value="."/>
+ </antcall>
+ <antcall target="Ajx">
+ <param name="list" value="tracing/tracev1.lst"/>
+ <param name="example" value="tracing-v1"/>
+ <param name="class" value="tracing.ExampleMain"/>
+ <param name="srcDir" value="."/>
+ </antcall>
+ <antcall target="Ajx">
+ <param name="list" value="tracing/tracev2.lst"/>
+ <param name="example" value="tracing-v2"/>
+ <param name="class" value="tracing.ExampleMain"/>
+ <param name="srcDir" value="."/>
+ </antcall>
+ <antcall target="Ajx">
+ <param name="list" value="tracing/tracev3.lst"/>
+ <param name="example" value="tracing-v3"/>
+ <param name="class" value="tracing.ExampleMain"/>
+ <param name="srcDir" value="."/>
+ </antcall>
+ </target>
+</project>
diff --git a/tests/product/build.dtd b/tests/product/build.dtd
new file mode 100644
index 000000000..da92a771e
--- /dev/null
+++ b/tests/product/build.dtd
@@ -0,0 +1,2 @@
+<!-- defines target init.product -->
+<!ENTITY aspectj_initProduct SYSTEM "product-properties.xml">
diff --git a/tests/product/expect.zip b/tests/product/expect.zip
new file mode 100644
index 000000000..3ba3dd1f0
--- /dev/null
+++ b/tests/product/expect.zip
Binary files differ
diff --git a/tests/product/index.txt b/tests/product/index.txt
new file mode 100644
index 000000000..a723531cc
--- /dev/null
+++ b/tests/product/index.txt
@@ -0,0 +1,59 @@
+
+This directory is for "product" tests, which validate the product as delivered
+to users, i.e., as installed from an installer in relevant combinations. This
+type of testing is also called "system" test, or (less correctly) "integration"
+testing. It may make use of unit-test drivers, etc.; the difference is not
+in the test tools or techniques, but in the scope of the validation. However,
+validation typically builds on other testing; e.g., if the compiler has been
+thoroughly tested, then it may suffice in product testing to validate that
+the compiler binaries are the same and that the examples compile using the
+scripts which use the compiler binaries.
+
+The ant script aspectj/test-product.xml drives the process by installing the
+product, copying this entire directory to the target dir, and invoking
+ant product-test.xml. Currently, that script in turn does two things:
+ - executes the ajc.bat script to compile the telecom example, and run it
+ - invokes ant ant-example.xml to compile/doc/run all examples using
+ the ant taskdefs.
+In both cases the results are not validated except that the operations completed.
+
+Setup of the installation directory (aka product or target directory):
+
+ ## dir/file ## ## ant source ## ## variable in ant source ##
+ {target.dir} test-product.xml ${target.dir}
+ aspectj-ant test-product.xml
+ aspectj-ant.jar aspectj-ant installer ${taskdefs.jar}
+ bin tools installer ${bin.dir}
+ doc docs installer ${lib.dir}
+ examples docs installer ${examples.dir}
+ lib tools installer ${lib.dir}
+ aspectjtools.jar tools installer ${aspectjtools.jar}
+ aspectjrt.jar tools installer ${aspectjrt.jar}
+ product product-test.xml ${test.source.dir}
+ product-test-output product-test.xml ${test.dest.dir}
+ ajx-output ant-examples.xml ${ajx.base.dir}
+ {example}/classes ant-examples.xml
+ {example}/docs ant-examples.xml
+ {example}/output ant-examples.xml
+ out.txt ant-examples.xml
+
+---------------------------------------------------- to run tests
+cd aspectj
+## either this (which builds the ajde and source files, too) ...
+build/bin/ant.sh -f build.xml download.files
+## or this (which only builds what's needed)...
+build/bin/ant.sh -f build-tools.xml download.files
+build/bin/ant.sh -f build-docs.xml download.files
+build/bin/ant.sh -f build-ant-tasks.xml download.files
+## then run the tests
+build/bin/ant.sh -f test-product.xml
+## and inspect the results
+cd ../aj-build/temp/aspectj{version}/product-test-output/ajx-output
+...
+
+---------------------------------------------------- todo
+- include all download.files packages
+ - need to test installer text interface for ide installer jars
+- file differencer on all packages after install
+- source-build tests
+- file differencer as regression test for emitted output
diff --git a/tests/product/makeTestBat.sh b/tests/product/makeTestBat.sh
new file mode 100644
index 000000000..8f94663ae
--- /dev/null
+++ b/tests/product/makeTestBat.sh
@@ -0,0 +1,124 @@
+#!/bin/sh
+# kludge to generate a bat script using ajc.bat, ajdoc.bat, and ajdb.bat
+# set the Java command for the target platform,
+# and run the resulting script in the aspectj directory
+# @process-test tools makeTestBat.sh # generate .bat script to test examples
+
+JAVA='C:\home\apps\jdk13\bin\java'
+errMssg() {
+ [ -n "$1" ] && echo "## $0 - $1"
+ [ -n "$2" ] && exit "$2"
+}
+
+javaCommand() {
+ # grep 'main(' */*.java | sed 's|\.java.*||;s|\/|.|;s|\(.*\)| \1 ) m=\1;;| ' | sort -u
+ m=""
+ case "$1" in
+ # todo: need to distinguish multiple entrypoints per compile?
+ bean\\files ) m=bean.DeclareError;;
+ bean\\files ) m=bean.Demo;;
+ introduction\\files ) m=introduction.CloneablePoint;;
+ introduction\\files ) m=introduction.ComparablePoint;;
+ introduction\\files ) m=introduction.HashablePoint;;
+ introduction\\files ) m=introduction.Point;;
+ observer\\files ) m=observer.Demo;;
+ spacewar\\debug ) m=spacewar.Game;;
+ spacewar\\demo ) m=spacewar.Game;;
+ telecom\\basic ) m=telecom.BasicSimulation;;
+ telecom\\billing ) m=telecom.BillingSimulation;;
+ telecom\\timing ) m=telecom.TimingSimulation;;
+ tjp\\files ) m=tjp.Demo;;
+ tracing\\notrace ) m=tracing.ExampleMain;;
+ tracing\\tracelib ) m=tracing.ExampleMain;;
+ tracing\\tracev1 ) m=tracing.ExampleMain;;
+ tracing\\tracev2 ) m=tracing.ExampleMain;;
+ tracing\\tracev3 ) m=tracing.ExampleMain;;
+ * ) echo "rem no java command yet for $1" ;;
+ esac
+ if [ -n "$m" ] ; then
+ case "$2" in
+ ajdb ) echo "call ..\\bin\\ajdb.bat -classpath \"$1;..\\lib\\aspectjrt.jar\" $m < ajdbInput" ;;
+ java ) echo "$JAVA -classpath \"$1;..\\lib\\aspectjrt.jar\" $m ";;
+ * ) echo "rem unrecognized request $2 for $1"
+ esac
+ fi
+}
+getAjdocPackages() {
+ m=""
+ case "$1" in
+ bean\\files ) m="bean ";;
+ introduction\\files ) m="introduction ";;
+ coordination\\lib ) m="coordination ";;
+ observer\\files ) m="observer ";;
+ spacewar\\debug ) m="spacewar coordination";;
+ spacewar\\demo ) m="spacewar ";;
+ telecom\\basic ) m="telecom ";;
+ telecom\\billing ) m="telecom ";;
+ telecom\\timing ) m="telecom ";;
+ tjp\\files ) m="tjp ";;
+ tracing\\notrace ) m="tracing ";;
+ tracing\\tracelib ) m="tracing tracing.lib";;
+ tracing\\tracev1 ) m="tracing tracing.version1";;
+ tracing\\tracev2 ) m="tracing tracing.version2";;
+ tracing\\tracev3 ) m="tracing tracing.version3";;
+ * ) echo "rem no ajdoc command yet for $1" ;;
+ esac
+ echo "$m"
+}
+
+example() {
+ docPacks=$(getAjdocPackages "$1")
+ cat<<EOF
+echo "###################### running $1"
+if exist $1 rmdir /S /Q $1
+if not exist $1 mkdir $1
+call ..\\bin\\ajc.bat -d $1 -classpath ..\\lib\\aspectjrt.jar -argfile $1.lst > $1\\ajc.txt 2>&1
+@echo on
+$(javaCommand $1 java) > $1\\java.txt 2>&1
+@echo on
+$(javaCommand $1 ajdb) > $1\\ajdb.txt 2>&1
+@echo on
+call ..\\bin\\ajdoc.bat -d $1 -classpath ..\\lib\\aspectjrt.jar -sourcepath . $docPacks > $1\\ajdoc.txt 2>&1
+EOF
+}
+
+unixToDOS() {
+ sed 's| ||' # add ^M here (C-v C-m)
+}
+
+allListFiles() {
+cat<<EOF
+@bean\files.lst
+@spacewar\debug.lst
+@coordination\lib.lst
+@introduction\files.lst
+@observer\files.lst
+@telecom\timing.lst
+@spacewar\debug.lst
+@tjp\files.lst
+@tracing\tracev3.lst
+EOF
+}
+[ -f "lib/aspectjrt.jar" ] || errMssg "rt" 3
+[ -f "examples/bean/files.lst" ] || errMssg "eg" 3
+
+cd examples
+allListFiles | unixToDOS > examples.lst
+echo "exit" > ajdbInput
+echo "cd examples"
+echo "if not exist ajworkingdir mkdir ajworkingdir"
+for i in $(ls */*.lst | sed 's|\.lst||;s|\/|\\|') ; do
+ example $i | sed 's|$||' # add ^M here (C-v C-m)
+done
+
+## now do all together
+
+dir=all
+packages="bean coordination introduction spacewar telecom telecom.timing tracing tracing.lib tracing.version3"
+ cat<<EOF
+echo "###################### compile all "
+if exist $dir rmdir /S /Q $dir
+if not exist $dir mkdir $dir
+call ..\\bin\\ajc.bat -d $dir -classpath ..\\lib\\aspectjrt.jar @examples.lst > $dir\\ajc.txt 2>&1
+call ..\\bin\\ajdoc.bat -d $dir -classpath ..\\lib\\aspectjrt.jar -sourcepath . $packages > $dir\\ajdoc.txt 2>&1
+EOF
diff --git a/tests/product/new-test-taskdefs.xml b/tests/product/new-test-taskdefs.xml
new file mode 100644
index 000000000..85da1ede3
--- /dev/null
+++ b/tests/product/new-test-taskdefs.xml
@@ -0,0 +1,561 @@
+<!-- -*- Mode: SGML; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- -->
+<!-- -->
+<!-- This file is part of the compiler and core tools for the AspectJ(tm) -->
+<!-- programming language; see http://aspectj.org -->
+<!-- -->
+<!-- The contents of this file are subject to the Mozilla Public License -->
+<!-- Version 1.1 (the "License"); you may not use this file except in -->
+<!-- compliance with the License. You may obtain a copy of the License at -->
+<!-- either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. -->
+<!-- -->
+<!-- Software distributed under the License is distributed on an "AS IS" basis, -->
+<!-- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -->
+<!-- for the specific language governing rights and limitations under the -->
+<!-- License. -->
+<!-- -->
+<!-- The Original Code is AspectJ. -->
+<!-- -->
+<!-- The Initial Developer of the Original Code is Xerox Corporation. Portions -->
+<!-- created by Xerox Corporation are Copyright (C) 1999, 2000 Xerox Corporation. -->
+<!-- All Rights Reserved. -->
+
+<!-- ============================================================================== -->
+<!-- To do a build, invoke build/bin/ant.[sh|bat] after defining JDKDIR. -->
+<!-- To customize properties, edit local.properties.examples as local.properties. -->
+<!-- ============================================================================== -->
+<!-- todo: non-distribution license?? -->
+
+<!-- standalone script to be run in examples dir -->
+<!-- currently relies on deployed taskdefs to ant.home, instead of -->
+<!-- using taskdef classpaths (aka safe install) -->
+
+<project name="test-taskdefs" default="test" basedir="..">
+
+ <!-- ========================================================================== -->
+ <!-- Init -->
+ <!-- ========================================================================== -->
+ <target name="init"
+ description="caller must define jdk.tools.jar and product.dir or run from product.examples.dir">
+ <echo message="init test-taskdefs.xml"/>
+
+ <property name="PS" value="${path.separator}"/>
+
+ <!-- define product.dir or run from it -->
+ <property name="product.dir"
+ location="${basedir}"/>
+
+ <!-- define local.deploy.dir to get different tools and taskdefs -->
+ <property name="local.deploy.dir"
+ location="${product.dir}"/>
+ <!-- expected from install -->
+ <property name="ex.dir"
+ location="${product.dir}/examples"/>
+ <property name="product.examples.dir"
+ location="${ex.dir}"/>
+ <!-- created after install -->
+ <property name="test.dir"
+ location="${product.dir}/test"/>
+ <property name="expect.file"
+ location="${test.dir}/expect.out"/>
+ <property name="actual.file"
+ location="${test.dir}/actual.out"/>
+ <property name="empty.dir"
+ location="${test.dir}/emptydir"/>
+ <property name="classes.dir"
+ location="${test.dir}/classes"/>
+ <property name="expected.classes.dir"
+ location="${test.dir}/expectedClasses"/>
+ <property name="working.dir"
+ location="${product.dir}/workingdir"/>
+ <property name="expected.working.dir"
+ location="${test.dir}/expectedWorkingdir"/>
+ <mkdir dir="${empty.dir}"/>
+ <mkdir dir="${classes.dir}"/>
+ <mkdir dir="${expected.classes.dir}"/>
+ <mkdir dir="${working.dir}"/>
+ <mkdir dir="${expected.working.dir}"/>
+
+
+ <property name="build-tools.jar"
+ location="${ant.home}/lib/build-tools.jar"/>
+
+ <property name="safe.classpath" value="yes"/>
+
+ <!-- unsafe classpaths in ant/lib -->
+ <property name="aj-testing.jar"
+ location="${ant.home}/lib/aj-testing.jar"/>
+ <property name="aj-testing-taskdefs.jar"
+ location="${ant.home}/lib/aj-testing-taskdefs.jar"/>
+ <property name="aspectj-ant.jar"
+ location="${ant.home}/lib/aspectj-ant.jar"/>
+ <property name="aspectjtools.jar"
+ location="${ant.home}/lib/aspectjtools.jar"/>
+ <property name="aspectjrt.jar"
+ location="${product.dir}/lib/aspectjrt.jar"/>
+
+ <!-- safe classpaths in ant/lib/optional -->
+ <property name="safe.aj-testing.jar"
+ location="${ant.home}/lib/optional/aj-testing.jar"/>
+ <property name="safe.aj-testing-taskdefs.jar"
+ location="${ant.home}/lib/optional/aj-testing-taskdefs.jar"/>
+ <property name="safe.aspectj-ant.jar"
+ location="${ant.home}/lib/optional/aspectj-ant.jar"/>
+ <property name="safe.aspectjtools.jar"
+ location="${ant.home}/lib/optional/aspectjtools.jar"/>
+ <property name="safe.aspectjrt.jar"
+ location="${ant.home}/lib/optional/aspectjrt.jar"/>
+
+ <available file="${build-tools.jar}"
+ property="build-tools.jar.available"/>
+
+ <available file="${aspectjtools.jar}"
+ property="aspectjtools.jar.available"/>
+ <available file="${aspectjrt.jar}"
+ property="aspectjrt.jar.available"/>
+ <available file="${aspectj-ant.jar}"
+ property="aspectj-ant.jar.available"/>
+ <available file="${aj-testing.jar}"
+ property="aj-testing.jar.available"/>
+ <available file="${aj-testing-taskdefs.jar}"
+ property="aj-testing-taskdefs.jar.available"/>
+
+ <available file="${safe.aspectjtools.jar}"
+ property="safe.aspectjtools.jar.available"/>
+ <available file="${safe.aspectjrt.jar}"
+ property="safe.aspectjrt.jar.available"/>
+ <available file="${safe.aspectj-ant.jar}"
+ property="safe.aspectj-ant.jar.available"/>
+ <available file="${safe.aj-testing.jar}"
+ property="safe.aj-testing.jar.available"/>
+ <available file="${safe.aj-testing-taskdefs.jar}"
+ property="safe.aj-testing-taskdefs.jar.available"/>
+
+ <property name="run.classpath"
+ location="${classes.dir}${PS}${aspectjrt.jar}"/>
+ <property name="simple.run.classpath"
+ location="${product.examples.dir}${PS}${aspectjrt.jar}"/>
+
+ <property name="aj.public.taskdef.package"
+ value="org.aspectj.tools.ant.taskdefs"/>
+
+ </target>
+
+ <target name="setup.taskdef.classpath"
+ depends="setup.taskdef.classpath.unsafe,setup.taskdef.classpath.safe" />
+
+ <target name="setup.taskdef.classpath.safe" if="safe.classpath" >
+ <property name="safe.classpath" value="yes"/>
+ <property name="use.safe.classpath" value="yes"/>
+ <property name="use.fork" value="${use.safe.classpath}"/>
+ </target>
+ <target name="setup.taskdef.classpath.unsafe" unless="safe.classpath" >
+ <property name="use.safe.classpath" value="no"/>
+ <property name="use.fork" value="${use.safe.classpath}"/>
+ </target>
+
+ <target name="init.taskdefs"
+ depends="setup.taskdef.classpath,init.taskdefs.safe,init.taskdefs.unsafe" />
+
+ <target name="init.taskdefs.unsafe"
+ depends="init,setup.taskdef.classpath"
+ unless="safe.classpath"
+ description="initialize taskdefs relying on ant.home/lib" >
+ <antcall target="unsafe.jars.available"/>
+ <taskdef name="ajc"
+ classname="${aj.public.taskdef.package}.Ajc" />
+ <taskdef name="ajdoc"
+ classname="${aj.public.taskdef.package}.Ajdoc"/>
+ <taskdef name="comparefiles"
+ classname="org.aspectj.testing.taskdefs.CompareFiles"/>
+ </target>
+
+ <target name="init.taskdefs.safe"
+ depends="init,setup.taskdef.classpath"
+ if="safe.classpath"
+ description="initialize taskdefs without ant.home/lib" >
+ <antcall target="safe.jars.available"/>
+ <taskdef name="ajc"
+ classname="${aj.public.taskdef.package}.Ajc" >
+ <classpath>
+ <pathelement path="${safe.aspectjtools.jar}"/>
+ <pathelement path="${safe.aspectj-ant.jar}"/>
+ </classpath>
+ </taskdef>
+ <taskdef name="ajdoc"
+ classname="${aj.public.taskdef.package}.Ajdoc" >
+ <classpath>
+ <pathelement path="${safe.aspectjtools.jar}"/>
+ <pathelement path="${safe.aspectj-ant.jar}"/>
+ </classpath>
+ </taskdef>
+ <taskdef name="comparefiles"
+ classname="org.aspectj.testing.taskdefs.CompareFiles">
+ <classpath>
+ <pathelement path="${safe.aj-testing.jar}"/>
+ <pathelement path="${safe.aj-testing-taskdefs.jar}"/>
+ </classpath>
+ </taskdef>
+ </target>
+
+
+ <!-- -->
+ <target name="safe.jars.available"
+ depends="safe.aspectjtools.jar.available,safe.aspectj-ant.jar.available,
+ safe.aj-testing.jar.available,safe.aj-testing-taskdefs.jar.available,"/>
+
+ <target name="unsafe.jars.available"
+ depends="aspectjtools.jar.available,aspectj-ant.jar.available,
+ aj-testing.jar.available,aj-testing-taskdefs.jar.available,"/>
+
+ <target name="build-tools.jar.available" depends="init"
+ unless="build-tools.jar.available" >
+ <fail message="expecting build-tools.jar at ${build-tools.jar}"/>
+ </target>
+ <target name="aj-testing.jar.available" depends="init"
+ unless="aj-testing.jar.available" >
+ <fail message="expecting aj-testing.jar at ${aj-testing.jar}"/>
+ </target>
+ <target name="aj-testing-taskdefs.jar.available" depends="init"
+ unless="aj-testing-taskdefs.jar.available" >
+ <fail message="expecting aj-testing-taskdefs.jar at ${aj-testing-taskdefs.jar}"/>
+ </target>
+ <target name="aspectjtools.jar.available" depends="init"
+ unless="aspectjtools.jar.available" >
+ <fail message="expecting aspectjtools.jar at ${aspectjtools.jar}"/>
+ </target>
+ <target name="aspectj-ant.jar.available" depends="init"
+ unless="aspectj-ant.jar.available" >
+ <fail message="expecting aspectj-ant.jar at ${aspectj-ant.jar}"/>
+ </target>
+
+ <target name="safe.aj-testing.jar.available" depends="init"
+ unless="safe.aj-testing.jar.available" >
+ <fail message="expecting safe.aj-testing.jar at ${safe.aj-testing.jar}"/>
+ </target>
+ <target name="safe.aj-testing-taskdefs.jar.available" depends="init"
+ unless="safe.aj-testing-taskdefs.jar.available" >
+ <fail message="expecting safe.aj-testing-taskdefs.jar at ${safe.aj-testing-taskdefs.jar}"/>
+ </target>
+ <target name="safe.aspectjtools.jar.available" depends="init"
+ unless="safe.aspectjtools.jar.available" >
+ <fail message="expecting safe.aspectjtools.jar at ${safe.aspectjtools.jar}"/>
+ </target>
+ <target name="safe.aspectj-ant.jar.available" depends="init"
+ unless="safe.aspectj-ant.jar.available" >
+ <fail message="expecting safe.aspectj-ant.jar at ${safe.aspectj-ant.jar}"/>
+ </target>
+
+ <target name="clean" depends="init"
+ description="todo clean output created by this script">
+ </target>
+
+ <target name="test" depends="test.ajc,test.ajdoc"/>
+
+ <target name="test.ajdoc" depends="init,init.taskdefs"
+ description="run variants of ajdoc taskdef on bean, other examples">
+
+ <mkdir dir="${expected.classes.dir}"/>
+ <delete quiet="on" dir="${expected.classes.dir}"/>
+ <mkdir dir="${expected.classes.dir}"/>
+ <mkdir dir="${classes.dir}"/>
+ <delete quiet="on" dir="${classes.dir}"/>
+ <mkdir dir="${classes.dir}"/>
+ <antcall target="cleanajc"/>
+
+ <echo message="## ajdoc setup classes dir" />
+ <ajdoc classpath="${aspectjrt.jar}" destdir="${expected.classes.dir}"
+ srcdir="${ex.dir}/bean" packagenames="bean"
+ argfile="${ex.dir}/bean/files.lst"
+ private="on" />
+
+ <echo message="## ajdoc @testcase same as setup" />
+ <antcall target="cleanajc"/>
+ <ajdoc classpath="${aspectjrt.jar}" destdir="${classes.dir}"
+ srcdir="${ex.dir}/bean" packagenames="bean"
+ argfile="${ex.dir}/bean/files.lst"
+ private="on" />
+ <antcall target="verifyAndCleanup.ajdoc"/>
+
+ <echo message="## ajdoc @testcase same as setup, with -standard doclet" />
+ <antcall target="cleanajc"/>
+ <ajdoc classpath="${aspectjrt.jar}" destdir="${classes.dir}"
+ srcdir="${ex.dir}/bean" packagenames="bean"
+ argfile="${ex.dir}/bean/files.lst"
+ private="on" standard="on"/>
+ <antcall target="verifyAndCleanup.ajdoc"/>
+
+ <echo message="## ajdoc @testcase srcdir with include argument" />
+ <ajdoc classpath="${aspectjrt.jar}" destdir="${classes.dir}"
+ srcdir="${ex.dir}/bean" includes="*.java"
+ private="on" />
+ <antcall target="verifyAndCleanup.ajdoc"/>
+
+ <echo message="## ajdoc @testcase srcdir with nested include argument" />
+ <ajdoc classpath="${aspectjrt.jar}" destdir="${classes.dir}"
+ private="on" >
+ <sourcepath path="${ex.dir}/bean"/>
+ <include name="*.java"/>
+ </ajdoc>
+ <antcall target="verifyAndCleanup.ajdoc"/>
+
+ <echo message="## ajdoc @testcase argfile only with nested classpath" />
+ <ajdoc destdir="${classes.dir}"
+ argfile="${ex.dir}/bean/files.lst"
+ private="on" >
+ <classpath> <pathelement path="${aspectjrt.jar}"/> </classpath>
+ </ajdoc>
+ <antcall target="verifyAndCleanup.ajdoc"/>
+
+<!-- todo ignoring include ajdoc cases until fixed
+ <echo message="## ajdoc need @testcase nested src with kitchen sink" />
+ <echo message="## ajdoc @testcase argfile todo " />
+ <echo message="## ajdoc @testcase Vincent Massol bug" />
+ <ajdoc destdir="${classes.dir}"
+ srcdir="${ex.dir}/bean"
+ private="on" >
+ <include name="*.java"/>
+ <include name="**.java"/>
+ <classpath> <pathelement path="${aspectjrt.jar}"/> </classpath>
+ </ajdoc>
+ <antcall target="verifyAndCleanup.ajdoc"/>
+
+todo bug ajdoc taskdef not handling any includes or nested src or
+includes argument
+-->
+ <!-- todo: version bootclasspath, extdirs
+ Xporting="on" # todo: after Jim updates compiler for Xporting
+ todo: nested src n/a
+ -->
+
+ </target>
+
+ <!-- to use safe classpaths, must fork -->
+ <target name="test.ajc" depends="init,init.taskdefs"
+ description="run variants of ajc taskdef on bean, other examples">
+
+ <echo message="## setup expected working dir, classes dir, and output file" />
+ <antcall target="cleanajc"/>
+ <ajc srcdir="${ex.dir}/bean" classpath="${aspectjrt.jar}"
+ destDir="${expected.classes.dir}"
+ usejavac="yes" fork="${use.fork}"
+ workingdir="${expected.working.dir}"/>
+ <java classname="bean.Demo"
+ classpath="${expected.classes.dir}${PS}${aspectjrt.jar}"
+ dir="${ex.dir}" fork="yes"
+ output="${expect.file}"/>
+
+ <echo message="## @testcase simple srcdir example" />
+ <antcall target="cleanajc"/>
+ <ajc srcdir="${ex.dir}/bean" fork="${use.fork}" classpath="${aspectjrt.jar}" />
+ <echo message="## simple.run.classpath: ${simple.run.classpath} " />
+ <java classname="bean.Demo"
+ classpath="${simple.run.classpath}"
+ dir="${ex.dir}" fork="yes"
+ output="${actual.file}"/>
+ <antcall target="cleanajc"/>
+
+ <echo message="## @testcase srcdir with include argument" />
+ <ajc srcdir="${ex.dir}/bean" fork="${use.fork}" classpath="${aspectjrt.jar}" includes="*.java"/>
+ <java classname="bean.Demo"
+ classpath="${simple.run.classpath}"
+ dir="${ex.dir}" fork="yes"
+ output="${actual.file}"/>
+ <antcall target="verifyAndCleanup.noworkingdir.noclassesdir"/>
+
+ <echo message="## @testcase srcdir with destDir and working workingdir argument" />
+ <ajc srcdir="${ex.dir}/bean" fork="${use.fork}" classpath="${aspectjrt.jar}"
+ destDir="${classes.dir}"
+ usejavac="yes"
+ workingdir="${working.dir}"/>
+ <java classname="bean.Demo"
+ classpath="${run.classpath}"
+ dir="${ex.dir}" fork="yes"
+ output="${actual.file}"/>
+ <antcall target="verifyAndCleanup.workingdir.classesdir"/>
+
+ <echo message="## @testcase simple srcdir with nested include and nested classpath" />
+ <ajc fork="${use.fork}" srcdir="${ex.dir}/bean">
+ <include name="**.java"/>
+ <classpath> <pathelement path="${aspectjrt.jar}"/> </classpath>
+ </ajc>
+ <java classname="bean.Demo"
+ classpath="${simple.run.classpath}"
+ dir="${ex.dir}" fork="yes"
+ output="${actual.file}"/>
+ <antcall target="verifyAndCleanup.noworkingdir.noclassesdir"/>
+
+ <echo message="## @testcase nested src with kitchen sink" />
+ <antcall target="cleanajc"/>
+ <ajc fork="${use.fork}"
+ destDir="${classes.dir}"
+ workingdir="${working.dir}"
+ usejavac="on"
+ preprocess="no"
+ verbose="on"
+ deprecation="on"
+ optimize="on"
+ encoding="encodingIgnored"
+ target="targetIgnored"
+ depend="dependIgnored"
+ includeantruntime="includeantruntimeIgnored"
+ includejavaruntime="includejavaruntimeIgnored"
+ failonerror="on"
+
+ nocomments="on"
+ nosymbols="on"
+ emacssym="on"
+ strict="on"
+ >
+ <src path="${ex.dir}/bean"/>
+ <include name="**.java"/>
+ <classpath> <pathelement path="${aspectjrt.jar}"/> </classpath>
+ </ajc>
+ <java classname="bean.Demo"
+ classpath="${run.classpath}"
+ dir="${ex.dir}" fork="yes"
+ output="${actual.file}"/>
+ <antcall target="verifyAndCleanup.workingdir.classesdir"/>
+
+ <echo message="## @testcase srcdir in preprocess mode" />
+ <ajc srcdir="${ex.dir}/bean" classpath="${aspectjrt.jar}"
+ lenient="on" fork="${use.fork}"
+ workingdir="${working.dir}" usejavac="on" preprocess="yes"/>
+ <antcall target="verifyAndCleanup.workingdir.noclassesdir.nooutput"/>
+
+ <echo message="## @testcase argfile in preprocess mode" />
+ <ajc argfile="${ex.dir}/bean/files.lst" classpath="${aspectjrt.jar}"
+ workingdir="${working.dir}" fork="${use.fork}" usejavac="on" preprocess="yes"/>
+ <antcall target="verifyAndCleanup.workingdir.noclassesdir.nooutput"/>
+
+ <echo message="## @testcase argfile in normal mode" />
+ <ajc argfile="${ex.dir}/bean/files.lst" classpath="${aspectjrt.jar}"
+ destdir="${classes.dir}" fork="${use.fork}" usejavac="off" preprocess="no" verbose="yes"/>
+ <java classname="bean.Demo"
+ classpath="${run.classpath}"
+ dir="${ex.dir}" fork="yes"
+ output="${actual.file}"/>
+ <antcall target="verifyAndCleanup.noworkingdir.classesdir"/>
+
+ <echo message="## @testcase multiple argfile todo restore" />
+ <ajc argfiles="${ex.dir}/bean/files.lst,${ex.dir}/introduction/files.lst"
+ classpath="${aspectjrt.jar}" fork="${use.fork}" destdir="${classes.dir}" >
+ </ajc>
+
+ <java classname="bean.Demo"
+ classpath="${run.classpath}"
+ dir="${ex.dir}" fork="${use.fork}"
+ output="${actual.file}"/>
+ <copy todir="${expected.classes.dir}" >
+ <fileset dir="${classes.dir}" includes="**.class" />
+ </copy>
+ <antcall target="cleanajc"/> <!-- too many classes -->
+
+ <echo message="## @testcase Vincent Massol bug" />
+ <ajc classpath="${aspectjrt.jar}" fork="${use.fork}"
+ workingdir="${working.dir}" preprocess="yes" >
+ <src path="${ex.dir}/bean"/>
+ <src path="${ex.dir}/introduction"/>
+ <include name="*.java"/>
+ <include name="**.java"/>
+ </ajc>
+ <antcall target="verifyAndCleanup.workingdir.noclassesdir.nooutput"/>
+
+ <echo message="## @testcase warning when no source files specified but have srcdir # " />
+ <ajc srcdir="${ex.dir}/bean" fork="${use.fork}" classpath="${aspectjrt.jar}" />
+ <antcall target="cleanajc"/>
+
+ <!-- @testcase -preprocess not supported -->
+ <echo message="## @testcase -preprocess srcdir no destDir, post-javac compile (-preprocess ignored) # " />
+ <mkdir dir="workingdir" /> <!-- todo: failing to create workingdir from taskdef -->
+ <ajc srcdir="${ex.dir}/bean" fork="${use.fork}" includes="**.java" classpath="${aspectjrt.jar}"
+ usejavac="no" preprocess="yes"/>
+ <javac srcdir="workingdir"
+ destDir="${classes.dir}">
+ <classpath>
+ <pathelement path="${aspectjrt.jar}"/>
+ </classpath>
+ </javac>
+
+ <java classname="bean.Demo"
+ classpath="${run.classpath}"
+ dir="${ex.dir}" fork="yes"
+ output="${actual.file}"/>
+ <antcall target="verifyAndCleanup.noworkingdir.classesdir"/>
+
+ <!-- todo: version bootclasspath, extdirs
+ Xporting="on" # todo: after Jim updates compiler for Xporting
+ -->
+
+ </target>
+
+ <target name="verifyAndCleanup.ajdoc" depends="verifyAndCleanup.noworkingdir.classesdir.nooutput" />
+
+ <target name="verifyAndCleanup.noworkingdir.noclassesdir">
+ <antcall target="expectfile"/>
+ <antcall target="noworkingdir"/>
+ <antcall target="noclassesdir"/>
+ <antcall target="cleanajc"/>
+ </target>
+
+ <target name="verifyAndCleanup.workingdir.noclassesdir">
+ <antcall target="expectfile"/>
+ <antcall target="workingdir"/>
+ <antcall target="noclassesdir"/>
+ <antcall target="cleanajc"/>
+ </target>
+
+ <target name="verifyAndCleanup.workingdir.noclassesdir.nooutput">
+ <antcall target="workingdir"/>
+ <antcall target="noclassesdir"/>
+ <antcall target="cleanajc"/>
+ </target>
+
+ <target name="verifyAndCleanup.noworkingdir.classesdir.nooutput">
+ <antcall target="noworkingdir"/>
+ <antcall target="classesdir"/>
+ <antcall target="cleanajc"/>
+ </target>
+
+ <target name="verifyAndCleanup.noworkingdir.classesdir" >
+ <antcall target="noworkingdir"/>
+ <antcall target="classesdir"/>
+ <antcall target="expectfile"/>
+ <antcall target="cleanajc"/>
+ </target>
+
+ <target name="verifyAndCleanup.workingdir.classesdir">
+ <antcall target="expectfile"/>
+ <antcall target="workingdir"/>
+ <antcall target="classesdir"/>
+ <antcall target="cleanajc"/>
+ </target>
+
+ <target name="expectfile" depends="init">
+ <comparefiles lhsFile="${expect.file}" rhsFile="${actual.file}"/>
+ <delete quiet="on" file="${actual.file}"/>
+ </target>
+ <target name="noworkingdir" depends="init">
+ <comparefiles lhsFile="${empty.dir}" rhsFile="${working.dir}"/>
+ </target>
+ <target name="workingdir" depends="init">
+ <comparefiles lhsFile="${expected.working.dir}" rhsFile="${working.dir}"/>
+ </target>
+ <target name="noclassesdir" depends="init">
+ <comparefiles lhsFile="${empty.dir}" rhsFile="${classes.dir}"/>
+ </target>
+ <target name="classesdir" depends="init">
+ <comparefiles lhsFile="${expected.classes.dir}" rhsFile="${classes.dir}"/>
+ </target>
+
+ <target name="cleanajc" depends="init">
+ <mkdir dir="${classes.dir}"/>
+ <delete quiet="on" dir="${classes.dir}"/>
+ <mkdir dir="${classes.dir}"/>
+ <mkdir dir="${working.dir}"/>
+ <delete quiet="on" dir="${working.dir}"/>
+ <mkdir dir="${working.dir}"/>
+ <delete quiet="on" >
+ <fileset dir="${product.examples.dir}" includes="**.class,**.ajesym"/>
+ </delete>
+ </target>
+</project>
diff --git a/tests/product/product-properties.xml b/tests/product/product-properties.xml
new file mode 100644
index 000000000..b5d7b07a0
--- /dev/null
+++ b/tests/product/product-properties.xml
@@ -0,0 +1,416 @@
+<!-- -*- Mode: SGML; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- -->
+<!-- -->
+<!-- This file is part of the compiler and core tools for the AspectJ(tm) -->
+<!-- programming language; see http://aspectj.org -->
+<!-- -->
+<!-- The contents of this file are subject to the Mozilla Public License -->
+<!-- Version 1.1 (the "License"); you may not use this file except in -->
+<!-- compliance with the License. You may obtain a copy of the License at -->
+<!-- either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. -->
+<!-- -->
+<!-- Software distributed under the License is distributed on an "AS IS" basis, -->
+<!-- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -->
+<!-- for the specific language governing rights and limitations under the -->
+<!-- License. -->
+<!-- -->
+<!-- The Original Code is AspectJ. -->
+<!-- -->
+<!-- The Initial Developer of the Original Code is Xerox Corporation. Portions -->
+<!-- created by Xerox Corporation are Copyright (C) 1999, 2000 Xerox Corporation. -->
+<!-- All Rights Reserved. -->
+
+<!-- ============================================================================== -->
+<!-- To do a build, invoke build/bin/ant.[sh|bat] after defining JDKDIR. -->
+<!-- To customize properties, edit local.properties.examples as local.properties. -->
+<!-- ============================================================================== -->
+<!-- todo: non-distribution license?? -->
+<!-- generated using script - see added: for differences -->
+
+ <!-- init.product . . . . . . . -->
+ <target name="init.product" depends=""
+ unless="" >
+ <property name="PS" value="${path.separator}" />
+ <property name="product.dir"
+ location="${basedir}" />
+ <property name="product.bin.dir"
+ location="${product.dir}/bin" />
+ <property name="product.src.dir"
+ location="${product.dir}/src" />
+ <property name="product.lib.dir"
+ location="${product.dir}/lib" />
+ <property name="product.tools.jar"
+ location="${product.dir}/lib/aspectjtools.jar" />
+ <property name="product.rt.jar"
+ location="${product.dir}/lib/aspectjrt.jar" />
+ <property name="product.examples.dir"
+ location="${product.dir}/examples" />
+ <property name="product.doc.dir"
+ location="${product.dir}/doc" />
+ <property name="product.doc-tgz.dir"
+ location="${product.dir}/../doc-tgz" />
+ <property name="product.ajdee.dir"
+ location="${product.dir}/../${ajdee.product.name}" />
+ <property name="product.aspectj-mode.dir"
+ location="${product.dir}/../${aspectj-mode.product.name}" />
+ <property name="product.forte.dir"
+ location="${product.dir}/../forte" />
+ <property name="product.jbuilder.dir"
+ location="${product.dir}/../jbuilder" />
+ <property name="product.source.tools.dir"
+ location="${product.dir}/../source-tools" />
+ <property name="product.source.forte.dir"
+ location="${product.dir}/../source-forte" />
+ <property name="product.source.jbuilder.dir"
+ location="${product.dir}/../source-jbuilder" />
+ <property name="product.taskdefs.dir"
+ location="${product.dir}/../${ant.dist.name}" />
+ <property name="product.taskdefs.jar"
+ location="${product.dir}/lib/aspectj-ant.jar" />
+ <property name="productTest.dir"
+ location="${product.dir}/product" />
+ <property name="productTest.output.dir"
+ location="${product.dir}/product-test-output" />
+ <property name="productTest.expect.zip"
+ location="${productTest.dir}/expect.zip" />
+ <property name="productTest.expect.dir"
+ location="${productTest.dir}/expect" />
+ <property name="productTest.expect.bat.dir"
+ location="${productTest.expect.dir}/bat" />
+ </target> <!-- init.product -->
+
+ <!-- product.dir.available . . . . . . . -->
+ <target name="product.dir.available" depends="init.product"
+ unless="" >
+ <available file="${product.dir}"
+ property="product.dir.available" />
+ </target> <!-- product.dir.available -->
+
+ <!-- product.dir . . . . . . . -->
+ <target name="product.dir" depends="product.dir.available"
+ unless="product.dir.available" >
+ <fail message="expecting product.dir at ${product.dir}"/>
+ </target> <!-- product.dir -->
+
+ <!-- product.bin.dir.available . . . . . . . -->
+ <target name="product.bin.dir.available" depends="init.product"
+ unless="" >
+ <available file="${product.bin.dir}"
+ property="product.bin.dir.available" />
+ </target> <!-- product.bin.dir.available -->
+
+ <!-- product.bin.dir . . . . . . . -->
+ <target name="product.bin.dir" depends="product.bin.dir.available"
+ unless="product.bin.dir.available" >
+ <fail message="expecting product.bin.dir at ${product.bin.dir}"/>
+ </target> <!-- product.bin.dir -->
+
+ <!-- product.lib.dir.available . . . . . . . -->
+ <target name="product.lib.dir.available" depends="init.product"
+ unless="" >
+ <available file="${product.lib.dir}"
+ property="product.lib.dir.available" />
+ </target> <!-- product.lib.dir.available -->
+
+ <!-- product.lib.dir . . . . . . . -->
+ <target name="product.lib.dir" depends="product.lib.dir.available"
+ unless="product.lib.dir.available" >
+ <fail message="expecting product.lib.dir at ${product.lib.dir}"/>
+ </target> <!-- product.lib.dir -->
+
+ <!-- product.tools.jar.available . . . . . . . -->
+ <target name="product.tools.jar.available" depends="init.product"
+ unless="" >
+ <available file="${product.tools.jar}"
+ property="product.tools.jar.available" />
+ </target> <!-- product.tools.jar.available -->
+
+ <!-- product.tools.jar . . . . . . . -->
+ <target name="product.tools.jar" depends="product.tools.jar.available"
+ unless="product.tools.jar.available" >
+ <fail message="expecting product.tools.jar at ${product.tools.jar}"/>
+ </target> <!-- product.tools.jar -->
+
+ <!-- product.rt.jar.available . . . . . . . -->
+ <target name="product.rt.jar.available" depends="init.product"
+ unless="" >
+ <available file="${product.rt.jar}"
+ property="product.rt.jar.available" />
+ </target> <!-- product.rt.jar.available -->
+
+ <!-- product.rt.jar . . . . . . . -->
+ <target name="product.rt.jar" depends="product.rt.jar.available"
+ unless="product.rt.jar.available" >
+ <fail message="expecting product.rt.jar at ${product.rt.jar}"/>
+ </target> <!-- product.rt.jar -->
+
+ <!-- product.examples.dir.available . . . . . . . -->
+ <target name="product.examples.dir.available" depends="init.product"
+ unless="" >
+ <available file="${product.examples.dir}"
+ property="product.examples.dir.available" />
+ </target> <!-- product.examples.dir.available -->
+
+ <!-- product.examples.dir . . . . . . . -->
+ <target name="product.examples.dir" depends="product.examples.dir.available"
+ unless="product.examples.dir.available" >
+ <fail message="expecting product.examples.dir at ${product.examples.dir}"/>
+ </target> <!-- product.examples.dir -->
+
+ <!-- product.doc.dir.available . . . . . . . -->
+ <target name="product.doc.dir.available" depends="init.product"
+ unless="" >
+ <available file="${product.doc.dir}"
+ property="product.doc.dir.available" />
+ </target> <!-- product.doc.dir.available -->
+
+ <!-- product.doc.dir . . . . . . . -->
+ <target name="product.doc.dir" depends="product.doc.dir.available"
+ unless="product.doc.dir.available" >
+ <fail message="expecting product.doc.dir at ${product.doc.dir}"/>
+ </target> <!-- product.doc.dir -->
+
+ <!-- product.doc-tgz.dir.available . . . . . . . -->
+ <target name="product.doc-tgz.dir.available" depends="init.product"
+ unless="" >
+ <available file="${product.doc-tgz.dir}"
+ property="product.doc-tgz.dir.available" />
+ </target> <!-- product.doc-tgz.dir.available -->
+
+ <!-- product.doc-tgz.dir . . . . . . . -->
+ <target name="product.doc-tgz.dir" depends="product.doc-tgz.dir.available"
+ unless="product.doc-tgz.dir.available" >
+ <fail message="expecting product.doc-tgz.dir at ${product.doc-tgz.dir}"/>
+ </target> <!-- product.doc-tgz.dir -->
+
+ <!-- product.ajdee.dir.available . . . . . . . -->
+ <target name="product.ajdee.dir.available" depends="init.product"
+ unless="" >
+ <available file="${product.ajdee.dir}"
+ property="product.ajdee.dir.available" />
+ </target> <!-- product.ajdee.dir.available -->
+
+ <!-- product.ajdee.dir . . . . . . . -->
+ <target name="product.ajdee.dir" depends="product.ajdee.dir.available"
+ unless="product.ajdee.dir.available" >
+ <fail message="expecting product.ajdee.dir at ${product.ajdee.dir}"/>
+ </target> <!-- product.ajdee.dir -->
+
+ <!-- product.aspectj-mode.dir.available . . . . . . . -->
+ <target name="product.aspectj-mode.dir.available" depends="init.product"
+ unless="" >
+ <available file="${product.aspectj-mode.dir}"
+ property="product.aspectj-mode.dir.available" />
+ </target> <!-- product.aspectj-mode.dir.available -->
+
+ <!-- product.aspectj-mode.dir . . . . . . . -->
+ <target name="product.aspectj-mode.dir" depends="product.aspectj-mode.dir.available"
+ unless="product.aspectj-mode.dir.available" >
+ <fail message="expecting product.aspectj-mode.dir at ${product.aspectj-mode.dir}"/>
+ </target> <!-- product.aspectj-mode.dir -->
+
+ <!-- product.forte.dir.available . . . . . . . -->
+ <target name="product.forte.dir.available" depends="init.product"
+ unless="" >
+ <available file="${product.forte.dir}"
+ property="product.forte.dir.available" />
+ </target> <!-- product.forte.dir.available -->
+
+ <!-- product.forte.dir . . . . . . . -->
+ <target name="product.forte.dir" depends="product.forte.dir.available"
+ unless="product.forte.dir.available" >
+ <fail message="expecting product.forte.dir at ${product.forte.dir}"/>
+ </target> <!-- product.forte.dir -->
+
+ <!-- product.jbuilder.dir.available . . . . . . . -->
+ <target name="product.jbuilder.dir.available" depends="init.product"
+ unless="" >
+ <available file="${product.jbuilder.dir}"
+ property="product.jbuilder.dir.available" />
+ </target> <!-- product.jbuilder.dir.available -->
+
+ <!-- product.jbuilder.dir . . . . . . . -->
+ <target name="product.jbuilder.dir" depends="product.jbuilder.dir.available"
+ unless="product.jbuilder.dir.available" >
+ <fail message="expecting product.jbuilder.dir at ${product.jbuilder.dir}"/>
+ </target> <!-- product.jbuilder.dir -->
+
+ <!-- product.src.dir.available . . . . . . . -->
+ <target name="product.src.dir.available" depends="init.product"
+ unless="" >
+ <available file="${product.src.dir}"
+ property="product.src.dir.available" />
+ </target> <!-- product.src.dir.available -->
+
+ <!-- product.src.dir . . . . . . . -->
+ <target name="product.src.dir" depends="product.src.dir.available"
+ unless="product.src.dir.available" >
+ <fail message="expecting product.src.dir at ${product.src.dir}"/>
+ </target> <!-- product.src.dir -->
+
+ <!-- product.source.tools.dir.available . . . . . . . -->
+ <target name="product.source.tools.dir.available" depends="init.product"
+ unless="" >
+ <available file="${product.source.tools.dir}"
+ property="product.source.tools.dir.available" />
+ </target> <!-- product.source.tools.dir.available -->
+
+ <!-- product.source.tools.dir . . . . . . . -->
+ <target name="product.source.tools.dir" depends="product.source.tools.dir.available"
+ unless="product.source.tools.dir.available" >
+ <fail message="expecting product.source.tools.dir at ${product.source.tools.dir}"/>
+ </target> <!-- product.source.tools.dir -->
+ <!-- product.source.forte.dir.available . . . . . . . -->
+ <target name="product.source.forte.dir.available" depends="init.product"
+ unless="" >
+ <available file="${product.source.forte.dir}"
+ property="product.source.forte.dir.available" />
+ </target> <!-- product.source.forte.dir.available -->
+
+ <!-- product.source.forte.dir . . . . . . . -->
+ <target name="product.source.forte.dir" depends="product.source.forte.dir.available"
+ unless="product.source.forte.dir.available" >
+ <fail message="expecting product.source.forte.dir at ${product.source.forte.dir}"/>
+ </target> <!-- product.source.forte.dir -->
+
+ <!-- product.source.jbuilder.dir.available . . . . . . . -->
+ <target name="product.source.jbuilder.dir.available" depends="init.product"
+ unless="" >
+ <available file="${product.source.jbuilder.dir}"
+ property="product.source.jbuilder.dir.available" />
+ </target> <!-- product.source.jbuilder.dir.available -->
+
+ <!-- product.source.jbuilder.dir . . . . . . . -->
+ <target name="product.source.jbuilder.dir" depends="product.source.jbuilder.dir.available"
+ unless="product.source.jbuilder.dir.available" >
+ <fail message="expecting product.source.jbuilder.dir at ${product.source.jbuilder.dir}"/>
+ </target> <!-- product.source.jbuilder.dir -->
+
+ <!-- product.taskdefs.dir.available . . . . . . . -->
+ <target name="product.taskdefs.dir.available" depends="init.product"
+ unless="" >
+ <available file="${product.taskdefs.dir}"
+ property="product.taskdefs.dir.available" />
+ </target> <!-- product.taskdefs.dir.available -->
+
+ <!-- product.taskdefs.dir . . . . . . . -->
+ <target name="product.taskdefs.dir" depends="product.taskdefs.dir.available"
+ unless="product.taskdefs.dir.available" >
+ <fail message="expecting product.taskdefs.dir at ${product.taskdefs.dir}"/>
+ </target> <!-- product.taskdefs.dir -->
+
+ <!-- product.taskdefs.jar.available . . . . . . . -->
+ <target name="product.taskdefs.jar.available" depends="init.product"
+ unless="" >
+ <available file="${product.taskdefs.jar}"
+ property="product.taskdefs.jar.available" />
+ </target> <!-- product.taskdefs.jar.available -->
+
+ <!-- product.taskdefs.jar . . . . . . . -->
+ <target name="product.taskdefs.jar" depends="product.taskdefs.jar.available"
+ unless="product.taskdefs.jar.available" >
+ <fail message="expecting product.taskdefs.jar at ${product.taskdefs.jar}"/>
+ </target> <!-- product.taskdefs.jar -->
+
+ <!-- productTest.dir.available . . . . . . . -->
+ <target name="productTest.dir.available" depends="init.product"
+ unless="" >
+ <available file="${productTest.dir}"
+ property="productTest.dir.available" />
+ </target> <!-- productTest.dir.available -->
+
+ <!-- productTest.dir . . . . . . . -->
+ <target name="productTest.dir" depends="productTest.dir.available"
+ unless="productTest.dir.available" >
+ <fail message="expecting productTest.dir at ${productTest.dir}"/>
+ </target> <!-- productTest.dir -->
+
+ <!-- productTest.output.dir.available . . . . . . . -->
+ <target name="productTest.output.dir.available" depends="init.product"
+ unless="" >
+ <available file="${productTest.output.dir}"
+ property="productTest.output.dir.available" />
+ </target> <!-- productTest.output.dir.available -->
+
+ <!-- productTest.output.dir . . . . . . . -->
+ <target name="productTest.output.dir" depends="productTest.output.dir.available"
+ unless="productTest.output.dir.available" >
+ <mkdir dir="${productTest.output.dir}"/>
+ </target> <!-- productTest.output.dir -->
+
+ <!-- productTest.expect.zip.available . . . . . . . -->
+ <target name="productTest.expect.zip.available" depends="init.product"
+ unless="" >
+ <available file="${productTest.expect.zip}"
+ property="productTest.expect.zip.available" />
+ </target> <!-- productTest.expect.zip.available -->
+
+ <!-- productTest.expect.zip . . . . . . . -->
+ <target name="productTest.expect.zip" depends="productTest.expect.zip.available"
+ unless="productTest.expect.zip.available" >
+ <fail message="expecting productTest.expect.zip at ${productTest.expect.zip}"/>
+ </target> <!-- productTest.expect.zip -->
+
+ <!-- productTest.expect.dir.available . . . . . . . -->
+ <target name="productTest.expect.dir.available" depends="init.product"
+ unless="" >
+ <available file="${productTest.expect.dir}"
+ property="productTest.expect.dir.available" />
+ </target> <!-- productTest.expect.dir.available -->
+
+ <!-- productTest.expect.dir . . . . . . . --> <!-- added: unzip -->
+ <target name="productTest.expect.dir"
+ depends="init.product,productTest.expect.zip"
+ unless="productTest.expect.dir.available" >
+ <unzip src="${productTest.expect.zip}"
+ dest="${productTest.dir}"/>
+ </target> <!-- productTest.expect.dir -->
+
+ <!-- productTest.expect.bat.dir.available . . . . . . . -->
+ <target name="productTest.expect.bat.dir.available" depends="init.product"
+ unless="" >
+ <available file="${productTest.expect.bat.dir}"
+ property="productTest.expect.bat.dir.available" />
+ </target> <!-- productTest.expect.bat.dir.available -->
+
+ <!-- productTest.expect.bat.dir . . . . . . . --> <!-- added productTest.expect.dir -->
+ <target name="productTest.expect.bat.dir"
+ depends="productTest.expect.dir,productTest.expect.bat.dir.available"
+ unless="productTest.expect.bat.dir.available" >
+ <fail message="expecting productTest.expect.bat.dir at ${productTest.expect.bat.dir}"/>
+ </target> <!-- productTest.expect.bat.dir -->
+
+ <!-- about.init.product . . . . . . . -->
+ <target name="about.init.product" depends=""
+ unless="" >
+ <echo>Generated using script generateProperties.
+-------------------- Required variables
+ajdee.product.name
+ant.jarfile.name
+aspectj-mode.product.name
+forte.product.name
+jbuilder.product.name
+-------------------- target items data
+product.dir NONE NONE NONE
+product.bin.dir bin ajc.bat product.dir
+product.lib.dir lib aspectjrt.jar product.dir
+product.tools.jar lib aspectjtools.jar product.dir
+product.rt.jar lib aspectjrt.jar product.dir
+product.examples.dir examples bean/files.lst product.dir
+product.doc.dir doc faq.html product.dir
+product.doc-tgz.dir doc-tgz README-DOCS.html product.dir
+product.ajdee.dir ${ajdee.product.name} ${ajdee.product.name} product.dir
+product.aspectj-mode.dir ${aspectj-mode.product.name} ${aspectj-mode.product.name} product.dir
+product.forte.dir forte ${forte.product.name}.jar product.dir
+product.jbuilder.dir jbuilder ${jbuilder.product.name}.jar product.dir
+product.source.tools.dir source-tools LICENSE-SOURCES.html product.dir
+product.source.forte.dir source-forte LICENSE-AJDEFORTE-SOURCES.html product.dir
+product.source.jbuilder.dir source-jbuilder LICENSE-AJDEFORTE-SOURCES.html product.dir
+product.taskdefs.dir ${ant.dist.name} ${ant.jarfile.name} product.dir
+product.taskdefs.jar NONE ${ant.jarfile.name} product.taskdefs.dir
+productTest.dir product expect.zip product.dir
+productTest.output.dir product-test-output CREATE product.dir
+productTest.expect.zip NONE expect.zip productTest.dir
+productTest.expect.dir expect ajx/bean/output/out.txt productTest.dir productTest.expect.zip
+productTest.expect.bat.dir bat telecom.ajdb.txt productTest.expect.dir
+</echo>
+ </target> <!-- about.init.product -->
diff --git a/tests/product/product-test.xml b/tests/product/product-test.xml
new file mode 100644
index 000000000..c5f1146d3
--- /dev/null
+++ b/tests/product/product-test.xml
@@ -0,0 +1,293 @@
+<!-- -*- Mode: SGML; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- -->
+<!-- -->
+<!-- This file is part of the compiler and core tools for the AspectJ(tm) -->
+<!-- programming language; see http://aspectj.org -->
+<!-- -->
+<!-- The contents of this file are subject to the Mozilla Public License -->
+<!-- Version 1.1 (the "License"); you may not use this file except in -->
+<!-- compliance with the License. You may obtain a copy of the License at -->
+<!-- either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. -->
+<!-- -->
+<!-- Software distributed under the License is distributed on an "AS IS" basis, -->
+<!-- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -->
+<!-- for the specific language governing rights and limitations under the -->
+<!-- License. -->
+<!-- -->
+<!-- The Original Code is AspectJ. -->
+<!-- -->
+<!-- The Initial Developer of the Original Code is Xerox Corporation. Portions -->
+<!-- created by Xerox Corporation are Copyright (C) 1999, 2000 Xerox Corporation. -->
+<!-- All Rights Reserved. -->
+
+<!-- ============================================================================== -->
+<!-- To do a build, invoke build/bin/ant.[sh|bat] after defining JDKDIR. -->
+<!-- To customize properties, edit local.properties.examples as local.properties. -->
+<!-- ============================================================================== -->
+<!-- todo: non-distribution license?? -->
+
+<!-- This dtd only defines aspectj_initProduct, unlike ../../build.dtd -->
+<!DOCTYPE build SYSTEM "build.dtd">
+
+<!-- This only runs from ../../test-product.xml b/c it uses comparefiles w/o defining it -->
+<project name="product-test" default="test" basedir=".">
+
+ &aspectj_initProduct;
+
+ <!-- ========================================================================== -->
+ <!-- Init -->
+ <!-- ========================================================================== -->
+ <target name="init" depends="init.product,productTest.expect.dir"
+ description="init values - launch from install dir or set product.dir variable">
+ <echo message="init product-test.xml"/>
+ <property name="productTest.classes.dir"
+ location="${productTest.output.dir}/classes"/>
+ <property name="script.expect.dir"
+ location="${productTest.expect.dir}/bat"/>
+ <!-- use .bat scripts if available, shell scripts otherwise -->
+ <property name="scriptExtension" value=""/>
+ <available file="${product.bin.dir}/ajc.bat"
+ property="scriptExtension"
+ value=".bat" />
+ </target>
+
+ <!-- ========================================================================== -->
+ <!-- Clean everything in created dirs -->
+ <!-- ========================================================================== -->
+
+ <target name="clean" depends="init"
+ description="delete test working dirs (does not clean results)">
+ <mkdir dir="${productTest.output.dir}"/>
+ <delete dir="${productTest.output.dir}"/>
+ <mkdir dir="${productTest.output.dir}"/>
+ </target>
+
+ <!-- ========================================================================== -->
+ <!-- Run product tests -->
+ <!-- ========================================================================== -->
+ <target name="test"
+ depends="test.examples.buildscript,test.script.telecom,test.tools.sources"
+ description="run available tests"/>
+
+ <target name="test.script.telecom"
+ depends="init,productTest.dir,product.dir,
+ productTest.expect.bat.dir,productTest.output.dir"
+ description="ajc/ajdoc/java/ajdb telecom example using bat scripts">
+ <!-- antcall target="clean" / -->
+
+ <!-- todo: execon not working - will fail outside windows -->
+ <echo message="### file product-test.xml target test.script.telecom"/>
+ <!-- ajc -->
+ <property name="ajc.out" location="${productTest.output.dir}/telecom.ajc.txt"/>
+ <property name="expect.ajc.out" location="${script.expect.dir}/telecom.ajc.txt"/>
+ <exec dir="${product.examples.dir}"
+ executable="${product.bin.dir}/ajc${scriptExtension}"
+ output="${ajc.out}">
+ <arg value="-d"/>
+ <arg value="${productTest.classes.dir}"/>
+ <arg value="-argfile"/>
+ <arg value="telecom/billing.lst"/>
+ <arg value="-classpath"/>
+ <arg value="${product.rt.jar}"/>
+ </exec>
+ <!-- todo this is always failing... -->
+ <comparefiles lhsFile="${ajc.out}"
+ rhsFile="${expect.ajc.out}"/>
+
+ <!-- ajdoc -->
+ <property name="expect.ajdoc.out" location="${script.expect.dir}/telecom.ajdoc.txt"/>
+ <property name="ajdoc.out" location="${productTest.output.dir}/telecom.ajdoc.txt"/>
+ <exec dir="${product.examples.dir}"
+ executable="${product.bin.dir}/ajdoc${scriptExtension}"
+ output="${ajdoc.out}">
+ <arg value="-d"/>
+ <arg value="${productTest.classes.dir}"/> <!-- todo dump html in classes dir for now -->
+ <arg value="-argfile"/>
+ <arg value="telecom/billing.lst"/>
+ <arg value="-classpath"/>
+ <arg value="${product.rt.jar}"/>
+ <arg value="telecom"/> <!-- todo (reconsider) had to add packagename -->
+ </exec>
+ <comparefiles lhsFile="${ajdoc.out}"
+ rhsFile="${expect.ajdoc.out}"/>
+
+ <!-- java -->
+ <property name="java.out" location="${productTest.output.dir}/telecom.java.txt"/>
+ <property name="expect.java.out" location="${script.expect.dir}/telecom.java.txt"/>
+ <java classname="telecom.BillingSimulation"
+ output="${java.out}">
+ <classpath>
+ <pathelement location="${productTest.classes.dir}"/>
+ <pathelement location="${product.rt.jar}"/>
+ </classpath>
+ </java>
+ <comparefiles lhsFile="${java.out}"
+ rhsFile="${expect.java.out}"/>
+
+ <!-- ajdb -->
+ <echo file="${product.examples.dir}/ajdb.in">exit
+ </echo>
+ <property name="ajdb.out" location="${productTest.output.dir}/telecom.ajdb.txt"/>
+ <property name="expect.ajdb.out" location="${script.expect.dir}/telecom.ajdb.txt"/>
+ <exec dir="${product.examples.dir}"
+ executable="${product.bin.dir}/ajdb${scriptExtension}"
+ output="${ajdb.out}">
+ <arg value="-classpath"/>
+ <arg value="${product.rt.jar}${PS}${productTest.classes.dir}"/>
+ <arg value="&lt;"/>
+ <arg value="${product.examples.dir}/ajdb.in"/>
+ </exec>
+ <comparefiles lhsFile="${ajdb.out}"
+ rhsFile="${expect.ajdb.out}"/>
+ </target>
+
+ <!-- todo: also depends on jdk.tools.jar -->
+ <!-- todo: ignore as duplicating examples/build.xml -->
+ <target name="test.examples.antscript"
+ depends="init,productTest.dir,product.dir,
+ product.taskdefs.jar,product.rt.jar,
+ product.tools.jar"
+ description="compile/doc/run introduction example using ant taskdefs by delegation to ant-example.xml">
+ <echo message="### file product-test.xml target test.examples.antscript"/>
+ <ant antfile="${productTest.dir}/ant-example.xml"
+ dir="${product.examples.dir}"
+ output="${productTest.output.dir}/ant-example.ant.txt">
+ <property name="PS"
+ value="${path.separator}"/>
+ <property name="product.dir"
+ value="${product.dir}"/>
+ <property name="jdk.tools.jar"
+ location="${jdk.tools.jar}"/>
+ <property name="jdk.dir"
+ location="${jdk.dir}"/>
+ </ant>
+ </target>
+
+ <target name="test.examples.buildscript"
+ depends="init,product.dir,
+ product.taskdefs.jar,product.rt.jar,
+ product.tools.jar"
+ description="compile/doc/run examples using build.xml script distributed with examples">
+ <echo message="### file product-test.xml target test.examples.buildscript"/>
+ <copy file="${product.taskdefs.jar}"
+ todir="${product.lib.dir}" />
+
+ <!-- XXX if docs come after ajc, then _always_ get OutOfMemoryError... -->
+ <antcall target="antcall.test.examples.buildscript">
+ <param name="example.target" value="docs" />
+ </antcall>
+
+ <antcall target="antcall.test.examples.buildscript.norun">
+ <param name="example.target" value="spacewar" />
+ </antcall>
+
+ <antcall target="antcall.test.examples.buildscript">
+ <param name="example.target" value="nonGui" />
+ </antcall>
+
+ <!-- OutOfMemory if including all
+ <antcall target="antcall.test.examples.buildscript.norun">
+ <param name="example.target" value="all" />
+ </antcall>
+ -->
+ </target>
+
+ <target name="antcall.test.examples.buildscript.norun"
+ depends="init,product.dir,
+ product.taskdefs.jar,product.rt.jar,
+ product.tools.jar"
+ description="invoke ant {example.target} for test.examples.buildscript (with norun)">
+ <echo message="### ${example.target} (norun)"/>
+ <mkdir dir="${productTest.output.dir}" />
+ <ant antfile="${product.examples.dir}/build.xml"
+ target="${example.target}"
+ dir="${product.examples.dir}"
+ output="${productTest.output.dir}/example-build.${example.target}.txt" >
+ <property name="JAVA_HOME"
+ location="${jdk.dir}"/>
+ <property name="norun"
+ location="skipRunning"/>
+ </ant>
+ </target>
+
+ <target name="antcall.test.examples.buildscript"
+ depends="init,product.dir,
+ product.taskdefs.jar,product.rt.jar,
+ product.tools.jar"
+ description="invoke ant {example.target} for test.examples.buildscript (without norun)">
+ <echo message="### ${example.target} (run)"/>
+ <mkdir dir="${productTest.output.dir}" />
+ <ant antfile="${product.examples.dir}/build.xml"
+ target="${example.target}"
+ dir="${product.examples.dir}"
+ output="${productTest.output.dir}/example-build.${example.target}.txt" >
+ <property name="JAVA_HOME"
+ location="${jdk.dir}"/>
+ </ant>
+ </target>
+
+
+ <!-- see also more recent devenv/dev/bin/aj/testToolsSrc.sh -->
+ <target name="test.tools.sources"
+ depends="init,product.tools.jar,product.src.dir"
+ description="test source dist using ajc, ajdoc (todo remove - see ant-example)">
+
+ <property name="tools.source.out"
+ location="${productTest.output.dir}/source-tools"/>
+ <property name="test.source.classes.dir"
+ location="${productTest.output.dir}/source-tools"/>
+ <property name="source-tools.jar"
+ location="${productTest.output.dir}/source-tools.jar"/>
+
+ <mkdir dir="${test.source.classes.dir}"/>
+ <delete dir="${test.source.classes.dir}"/>
+ <mkdir dir="${test.source.classes.dir}"/>
+
+ <!-- todo validate product builds by comparison or invocation -->
+ <antcall target="build.source.call">
+ <param name="target.name" value="runtime" />
+ </antcall>
+ <antcall target="build.source.call">
+ <param name="target.name" value="compiler" />
+ </antcall>
+ <antcall target="build.source.call">
+ <param name="target.name" value="ajde" />
+ </antcall>
+ <antcall target="build.source.call">
+ <param name="target.name" value="ajbrowser" />
+ </antcall>
+ <antcall target="build.source.call">
+ <param name="target.name" value="ajdoc" />
+ </antcall>
+
+ <echo message="" file="${tools.source.out}.empty"/>
+ <!-- comparefiles lhsFile="${tools.source.out}"
+ rhsFile="${tools.source.out}.empty" / -->
+
+ <jar jarfile="${source-tools.jar}"
+ basedir="${test.source.classes.dir}"/>
+ <comparefiles lhsFile="${product.tools.jar}"
+ rhsFile="${source-tools.jar}" />
+
+ <delete dir="${test.source.classes.dir}"/>
+ </target>
+
+ <target name="build.source.call" >
+ <echo message="# building (source) using ajc${scriptExtension} @${product.src.dir}/${target.name}.lst"/>
+ <mkdir dir="${test.source.classes.dir}/${target.name}"/>
+ <exec dir="${product.src.dir}"
+ executable="${product.bin.dir}/ajc${scriptExtension}"
+ output="${tools.source.out}.${target.name}.txt">
+ <arg value="-d"/>
+ <arg value="${test.source.classes.dir}/${target.name}"/>
+ <arg value="-classpath"/>
+ <arg value="${product.rt.jar}${PS}${jdk.tools.jar}"/> <!-- 1.3 for ajdoc -->
+ <arg value="-argfile"/>
+ <arg value="${target.name}.lst"/>
+ </exec>
+ <echo message="# START building (source) ${target.name} output"/>
+ <echo message="" file="${tools.source.out}.${target.name}.txt"/>
+ <echo message="# END building (source) ${target.name} output"/>
+ </target>
+
+</project>
+
diff --git a/tests/product/test-taskdefs.xml b/tests/product/test-taskdefs.xml
new file mode 100644
index 000000000..973d73d6a
--- /dev/null
+++ b/tests/product/test-taskdefs.xml
@@ -0,0 +1,466 @@
+<!-- -*- Mode: SGML; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- -->
+<!-- -->
+<!-- This file is part of the compiler and core tools for the AspectJ(tm) -->
+<!-- programming language; see http://aspectj.org -->
+<!-- -->
+<!-- The contents of this file are subject to the Mozilla Public License -->
+<!-- Version 1.1 (the "License"); you may not use this file except in -->
+<!-- compliance with the License. You may obtain a copy of the License at -->
+<!-- either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. -->
+<!-- -->
+<!-- Software distributed under the License is distributed on an "AS IS" basis, -->
+<!-- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -->
+<!-- for the specific language governing rights and limitations under the -->
+<!-- License. -->
+<!-- -->
+<!-- The Original Code is AspectJ. -->
+<!-- -->
+<!-- The Initial Developer of the Original Code is Xerox Corporation. Portions -->
+<!-- created by Xerox Corporation are Copyright (C) 1999, 2000 Xerox Corporation. -->
+<!-- All Rights Reserved. -->
+
+<!-- ============================================================================== -->
+<!-- To build, define JAVA_HOME,place in examples/ and run from examples/.. -->
+<!-- ============================================================================== -->
+<!-- todo: non-distribution license?? -->
+
+<project name="test-taskdefs" default="test">
+ <!-- ========================================================================== -->
+ <!-- Init -->
+ <!-- ========================================================================== -->
+ <target name="init"
+ description="caller must define jdk.tools.jar and product.dir or run from product.examples.dir">
+ <echo message="init test-taskdefs.xml"/>
+
+ <property name="PS" value="${path.separator}"/>
+ <property name="knownFail"
+ value=" - known failure"/>
+
+ <!-- define product.dir or run from it -->
+ <property name="product.dir"
+ location=".."/>
+
+ <!-- expected from install -->
+ <property name="ex.dir"
+ location="${product.dir}/examples"/>
+ <property name="product.examples.dir"
+ location="${ex.dir}"/>
+ <!-- created after install -->
+ <property name="test.dir"
+ location="${product.dir}/test"/>
+ <property name="expect.file"
+ location="${test.dir}/expect.out"/>
+ <property name="actual.file"
+ location="${test.dir}/actual.out"/>
+ <property name="empty.dir"
+ location="${test.dir}/emptydir"/>
+ <property name="temp.dir"
+ location="${test.dir}/temp"/>
+ <property name="classes.dir"
+ location="${test.dir}/classes"/>
+ <property name="expected.classes.dir"
+ location="${test.dir}/expectedClasses"/>
+ <property name="working.dir"
+ location="${product.dir}/workingdir"/>
+ <property name="expected.working.dir"
+ location="${test.dir}/expectedWorkingdir"/>
+ <mkdir dir="${empty.dir}"/>
+ <mkdir dir="${temp.dir}"/>
+ <mkdir dir="${classes.dir}"/>
+ <mkdir dir="${expected.classes.dir}"/>
+ <mkdir dir="${working.dir}"/>
+ <mkdir dir="${expected.working.dir}"/>
+
+ <property name="aspectj-ant.jar"
+ location="${product.dir}/lib/aspectj-ant.jar"/>
+ <property name="aspectjrt.jar"
+ location="${product.dir}/lib/aspectjrt.jar"/>
+ <property name="aspectjtools.jar"
+ location="${product.dir}/lib/aspectjtools.jar"/>
+ <!-- alltesting.jar required for comparefiles -->
+ <property name="alltesting.jar"
+ location="${product.dir}/lib/alltesting.jar"/>
+
+ <available file="${aspectj-ant.jar}"
+ property="aspectj-ant.jar.available"/>
+ <available file="${aspectjrt.jar}"
+ property="aspectjrt.jar.available"/>
+ <available file="${aspectjtools.jar}"
+ property="aspectjtools.jar.available"/>
+
+ <property name="run.classpath"
+ location="${classes.dir}${PS}${aspectjrt.jar}"/>
+ <property name="simple.run.classpath"
+ location="${product.dir}${PS}${aspectjrt.jar}"/>
+ </target>
+
+ <target name="init.taskdefs"
+ depends="init,jars.available"
+ description="initialize taskdefs without ant.home/lib" >
+ <taskdef name="ajc"
+ classname="org.aspectj.tools.ant.taskdefs.Ajc" >
+ <classpath>
+ <pathelement path="${aspectjrt.jar}"/>
+ <pathelement path="${aspectj-ant.jar}"/>
+ <pathelement path="${aspectjtools.jar}"/>
+ <pathelement path="${jdk.tools.jar}"/>
+ </classpath>
+ </taskdef>
+ <taskdef name="ajdoc"
+ classname="org.aspectj.tools.ant.taskdefs.Ajdoc" >
+ <classpath>
+ <pathelement path="${aspectjrt.jar}"/>
+ <pathelement path="${aspectj-ant.jar}"/>
+ <pathelement path="${aspectjtools.jar}"/>
+ <pathelement path="${jdk.tools.jar}"/>
+ </classpath>
+ </taskdef>
+ <taskdef name="comparefiles"
+ classname="org.aspectj.testing.taskdefs.CompareFiles">
+ <classpath> <!-- todo: setup -->
+ <pathelement path="${alltesting.jar}"/>
+ </classpath>
+ </taskdef>
+ </target>
+
+
+ <target name="jars.available"
+ depends="aspectjtools.jar.available,aspectj-ant.jar.available"/>
+
+ <target name="aspectjtools.jar.available" depends="init" unless="aspectjtools.jar.available" >
+ <fail message="expecting aspectjtools.jar at ${aspectjtools.jar}"/>
+ </target>
+ <target name="aspectj-ant.jar.available" depends="init" unless="aspectj-ant.jar.available" >
+ <fail message="expecting aspectj-ant.jar at ${aspectj-ant.jar}"/>
+ </target>
+
+ <target name="clean" depends="init"
+ description="todo clean output created by this script">
+ </target>
+
+ <target name="test" depends="test.ajc,test.ajdoc"/>
+ <target name="clear.test.dir" depends="init">
+ <mkdir dir="${test.dir}"/>
+ <delete dir="${test.dir}"/>
+ <mkdir dir="${test.dir}"/>
+ </target>
+
+ <target name="test.ajdoc" depends="init,init.taskdefs,clear.test.dir"
+ description="run variants of ajdoc taskdef on bean, other examples">
+
+ <mkdir dir="${expected.classes.dir}"/>
+ <delete quiet="on" dir="${expected.classes.dir}"/>
+ <mkdir dir="${expected.classes.dir}"/>
+ <mkdir dir="${classes.dir}"/>
+ <delete quiet="on" dir="${classes.dir}"/>
+ <mkdir dir="${classes.dir}"/>
+ <antcall target="cleanajc"/>
+
+ <echo message="## ajdoc setup classes dir" />
+ <ajdoc classpath="${aspectjrt.jar}" destdir="${expected.classes.dir}"
+ srcdir="${ex.dir}/bean" packagenames="bean"
+ argfile="${ex.dir}/bean/files.lst"
+ private="on" />
+
+ <echo message="## @testcase ajdoc same as setup" />
+ <antcall target="cleanajc"/>
+ <ajdoc classpath="${aspectjrt.jar}" destdir="${classes.dir}"
+ srcdir="${ex.dir}/bean" packagenames="bean"
+ argfile="${ex.dir}/bean/files.lst"
+ private="on" />
+ <antcall target="verifyAndCleanup.ajdoc"/>
+
+ <echo message="## @testcase ajdoc argfile only with nested classpath" />
+ <ajdoc destdir="${classes.dir}"
+ argfile="${ex.dir}/bean/files.lst"
+ private="on" >
+ <classpath> <pathelement path="${aspectjrt.jar}"/> </classpath>
+ </ajdoc>
+ <antcall target="verifyAndCleanup.ajdoc"/>
+
+<!-- omitted until fixed
+ <echo message="## @testcase ajdoc srcdir with include argument - getting fail" />
+ <ajdoc classpath="${aspectjrt.jar}" destdir="${classes.dir}"
+ srcdir="${ex.dir}/bean" includes="*.java"
+ private="on" />
+ <antcall target="verifyAndCleanup.ajdoc"/>
+
+ <echo message="## ajdoc need @testcase ajdoc nested src with kitchen sink" />
+ <echo message="## @testcase ajdoc argfile todo " />
+ <echo message="## @testcase ajdoc Vincent Massol bug" />
+ <ajdoc destdir="${classes.dir}"
+ srcdir="${ex.dir}/bean"
+ private="on" >
+ <include name="*.java"/>
+ <include name="**.java"/>
+ <classpath> <pathelement path="${aspectjrt.jar}"/> </classpath>
+ </ajdoc>
+ <antcall target="verifyAndCleanup.ajdoc"/>
+
+todo bug ajdoc taskdef not handling any includes or nested src or
+includes argument
+-->
+ <!-- todo: version bootclasspath, extdirs
+ Xporting="on" # todo: after Jim updates compiler for Xporting
+ todo: nested src n/a
+ -->
+
+ </target>
+
+ <target name="test.ajc" depends="test.ajc1"/> <!-- ,test.ajc2 -->
+ <target name="test.ajc1" depends="init,init.taskdefs,clear.test.dir"
+ description="run variants of ajc taskdef on bean, other examples">
+
+ <echo message="## setup expected working dir, classes dir, and output file" />
+ <antcall target="cleanajc"/>
+ <ajc srcdir="${ex.dir}/bean" classpath="${aspectjrt.jar}"
+ destDir="${expected.classes.dir}"
+ usejavac="yes"
+ workingdir="${expected.working.dir}"/>
+ <java classname="bean.Demo"
+ classpath="${expected.classes.dir}${PS}${aspectjrt.jar}"
+ dir="${ex.dir}" fork="yes"
+ output="${expect.file}"/>
+
+ <echo message="## @testcase ajc simple srcdir example" />
+ <antcall target="cleanajc"/>
+ <ajc srcdir="${ex.dir}/bean" classpath="${aspectjrt.jar}" />
+
+ <!-- todo: fix b/c returning 1 as result -->
+ <echo message="## simple.run.classpath: ${simple.run.classpath} - getting fail" />
+ <java classname="bean.Demo"
+ classpath="${simple.run.classpath}"
+ dir="${ex.dir}" fork="yes"
+ output="${actual.file}"/>
+ <antcall target="cleanajc"/>
+
+ <echo message="## @testcase ajc srcdir with include arg and (unverified) -source 1.4 and -XaddSafePrefix${knownFail}" />
+ <ajc srcdir="${ex.dir}/bean" classpath="${aspectjrt.jar}" includes="*.java"/>
+ <java classname="bean.Demo"
+ classpath="${simple.run.classpath}"
+ dir="${ex.dir}" fork="yes"
+ output="${actual.file}"/>
+ <antcall target="verifyAndCleanup.noworkingdir.noclassesdir"/>
+
+ <echo message="## @testcase ajc srcdir with include argument${knownFail}" />
+ <ajc srcdir="${ex.dir}/bean" classpath="${aspectjrt.jar}" includes="*.java"/>
+ <java classname="bean.Demo"
+ classpath="${simple.run.classpath}"
+ dir="${ex.dir}" fork="yes"
+ output="${actual.file}"/>
+ <antcall target="verifyAndCleanup.noworkingdir.noclassesdir"/>
+
+ <echo message="## @testcase ajc srcdir with destDir and working workingdir argument" />
+ <ajc srcdir="${ex.dir}/bean" classpath="${aspectjrt.jar}"
+ destDir="${classes.dir}"
+ usejavac="yes"
+ workingdir="${working.dir}"/>
+ <java classname="bean.Demo"
+ classpath="${run.classpath}"
+ dir="${ex.dir}" fork="yes"
+ output="${actual.file}"/>
+ <antcall target="verifyAndCleanup.workingdir.classesdir"/>
+
+ <echo message="## @testcase ajc simple srcdir with nested include and nested classpath${knownFail}" />
+ <ajc srcdir="${ex.dir}/bean">
+ <include name="**.java"/>
+ <classpath> <pathelement path="${aspectjrt.jar}"/> </classpath>
+ </ajc>
+ <java classname="bean.Demo"
+ classpath="${simple.run.classpath}"
+ dir="${ex.dir}" fork="yes"
+ output="${actual.file}"/>
+ <antcall target="verifyAndCleanup.noworkingdir.noclassesdir"/>
+
+ <echo message="## @testcase ajc nested src with kitchen sink" />
+ <antcall target="cleanajc"/>
+ <ajc
+ destDir="${classes.dir}"
+ workingdir="${working.dir}"
+ usejavac="on"
+ preprocess="no"
+ verbose="on"
+ deprecation="on"
+ optimize="on"
+ encoding="encodingIgnored"
+ target="targetIgnored"
+ depend="dependIgnored"
+ includeantruntime="includeantruntimeIgnored"
+ includejavaruntime="includejavaruntimeIgnored"
+ failonerror="on"
+
+ nocomments="on"
+ nosymbols="on"
+ emacssym="on"
+ strict="on"
+ >
+ <src path="${ex.dir}/bean"/>
+ <include name="**.java"/>
+ <classpath> <pathelement path="${aspectjrt.jar}"/> </classpath>
+ </ajc>
+ <java classname="bean.Demo"
+ classpath="${run.classpath}"
+ dir="${ex.dir}" fork="yes"
+ output="${actual.file}"/>
+ <antcall target="verifyAndCleanup.workingdir.classesdir"/>
+
+ <echo message="## @testcase ajc srcdir in preprocess mode" />
+ <ajc srcdir="${ex.dir}/bean" classpath="${aspectjrt.jar}"
+ lenient="on"
+ workingdir="${working.dir}" usejavac="on" preprocess="yes"/>
+ <antcall target="verifyAndCleanup.workingdir.noclassesdir.nooutput"/>
+
+ <echo message="## @testcase ajc argfile in preprocess mode" />
+ <ajc argfile="${ex.dir}/bean/files.lst" classpath="${aspectjrt.jar}"
+ workingdir="${working.dir}" usejavac="on" preprocess="yes"/>
+ <antcall target="verifyAndCleanup.workingdir.noclassesdir.nooutput"/>
+
+ <echo message="## @testcase ajc argfile in normal mode" />
+ <ajc argfile="${ex.dir}/bean/files.lst" classpath="${aspectjrt.jar}"
+ destdir="${classes.dir}" usejavac="off" preprocess="no" verbose="yes"/>
+ <java classname="bean.Demo"
+ classpath="${run.classpath}"
+ dir="${ex.dir}" fork="yes"
+ output="${actual.file}"/>
+ <antcall target="verifyAndCleanup.noworkingdir.classesdir"/>
+
+ <echo message="## @testcase ajc multiple argfile todo restore" />
+ <ajc argfiles="${ex.dir}/bean/files.lst,${ex.dir}/introduction/files.lst"
+ classpath="${aspectjrt.jar}" destdir="${classes.dir}" >
+ </ajc>
+
+ <java classname="bean.Demo"
+ classpath="${run.classpath}"
+ dir="${ex.dir}" fork="yes"
+ output="${actual.file}"/>
+ <copy todir="${expected.classes.dir}" >
+ <fileset dir="${classes.dir}" includes="**.class" />
+ </copy>
+ <antcall target="cleanajc"/> <!-- too many classes -->
+ </target>
+
+ <target name="test.ajc2" depends="init,init.taskdefs"
+ description="run variants of ajc taskdef on bean, other examples">
+ <!-- failing here -->
+ <echo message="## @testcase ajc Vincent Massol bug" />
+ <ajc classpath="${aspectjrt.jar}" fork="yes"
+ workingdir="${working.dir}" > <!-- preprocess="yes" -->
+ <src path="${ex.dir}/bean"/>
+ <src path="${ex.dir}/introduction"/>
+ <include name="*.java"/>
+ <include name="**.java"/>
+ </ajc>
+ <antcall target="verifyAndCleanup.workingdir.noclassesdir.nooutput"/>
+
+ <echo message="## @testcase ajc warning when no source files specified but have srcdir # " />
+ <ajc srcdir="${ex.dir}/bean" classpath="${aspectjrt.jar}" />
+ <antcall target="cleanajc"/>
+
+ <!-- @testcase ajc -preprocess javac is failing todo -->
+ <echo message="## @testcase ajc -preprocess srcdir no destDir, post-javac compile (-preprocess ignored) # " />
+ <ajc srcdir="${ex.dir}/bean" includes="**.java" classpath="${aspectjrt.jar}"
+ usejavac="no" preprocess="yes" workingdir="${working.dir}"/>
+
+ <echo message="## @testcase ajc -preprocess list ${working.dir}" />
+ <comparefiles lhsFile="${empty.dir}" rhsFile="${working.dir}"/>
+ <echo message="## @testcase ajc -preprocess before comparefiles ${working.dir}" />
+ <comparefiles lhsFile="${expected.working.dir}" rhsFile="${working.dir}"/>
+ <echo message="## @testcase ajc -preprocess before delete classes.dir" />
+ <mkdir dir="${classes.dir}"/>
+ <delete quiet="on" dir="${classes.dir}"/>
+ <mkdir dir="${classes.dir}"/>
+ <mkdir dir="${classes.dir}"/>
+ <echo message="## @testcase ajc -preprocess doing javac" />
+ <!-- todo: unable to invoke javac though .java files in working.dir -never invoked?? -->
+ <javac srcdir="${working.dir}" includes="**.java"
+ destdir="${classes.dir}" verbose="on"
+ classpath="${aspectjrt.jar}" />
+ <echo message="## @testcase ajc -preprocess after javac, list classes" />
+ <comparefiles lhsFile="${empty.dir}" rhsFile="${classes.dir}"/>
+ <echo message="## @testcase ajc -preprocess after javac, compare classes" />
+ <comparefiles lhsFile="${expected.classes.dir}" rhsFile="${classes.dir}"/>
+
+ <echo message="## @testcase ajc -preprocess after javac, run classes" />
+ <java classname="bean.Demo"
+ classpath="${run.classpath}"
+ dir="${ex.dir}" fork="yes"
+ output="${actual.file}"/>
+ <antcall target="verifyAndCleanup.workingdir.classesdir"/>
+
+ <!-- todo: version bootclasspath, extdirs
+ Xporting="on" # todo: after Jim updates compiler for Xporting
+ -->
+
+ </target>
+
+ <target name="verifyAndCleanup.ajdoc" depends="verifyAndCleanup.noworkingdir.classesdir.nooutput" />
+
+ <target name="verifyAndCleanup.noworkingdir.noclassesdir">
+ <antcall target="expectfile"/>
+ <antcall target="noworkingdir"/>
+ <antcall target="noclassesdir"/>
+ <antcall target="cleanajc"/>
+ </target>
+
+ <target name="verifyAndCleanup.workingdir.noclassesdir">
+ <antcall target="expectfile"/>
+ <antcall target="workingdir"/>
+ <antcall target="noclassesdir"/>
+ <antcall target="cleanajc"/>
+ </target>
+
+ <target name="verifyAndCleanup.workingdir.noclassesdir.nooutput">
+ <antcall target="workingdir"/>
+ <antcall target="noclassesdir"/>
+ <antcall target="cleanajc"/>
+ </target>
+
+ <target name="verifyAndCleanup.noworkingdir.classesdir.nooutput">
+ <antcall target="noworkingdir"/>
+ <antcall target="classesdir"/>
+ <antcall target="cleanajc"/>
+ </target>
+
+ <target name="verifyAndCleanup.noworkingdir.classesdir" >
+ <antcall target="noworkingdir"/>
+ <antcall target="classesdir"/>
+ <antcall target="expectfile"/>
+ <antcall target="cleanajc"/>
+ </target>
+
+ <target name="verifyAndCleanup.workingdir.classesdir">
+ <antcall target="expectfile"/>
+ <antcall target="workingdir"/>
+ <antcall target="classesdir"/>
+ <antcall target="cleanajc"/>
+ </target>
+
+ <target name="expectfile" depends="init">
+ <comparefiles lhsFile="${expect.file}" rhsFile="${actual.file}"/>
+ <delete quiet="on" file="${actual.file}"/>
+ </target>
+ <target name="noworkingdir" depends="init">
+ <comparefiles lhsFile="${empty.dir}" rhsFile="${working.dir}"/>
+ </target>
+ <target name="workingdir" depends="init">
+ <comparefiles lhsFile="${expected.working.dir}" rhsFile="${working.dir}"/>
+ </target>
+ <target name="noclassesdir" depends="init">
+ <comparefiles lhsFile="${empty.dir}" rhsFile="${classes.dir}"/>
+ </target>
+ <target name="classesdir" depends="init">
+ <comparefiles lhsFile="${expected.classes.dir}" rhsFile="${classes.dir}"/>
+ </target>
+
+ <target name="cleanajc" depends="init">
+ <mkdir dir="${classes.dir}"/>
+ <delete quiet="on" dir="${classes.dir}"/>
+ <mkdir dir="${classes.dir}"/>
+ <mkdir dir="${working.dir}"/>
+ <delete quiet="on" dir="${working.dir}"/>
+ <mkdir dir="${working.dir}"/>
+ <delete quiet="on" >
+ <fileset dir="${product.examples.dir}" includes="**.class,**.ajesym"/>
+ </delete>
+ </target>
+</project>
diff --git a/tests/product/testScripts/ajcCommandLineTest.sh b/tests/product/testScripts/ajcCommandLineTest.sh
new file mode 100644
index 000000000..86cd8d862
--- /dev/null
+++ b/tests/product/testScripts/ajcCommandLineTest.sh
@@ -0,0 +1,179 @@
+#!/bin/sh
+# info: test ajc command line
+# syntax: $0 (define JDKDIR and AJ_BASE)
+# @testcase PR#655 ajc errors when output dir is bad
+# @process-test ajc acjCommandLineTest.sh # test PR#655 ajc errors when output dir is bad
+
+[ -n "$DEBUG" ] && set -vx
+
+errMssg() {
+ [ -n "$1" ] && echo "## $0 $1"
+ [ -n "$2" ] && exit "$2"
+}
+
+generateMinimalSource() { # todo: share with other tests
+ mkdir -p src src/pack
+ genSource "" Main "Main pack.Main" > src/Main.java
+ genSource pack Main "pack.Main" > src/pack/Main.java
+
+ cat > src/minimal_pack.Main_0.lst <<EOF
+pack/Main.java
+EOF
+ cat > src/minimal_Main_1.lst <<EOF
+Main.java
+pack/Main.java
+EOF
+ cat > src/pack/minimal_Main_2.lst <<EOF
+../Main.java
+Main.java
+EOF
+ cat > src/pack/minimal_Main_3.lst <<EOF
+../*.java
+*.java
+EOF
+ cat > minimal_Main_4.lst <<EOF
+@src/minimal_Main_1.lst
+EOF
+ cat > src/minimal_Main_5.lst <<EOF
+@minimal_Main_1.lst
+EOF
+ cat > src/minimal_Main_6.lst <<EOF
+@../src/minimal_Main_1.lst
+EOF
+ cat > src/minimal_Main_7.lst <<EOF
+// starting comment
+Main.java // end of line comment
+// middle comment
+pack/Main.java
+// end comment
+EOF
+ cat > src/minimal_Main_8.lst <<EOF
+*.java
+pack/*.java
+EOF
+ echo "minimal"
+}
+
+genSource() { # todo share with other tests
+ package="$1"
+ class="$2"
+ refs="$3"
+ if [ -z "$package" ] ; then
+ name="$class"
+ else
+ echo "package $package;"
+ name="$package.$class"
+ fi
+cat<<EOF
+public class $class {
+ public static final String NAME = "$name";
+ public static String[] ARGS = new String[]
+EOF
+ sep='{'
+ for i in $refs ; do
+ echo " $sep ${i}.NAME"
+ sep=','
+ done
+cat<<EOF
+ };
+ public static void main (String[] args) {
+ util.Util.signal(NAME + ".main",ARGS);
+ }
+} // class $class
+EOF
+}
+
+getMain() {
+ [ -n "$1" ] && echo "$1" | sed 's|.*_\([^_][^_]*\)_.*|\1|'
+}
+
+compile() {
+ ccdir="${globalClasses:-classes}"
+ [ -d "$ccdir" ] || mkdir "$ccdir"
+ rm -rf "$ccdir"/*
+ $JDKDIR/bin/java -classpath "$toolsjar" org.aspectj.tools.ajc.Main \
+ -d "$ccdir" -classpath "$utiljar${PS}$rtjar" "${@}"
+}
+
+run() {
+ $JDKDIR/bin/java -classpath "$utiljar${PS}$rtjar${PS}$ccdir" "${@}"
+}
+
+testAjc() {
+ argfile="$1"
+ shift
+ [ -n "$VERBOSE" ] && echo "# $1"
+ [ -f "$argfile" ] || errMssg "testAjc argfile: $1" 3
+ main=`getMain "$argfile"`
+ [ -n "$main" ] || errMssg "testAjc no main for argfile: $argfile" 3
+ compile -argfile "$argfile" "${@}" || errMssg "testAjc compile 1 fail: $argfile" 3
+ run "$main" || errMssg "testAjc run 1 fail: $argfile" 3
+ compile @"$argfile" "${@}" || errMssg "testAjc compile 2 fail: $argfile" 3
+ run "$main" || errMssg "testAjc run 2 fail: $argfile" 3
+}
+
+createUtilJar() {
+ mkdir util
+ cat > util/Util.java <<EOF
+package util;
+public class Util {
+ public static void signal(String label, String[] names) {
+ boolean printing = $printing;
+ if (printing) {
+ StringBuffer sb = new StringBuffer();
+ sb.append(label);
+ sb.append("=[");
+ for (int i = 0; i < names.length; i++) {
+ if (i > 0) sb.append(", ");
+ sb.append(names[i]);
+ }
+ sb.append("]");
+ System.out.println(sb.toString());
+ }
+ }
+}
+EOF
+compile util/Util.java
+"$JDKDIR/bin/jar" cf "$utiljar" -C classes .
+rm -rf util
+}
+
+getArgFiles() {
+ name="$1"
+ find . -name "$1"\*.lst | sed 's|./||'
+}
+
+echoSetup() {
+cat<<EOF
+##### setup for $0
+ JDKDIR: $JDKDIR
+ AJ_BASE: $AJ_BASE
+ uname -a: `uname -a`
+EOF
+}
+
+############################################################## execution
+printing=true # must be true or false
+JDKDIR="${JDKDIR:-c:/home/apps/jdk13}"
+AJ_BASE="${AJ_BASE:-c:/home/wes/aj/aj-dist/tools}"
+[ -d "$JDKDIR" ] || errMssg "require JDKDIR=$JDKDIR" 3
+[ -d "$AJ_BASE" ] || errMssg "require AJ_BASE=$AJ_BASE" 3
+toolsjar="$AJ_BASE/lib/aspectjtools.jar"
+rtjar="$AJ_BASE/lib/aspectjrt.jar"
+utiljar="$AJ_BASE/lib/argfilesUtil.jar"
+[ -f "$toolsjar" ] || errMssg "require toolsjar=$toolsjar" 3
+[ -f "$rtjar" ] || errMssg "require rtjar=$rtjar" 3
+[ -f "$utiljar" ] || createUtilJar
+echoSetup
+
+d=temp`basename $0`
+[ -d $d ] && rm -rf $d
+mkdir $d && cd $d
+export globalClasses='bad dir '
+name=`generateMinimalSource`
+for i in `getArgFiles "$name"` ; do
+ testAjc "$i" # expecting CE, not stack trace
+done
+
+echo "tests passed if no compiler failures, only output"
+
diff --git a/tests/product/testScripts/ajdocTests.sh b/tests/product/testScripts/ajdocTests.sh
new file mode 100644
index 000000000..7c664ad74
--- /dev/null
+++ b/tests/product/testScripts/ajdocTests.sh
@@ -0,0 +1,148 @@
+#!/bin/sh
+# info: test ajc command line
+# syntax: $0 (define JDKDIR and AJ_BASE)
+# @testcase PR#655 ajc errors when output dir is bad
+# @process-test ajdoc ajdocTests.sh # tests for PR628, PR688, PR711
+
+[ -n "$DEBUG" ] && set -vx
+
+errMssg() {
+ [ -n "$1" ] && echo "## $0 $1"
+ [ -n "$2" ] && exit "$2"
+}
+
+runAjdoc() {
+
+ ccdir="${globalClasses:-classes}"
+ [ -d "$ccdir" ] || mkdir "$ccdir"
+ rm -rf "$ccdir"/*
+ #export CLASSPATH="$jdktoolsjar"
+ #$JDKDIR/bin/java -jar c:/home/wes/aj/aj-build-modules/jars/ajdoc.jar \
+ # -d "$ccdir" -classpath "$rtjar" "${@}"
+ $JDKDIR/bin/java -classpath "$jdktoolsjar${PS}$toolsjar" org.aspectj.tools.ajdoc.Main \
+ -d "$ccdir" -classpath "$rtjar" "${@}"
+}
+
+
+declareWarningDoc() {
+## test of declare warnings - which are not documented but should be?
+echo "## warning - simple declare warning currently causes compiler failure"
+cat>DeclareWarningDoc.java<<EOF
+
+import java.io.PrintStream;
+
+ /** class javadoc */
+public class DeclareWarningDoc {
+ /** method javadoc */
+ public static void main (String[] args) {
+ System.out.println("here");
+ }
+}
+
+/** javadoc for aspect */
+aspect Warnings {
+ /** javadoc for declared warning - call inside method*/
+ declare warning :
+ call(void PrintStream.println(String))
+ : "use logger";
+
+ /** javadoc for declared warning - method execution */
+ declare warning :
+ execution(static void main(String[]))
+ : "using main";
+}
+EOF
+
+runAjdoc -private DeclareWarningDoc.java
+
+}
+pr688() {
+
+## todo test cases for
+# PR#628 - docs for method declared on target
+# PR#682 - fix ant should fail on compiler error (verified by inspection)
+
+cat>AjdocTest.java<<EOF
+
+/**
+ * @testcase PR#688 bad links cause ajdoc exceptions
+ * <ul>
+ * <li>link: {@link Aspect#ok()}</li>
+ * <li>link: {@link C#ok()}</li>
+ * <li>link: {@link C#bad}</li>
+ * <li>link: {@link Aspect#bad()} // fails iff ()</li>
+ * <li>link: {@link Aspect#bad}</li>
+ * </ul>
+ * @see Aspect#bad
+ * @see C#bad
+ * @see Aspect#ok()
+ * @see C#ok()
+ */
+public interface AjdocTest { }
+aspect Aspect { void ok() {} }
+class C { void ok() {} }
+
+EOF
+
+ runAjdoc -private AjdocTest.java
+}
+
+pr628() { ## PR#628 - also test case for PR#710, PR#711, PR#712
+ cat>AjdocTest.java<<EOF
+
+/** Test class comment */
+class Test { /* int i comment */ int i;}
+/** aspectj AjdocTest comment */
+public aspect AjdocTest { /** AjdocTest.ok() comment */ void Test.ok() {} }
+/** aspectj AnotherAspect comment */
+aspect AnotherAspect { /** ok() comment */ void ok() {} }
+/** class AnotherClass comment */
+class AnotherClass { /** aok() comment */ void aok() {} }
+
+
+EOF
+
+runAjdoc -private AjdocTest.java
+}
+
+## todo test cases for
+# PR#682 - fix ant should fail on compiler error (verified by inspection)
+
+
+############################################################## execution
+JDKDIR="${JDKDIR:-c:/home/apps/jdk13}"
+AJ_BASE="${AJ_BASE:-c:/home/wes/aj/aj-dist/tools}"
+[ -d "$JDKDIR" ] || errMssg "require JDKDIR=$JDKDIR" 3
+[ -d "$AJ_BASE" ] || errMssg "require AJ_BASE=$AJ_BASE" 3
+toolsjar="$AJ_BASE/lib/aspectjtools.jar"
+jdktoolsjar="$JDKDIR/lib/tools.jar"
+rtjar="$AJ_BASE/lib/aspectjrt.jar"
+[ -f "$toolsjar" ] || errMssg "require toolsjar=$toolsjar" 3
+[ -f "$rtjar" ] || errMssg "require rtjar=$rtjar" 3
+
+curdir=`pwd`
+d=temp`basename "$0" .sh`688
+[ -d $d ] && rm -rf $d
+mkdir $d && cd $d
+pr688
+cd "$curdir"
+
+
+d=temp`basename "$0" .sh`628
+[ -d $d ] && rm -rf $d
+mkdir $d && cd $d
+pr628
+cd "$curdir"
+
+echo "####### Warnings not documented - RFE"
+d=temp`basename "$0" .sh`declareWarningDoc
+[ -d $d ] && rm -rf $d
+mkdir $d && cd $d
+declareWarningDoc
+cd "$curdir"
+
+
+echo "####### PR#711 Expecting error message, not exception"
+runAjdoc -d missingDir -private AjdocTest.java
+
+# todo: clean up/evaluate
diff --git a/tests/product/testScripts/argfiles.sh b/tests/product/testScripts/argfiles.sh
new file mode 100644
index 000000000..5c093a45a
--- /dev/null
+++ b/tests/product/testScripts/argfiles.sh
@@ -0,0 +1,301 @@
+#!/bin/sh
+# info: test -argfile and @ variants
+# syntax: $0 (define JDKDIR and AJBASE)
+# @process-test ajc argfiles.sh # test -argfile and @ variants
+
+[ -n "$DEBUG" ] && set -vx
+
+errMssg() {
+ [ -n "$1" ] && echo "## $0 $1"
+ [ -n "$2" ] && exit "$2"
+}
+
+## @testcase (support) NPE with -argfile foo.lst with "*.java"
+testcaseDesign() {
+cat<<EOF
+## input variants
+command line: [ [-argfile | @] X <fileRef>{lst} ]...
+fileRef: [[local | relative | absolute] X [DOS|Unix|Mac]]
+file line: [ option | [@<fileRef>{lst} | <fileRef>{java|aj}] ]
+option: ajc options
+refLocality: [cwd | argfile]
+
+## white box
+- @, -argfile delegate to same file-creation method
+- direct locality matters: null used for for locals and..
+- indirect locality matters: referent varies
+
+## design
+-- structure
+- invocation
+ - could set up as unit tests of ConfigParser.java
+ - if so, have also to test delivery to ajc? e.g., do package names
+ get calculated correctly under different path variants?
+ Probably not an issue now, but perhaps later when source-path
+ searching is enabled.
+ - could invoke ajc.Main programmatically - can ajc be run repeatedly?
+ -> might be easier/safer to script, uncover [bash, DOS,...] shell quirks?
+-- test case variants
+- command-line
+ - test options
+ - ajc
+ - esp. multi-flag (-source 1.4) - separate lines?
+ - VM/Javac?
+ - @, -argfile is independent
+ - test 0, 1, 3 on same line, interspersed
+ - error: @java file, unflagged arg file
+- fileRef depends on locality:
+ - parm file: CWD, relative-up, relative down-up, absolute, wrong \/:
+ - relative and absolute traversing through directories with
+ spaces in them (not in package-named directories)
+ - file line: same, with * variants
+ - * variants: [*.java | *.aj] [ empty | 1 | n>1 ]
+- fileRef also depends on indirection path:
+ - add traversal cases
+ - 1-2 levels of indirection
+- need to think about whether indirection depends on locality reference
+ i.e., whether 1-2 levels of indirection need to be through
+ all locality types (CWD, relative...)
+- basic argfile
+ - options
+ - files
+ - @ref
+ - comments
+ - empty lines
+ - *.java, *.aj references - re
+
+## implementation
+- Source tree
+ - minimal, star, maximal: all need each other to compile
+ - some in default package, others in named packages
+ - some do not share the same source base (or file system?)
+ - files:
+ Minimal:
+ src/
+ Main.java
+ pack/Main.java
+ Star:
+ star/
+ Main.java
+ empty/
+ many/One.java
+ many/Two.java
+
+ Maximal:
+ src1/
+ Src1DefaultMain.java
+ pack1/Src1Pack1Main.java
+ pack2/Src1Pack2Main.java
+ src2/
+ Src2DefaultMain.java
+ pack1/Src2Pack1Main.java
+ pack2/Src2Pack2Main.java
+
+-
+
+EOF
+}
+
+generateCurrentSource() {
+ genSource "" Main "Main SomeClass" > Main.java
+ genSource "" SomeClass "Main SomeClass" > SomeClass.java
+
+ cat > current_Main_0.lst <<EOF
+*.java
+EOF
+ cat > current_SomeClass_0.lst <<EOF
+*.java
+EOF
+ echo "current"
+}
+
+generateMinimalSource() {
+ mkdir -p src src/pack
+ genSource "" Main "Main pack.Main" > src/Main.java
+ genSource pack Main "pack.Main" > src/pack/Main.java
+
+ cat > src/minimal_pack.Main_0.lst <<EOF
+pack/Main.java
+EOF
+ cat > src/minimal_Main_1.lst <<EOF
+Main.java
+pack/Main.java
+EOF
+ cat > src/pack/minimal_Main_2.lst <<EOF
+../Main.java
+Main.java
+EOF
+ cat > src/pack/minimal_Main_3.lst <<EOF
+../*.java
+*.java
+EOF
+ cat > minimal_Main_4.lst <<EOF
+@src/minimal_Main_1.lst
+EOF
+ cat > src/minimal_Main_5.lst <<EOF
+@minimal_Main_1.lst
+EOF
+ cat > src/minimal_Main_6.lst <<EOF
+@../src/minimal_Main_1.lst
+EOF
+ cat > src/minimal_Main_7.lst <<EOF
+// starting comment
+Main.java // end of line comment
+// middle comment
+pack/Main.java
+// end comment
+EOF
+ cat > src/minimal_Main_8.lst <<EOF
+*.java
+pack/*.java
+EOF
+ echo "minimal"
+}
+
+generateStarSource() {
+ echo "todo incomplete"
+ mkdir -p star star/many star/empty
+ genSource "" Main "Main many.One many.Two" > star/Main.java
+ genSource "many" Main "many.One many.Two" > star/many/One.java
+ genSource "many" Main "many.One many.Two" > star/many/Two.java
+ cat > star/star_Main_1.lst <<EOF
+*.java
+empty/*.java
+many/*.java
+EOF
+
+ mkdir src1/pack1 src1/pack2 src2/pack1 src2/pack2
+ refs="pack1.Src1Pack1Main pack2.Src1Pack2Main pack1.Src2Pack1Main pack2.Src2Pack2Main"
+ genSource "" Main "Src1Main $refs" > src1/Src1Main.java
+ genSource "" Main "Src2Main $refs" > src2/Src2Main.java
+ genSource "pack1" Main "$refs" > src1/pack1/Src1Pack1Main.java
+ genSource "pack2" Main "$refs" > src1/pack2/Src1Pack2Main.java
+ genSource "pack1" Main "$refs" > src2/pack1/Src2Pack1Main.java
+ genSource "pack2" Main "$refs" > src2/pack2/Src2Pack2Main.java
+}
+
+genSource() {
+ package="$1"
+ class="$2"
+ refs="$3"
+ if [ -z "$package" ] ; then
+ name="$class"
+ else
+ echo "package $package;"
+ name="$package.$class"
+ fi
+cat<<EOF
+public class $class {
+ public static final String NAME = "$name";
+ public static String[] ARGS = new String[]
+EOF
+ sep='{'
+ for i in $refs ; do
+ echo " $sep ${i}.NAME"
+ sep=','
+ done
+cat<<EOF
+ };
+ public static void main (String[] args) {
+ util.Util.signal(NAME + ".main",ARGS);
+ }
+} // class $class
+EOF
+}
+
+getMain() {
+ [ -n "$1" ] && echo "$1" | sed 's|.*_\([^_][^_]*\)_.*|\1|'
+}
+
+compile() {
+ [ -d classes ] || mkdir classes
+ rm -rf classes/*
+ $JDKDIR/bin/java -classpath "$toolsjar" org.aspectj.tools.ajc.Main \
+ -d classes -classpath "$utiljar${PS}$rtjar" "${@}"
+}
+
+run() {
+ $JDKDIR/bin/java -classpath "$utiljar${PS}$rtjar${PS}classes" "${@}"
+}
+
+testAjc() {
+ argfile="$1"
+ [ -n "$VERBOSE" ] && echo "# $1"
+ [ -f "$argfile" ] || errMssg "testAjc argfile: $1" 3
+ main=`getMain "$argfile"`
+ [ -n "$main" ] || errMssg "testAjc no main for argfile: $1" 3
+ compile -argfile "$argfile" || errMssg "testAjc compile 1 fail: $1" 3
+ run "$main" || errMssg "testAjc run 1 fail: $1" 3
+ compile @"$argfile" || errMssg "testAjc compile 2 fail: $1" 3
+ run "$main" || errMssg "testAjc run 2 fail: $1" 3
+}
+
+createUtilJar() {
+ mkdir util
+ cat > util/Util.java <<EOF
+package util;
+public class Util {
+ public static void signal(String label, String[] names) {
+ boolean printing = $printing;
+ if (printing) {
+ StringBuffer sb = new StringBuffer();
+ sb.append(label);
+ sb.append("=[");
+ for (int i = 0; i < names.length; i++) {
+ if (i > 0) sb.append(", ");
+ sb.append(names[i]);
+ }
+ sb.append("]");
+ System.out.println(sb.toString());
+ }
+ }
+}
+EOF
+compile util/Util.java
+"$JDKDIR/bin/jar" cf "$utiljar" -C classes .
+rm -rf util
+}
+
+getArgFiles() {
+ name="$1"
+ find . -name "$1"\*.lst | sed 's|./||'
+}
+
+echoSetup() {
+cat<<EOF
+##### setup for $0
+ JDKDIR: $JDKDIR
+ AJ_BASE: $AJ_BASE
+ uname -a: `uname -a`
+EOF
+}
+
+############################################################## execution
+printing=true # must be true or false
+JDKDIR="${JDKDIR:-c:/home/apps/jdk13}"
+AJ_BASE="${AJ_BASE:-c:/home/wes/aj/aj-dist/tools}"
+[ -d "$JDKDIR" ] || errMssg "require JDKDIR=$JDKDIR" 3
+[ -d "$AJ_BASE" ] || errMssg "require AJ_BASE=$AJ_BASE" 3
+toolsjar="$AJ_BASE/lib/aspectjtools.jar"
+rtjar="$AJ_BASE/lib/aspectjrt.jar"
+utiljar="$AJ_BASE/lib/argfilesUtil.jar"
+[ -f "$toolsjar" ] || errMssg "require toolsjar=$toolsjar" 3
+[ -f "$rtjar" ] || errMssg "require rtjar=$rtjar" 3
+[ -f "$utiljar" ] || createUtilJar
+echoSetup
+
+d=tempArgfiles
+[ -d $d ] && rm -rf $d
+mkdir $d && cd $d
+
+name=`generateCurrentSource`
+for i in `getArgFiles "$name"` ; do testAjc "$i"; done
+
+name=`generateMinimalSource`
+for i in `getArgFiles "$name"` ; do testAjc "$i"; done
+
+# re-run without src prefix..
+cd src
+for i in `getArgFiles "$name"` ; do testAjc "$i"; done
+echo "tests passed if no compiler failures, only output"
+
diff --git a/tests/product/testScripts/cmdline11/app/Main.java b/tests/product/testScripts/cmdline11/app/Main.java
new file mode 100644
index 000000000..d3020f5dc
--- /dev/null
+++ b/tests/product/testScripts/cmdline11/app/Main.java
@@ -0,0 +1,62 @@
+
+package app;
+
+import java.util.*;
+
+public class Main {
+ public static void main (String[] args) {
+ if ((null == args) || (2 > args.length)) {
+ args = new String[] { "a use case", "a user" };
+ }
+ new UseCase(args[0]).run(new User(args[1]));
+ }
+}
+
+interface Action {
+ void doAction(User user);
+}
+
+class User {
+ String name;
+ User(String name) {
+ this.name = name;
+ }
+ public String toString() { return name; }
+}
+
+class UseCase implements Runnable {
+ String name;
+ User user;
+ List actions;
+
+ UseCase(String name) {
+ this.name = name;
+ this.actions = new ArrayList();
+ }
+ public void setUser(User user) {
+ this.user = user;
+ }
+ public void run() {
+ run(user);
+ }
+ public void run(User user) {
+ List curActions = loadActions();
+ for (Iterator iter = curActions.iterator(); iter.hasNext();) {
+ ((Action) iter.next()).doAction(user);
+ }
+ }
+ public void addAction(Action action) {
+ if (null != action) {
+ actions.add(action);
+ }
+ }
+
+ public String toString() { return name; }
+
+ protected List loadActions() {
+ return actions;
+ }
+
+}
+
+
diff --git a/tests/product/testScripts/cmdline11/myprofile/MyProfile.java b/tests/product/testScripts/cmdline11/myprofile/MyProfile.java
new file mode 100644
index 000000000..b14ca583a
--- /dev/null
+++ b/tests/product/testScripts/cmdline11/myprofile/MyProfile.java
@@ -0,0 +1,13 @@
+
+package myprofile;
+
+import profile.Profile;
+
+public aspect MyProfile extends Profile {
+ protected pointcut withinSystemClasses() :
+ within(java..*) || within(javax..*) || within(com.sun..*);
+
+ /** blunt: target all method executions outside system classes */
+ protected pointcut targets() : !withinSystemClasses()
+ && execution(* *(..));
+}
diff --git a/tests/product/testScripts/cmdline11/profile/Profile.java b/tests/product/testScripts/cmdline11/profile/Profile.java
new file mode 100644
index 000000000..daa1659ca
--- /dev/null
+++ b/tests/product/testScripts/cmdline11/profile/Profile.java
@@ -0,0 +1,39 @@
+
+package profile;
+
+import org.aspectj.lang.*;
+
+/**
+ * Profile execution time of join points
+ * by making a concrete aspect which defines <tt>targets()</tt>,
+ * if not <code>register(JoinPoint)</code>
+ * and <code>signal(Object, long, long)</code>.
+ */
+public abstract aspect Profile {
+
+ /**
+ * Identify join points to profile.
+ * Those within the lexical extent of Profile
+ * or its subtypes will be excluded from profiling.
+ */
+ protected abstract pointcut targets();
+
+ Object around() : targets() && !within(Profile+) {
+ final Object key = register(thisJoinPoint);
+ final long startTime = System.currentTimeMillis();
+ try {
+ return proceed();
+ } finally {
+ signal(key, startTime, System.currentTimeMillis());
+ }
+ }
+ protected Object register(JoinPoint jp) {
+ return Thread.currentThread().getName() + " -- " + jp;
+ }
+ protected void signal(Object key, long start, long end) {
+ long duration = end - start;
+ String tag = (duration == 0 ? "none" : duration < 100 ? "fast" : "slow");
+ //System.err.println(duration + " " + start + " - " + end + ": " + key);
+ System.err.println(tag + ": " + key);
+ }
+}
diff --git a/tests/product/testScripts/cmdline11/script.sh b/tests/product/testScripts/cmdline11/script.sh
new file mode 100644
index 000000000..acba65774
--- /dev/null
+++ b/tests/product/testScripts/cmdline11/script.sh
@@ -0,0 +1,117 @@
+#!/bin/sh
+# run sample use cases
+[ -z "$DEBUG" ] || set -vx
+VERBOSE="${VERBOSE}"
+
+# define and export ajc, JDKDIR
+ajc="${ajc:-ajc}"
+ajrt="`dirname "${ajc}"`/../lib/aspectjrt.jar"
+JAVA_HOME="${JAVA_HOME:-`type java | sed -n '/\/bin\/java/s|/bin/java.*||'`}"
+JAVA="$JAVA_HOME/bin/java"
+JAVAC="$JAVA_HOME/bin/javac"
+JAR="$JAVA_HOME/bin/jar"
+PS=";" ### XXX windows
+
+## for direct access to eclipse
+useEclipse="${useEclipse}"
+if [ ! -f "$ajrt" -o -n "$useEclipse" ] ; then
+ modulesDir=`dirname "$0"`/../../../../modules
+ if [ ! -d "$modulesDir/build/src" ] ; then
+ modulesDir=`dirname "$0"`/../../../../../modules
+ fi
+ [ ! -d "$modulesDir/build/src" ] && exit 42
+ main=app.Main
+ ws="$modulesDir"
+ for i in asm bridge bcweaver org.aspectj.ajdt.core org.eclipse.jdt.core util ; do
+ ccp="$ccp;$ws/$i/bin"
+ done
+ ccp="$ccp;$ws/lib/eclipse2.0/jdtDepends.jar;$ws/lib/bcel/bcel.jar"
+ ajrt="$ws/runtime/bin"
+ [ -d "$ajrt" ] && useEclipse=yesUseEclipse
+fi
+
+compile() {
+ [ -n "$VERBOSE" ] && echo "compile ${@}"
+ if [ -n "$useEclipse" ] ; then
+ $JAVA -classpath "$ccp" org.aspectj.tools.ajc.Main "${@}"
+ else
+ $ajc "${@}"
+ fi
+}
+
+cleanDirs() {
+ [ -d jars ] || mkdir jars
+ [ -d classes ] || mkdir classes
+ rm -rf classes/*
+ for i in profile myprofile app; do mkdir classes/$i ; done
+}
+
+makeJar() {
+ $JAR cfM jars/$1.jar -C classes .
+ cleanDirs
+}
+runTest() {
+ runcp="${1:-$ajrt${PS}classes}"
+ name="${2:-default}"
+ [ -n "$VERBOSE" ] && echo "run ${@}"
+ $JAVA -classpath "$runcp" $main \
+ > $name.out.txt 2> $name.err.txt
+ if [ ! "$name" = "expected" ] ; then
+ diffResult=PASS
+ for i in out err; do
+ diff expected.$i.txt $name.$i.txt || diffResult=FAIL
+ [ -n "$VERBOSE" ] && wc -l expected.$i.txt $name.$i.txt
+ done
+ echo "${diffResult}: $runcp"
+ fi
+}
+
+## 0: setup
+cd `dirname "$0"`
+cleanDirs
+find . -name \*.java | sed 's|^./||' > files.lst
+grep -l aspect `cat files.lst` | sed 's|^./||' > aspects.lst
+grep -L aspect `cat files.lst` | sed 's|^./||' > java.lst
+
+## 1: compile all from sources
+compile -d classes -classpath "$ajrt" -argfile files.lst
+makeJar compileAll
+runTest "$ajrt${PS}jars/compileAll.jar" expected
+
+## 2: generate and weave user library with aspect sources
+ # note: relies on unwoven classes not being flagged for not-weaving?
+compile -d classes \
+ -classpath "$ajrt" \
+ -argfile java.lst
+makeJar compileJava
+compile -d classes \
+ -injars jars/compileJava.jar \
+ -classpath "$ajrt" \
+ -argfile aspects.lst
+makeJar weaveUserLib
+runTest "$ajrt${PS}jars/weaveUserLib.jar" weaveUserLib
+
+## 3: generate aspect library
+compile -d classes \
+ -classpath "$ajrt" \
+ -noweave \
+ -outjar jars/aspectLib.jar \
+ -argfile aspects.lst
+#makeJar aspectLib
+
+## 3a: weave aspect library with user sources
+compile -d classes \
+ -aspectpath jars/aspectLib.jar \
+ -classpath "$ajrt" \
+ -outjar jars/weaveAspectLib.jar \
+ -argfile java.lst
+#makeJar weaveAspectLib
+runTest "$ajrt${PS}jars/aspectLib.jar${PS}jars/weaveAspectLib.jar" weaveAspectLib
+
+## 3b: weave aspect library with user library
+compile -d classes \
+ -aspectpath jars/aspectLib.jar \
+ -injars jars/compileJava.jar \
+ -classpath "$ajrt"
+makeJar weaveAllLib
+runTest "$ajrt${PS}jars/aspectLib.jar${PS}jars/weaveAllLib.jar" weaveAllLib
diff --git a/tests/product/testScripts/publicIntroduction.sh b/tests/product/testScripts/publicIntroduction.sh
new file mode 100644
index 000000000..15382cf80
--- /dev/null
+++ b/tests/product/testScripts/publicIntroduction.sh
@@ -0,0 +1,128 @@
+#!/bin/sh
+# @testcase public introductions not visible in libraries given to javac or jikes
+# @testcase synthetic members should not be visible from libraries given to ajc todo??
+# @process-test ajc publicIntroduction.sh # two testcase for public introductions
+
+[ -n "$DEBUG" ] && set -vx
+
+echo "before running: define (install) AJ_BASE and add #!/bin/sh to scripts"
+scriptDir=`dirname "$0"`
+scriptName=`basename "$0" .sh`
+tempDir=temp${scriptName}
+JDKDIR="${JDKDIR:-${JAVA_HOME:-`type java | sed -n '/bin\/java/s|/bin/java.*||p'`}}"
+AJ_BASE="${AJ_BASE:-`type ajc | sed -n '/bin\/ajc/s|/bin/ajc.*||p'`}"
+ajLib="${AJ_BASE}/lib/aspectjrt.jar"
+PS="${PS:-;}" # todo
+
+errMssg() {
+ [ -n "$1" ] && echo "## FAIL: $1"
+ [ -n "$2" ] && exit "$2"
+}
+
+makeSources() {
+ cat > Javap.java<<EOF
+public class Javap {
+ interface I {
+ void i();
+ }
+ class C {}
+ static aspect A {
+ public void I.i() {}
+ declare parents: C implements I;
+ }
+}
+EOF
+
+ cat > Target.java <<EOF
+public class Target {
+ // regular members
+ public long publicLong;
+ public long getPublicLong() { return publicLong; }
+}
+
+aspect A {
+ // introduced members
+ public int Target.publicInt;
+ public int Target.getPublicInt() {
+ return publicInt;
+ }
+ public static int Target.staticPublicInt;
+ public static int Target.getStaticPublicInt() {
+ return staticPublicInt;
+ }
+}
+
+EOF
+ mkdir user
+ cat > user/TargetUser.java<<EOF
+public class TargetUser {
+ public static void main (String[] args) {
+ Target me = new Target();
+ // regular members
+ long l = me.publicLong;
+ l = me.getPublicLong();
+ // introduced members
+ int i = me.publicInt;
+ i = me.getPublicInt();
+ i = me.getStaticPublicInt();
+ i = me.staticPublicInt;
+ }
+}
+EOF
+}
+
+#############################################################
+curdir=`pwd`
+[ ! -d "$tempDir" ] && mkdir -p "$tempDir"
+cd "$tempDir" || errMssg "unable to creat temp dir" 3
+
+[ -z "$JDKDIR" ] \
+ && errMssg "expecting \$JDKDIR/bin/java: $JDKDIR/bin/java" 3
+
+[ -z "$AJ_BASE" ] \
+ && errMssg "expecting \$AJ_BASE/bin/ajc: $AJ_BASE/bin/ajc" 3
+
+makeSources
+
+mkdir classes
+### javap case - PR#649
+cmdName=ajc.javap
+"$AJ_BASE/bin/ajc" -classpath "$ajLib" \
+ -d classes Javap.java \
+ > $cmdName.txt 2>&1 \
+ || errMssg "$cmdName: `cat $cmdName.txt`" 3
+
+cmdName=javap
+"$JDKDIR/bin/javap" -classpath "$ajLib${PS}classes" Javap \
+ > $cmdName.txt 2>&1 \
+ || errMssg "$cmdName: `cat $cmdName.txt`" 3
+
+# javac case - PR#646
+cmdName=ajc
+"$AJ_BASE/bin/ajc" -classpath "$ajLib" \
+ -d classes Target.java \
+ > $cmdName.txt 2>&1 \
+ || errMssg "$cmdName: `cat ../$cmdName.txt`" 3
+
+cd user
+
+cmdName=../javac
+"$JDKDIR/bin/javac" -classpath ../classes -d ../classes TargetUser.java \
+ > $cmdName.txt 2>&1 \
+ || errMssg "$cmdName: `cat $cmdName.txt`" 3
+
+cd ..
+
+cmdName=java
+"$JDKDIR/bin/java" -classpath "$ajLib${PS}classes" TargetUser \
+ > $cmdName.txt 2>&1 \
+ || errMssg "$cmdName: `cat $cmdName.txt`" 3
+
+cd "$curdir"
+rm -rf "$tempDir"
+
+echo "tests passed if they got to this point..."
+
+
+
+