aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorwisberg <wisberg>2003-12-15 12:13:47 +0000
committerwisberg <wisberg>2003-12-15 12:13:47 +0000
commit18bc9e7ebbe011bcfa3ab942c766bd2fa13081b4 (patch)
tree283c74e3dcf174ab69ff80c71688676079e38af9 /tests
parent38aa20202ee04c6fa31dcf827c310a65dc4b96ed (diff)
downloadaspectj-18bc9e7ebbe011bcfa3ab942c766bd2fa13081b4.tar.gz
aspectj-18bc9e7ebbe011bcfa3ab942c766bd2fa13081b4.zip
inpath support
Diffstat (limited to 'tests')
-rw-r--r--tests/ajcHarnessTests.xml6
-rw-r--r--tests/harness/inpath/aspectsrc/A.java20
-rw-r--r--tests/harness/inpath/build.xml11
-rw-r--r--tests/harness/inpath/input-path-classes/Main.classbin0 -> 1307 bytes
-rw-r--r--tests/harness/inpath/input-path-classes/pack/Util.classbin0 -> 182 bytes
-rw-r--r--tests/harness/inpath/input-path-classes/pack/resource.txt1
-rw-r--r--tests/harness/inpath/input-path-src/Main.java22
-rw-r--r--tests/harness/inpath/input-path-src/pack/Util.java8
-rw-r--r--tests/readme-writing-compiler-tests.html28
9 files changed, 94 insertions, 2 deletions
diff --git a/tests/ajcHarnessTests.xml b/tests/ajcHarnessTests.xml
index 721e0a189..0170b7124 100644
--- a/tests/ajcHarnessTests.xml
+++ b/tests/ajcHarnessTests.xml
@@ -286,6 +286,12 @@
<run class="SystemExit" options="-1"/>
</ajc-test>
+ <ajc-test dir="harness/inpath"
+ title="pass test inpath option - valid">
+ <compile files="input-path-classes" sourceroots="aspectsrc"/>
+ <run class="Main"/>
+ </ajc-test>
+
</suite>
diff --git a/tests/harness/inpath/aspectsrc/A.java b/tests/harness/inpath/aspectsrc/A.java
new file mode 100644
index 000000000..8d0f487a5
--- /dev/null
+++ b/tests/harness/inpath/aspectsrc/A.java
@@ -0,0 +1,20 @@
+
+import org.aspectj.testing.Tester;
+
+public aspect A {
+ static {
+ Tester.expectEvents(
+ new String[] {
+ "execution(void Main.main(String[]))",
+ "execution(void pack.Util.log(String[]))"
+ }
+ );
+ }
+ before() : execution(public static * *(..)) {
+ Tester.event("" + thisJoinPointStaticPart);
+ //System.out.println("\"" + thisJoinPointStaticPart);
+ }
+ after() returning : execution(public static void main(String[])) {
+ Tester.checkAllEvents();
+ }
+}
diff --git a/tests/harness/inpath/build.xml b/tests/harness/inpath/build.xml
new file mode 100644
index 000000000..21e378070
--- /dev/null
+++ b/tests/harness/inpath/build.xml
@@ -0,0 +1,11 @@
+
+<project name="inpath-test" default="all" basedir=".">
+
+
+ <target name="all" description="build classes">
+ <property name="dest.dir" location="${basedir}/input-path-classes"/>
+ <property name="src.dir" location="${basedir}/input-path-src"/>
+ <javac destdir="${dest.dir}" srcdir="${src.dir}"/>
+ </target>
+
+</project>
diff --git a/tests/harness/inpath/input-path-classes/Main.class b/tests/harness/inpath/input-path-classes/Main.class
new file mode 100644
index 000000000..51ecc1163
--- /dev/null
+++ b/tests/harness/inpath/input-path-classes/Main.class
Binary files differ
diff --git a/tests/harness/inpath/input-path-classes/pack/Util.class b/tests/harness/inpath/input-path-classes/pack/Util.class
new file mode 100644
index 000000000..eae0da606
--- /dev/null
+++ b/tests/harness/inpath/input-path-classes/pack/Util.class
Binary files differ
diff --git a/tests/harness/inpath/input-path-classes/pack/resource.txt b/tests/harness/inpath/input-path-classes/pack/resource.txt
new file mode 100644
index 000000000..9a2c7732f
--- /dev/null
+++ b/tests/harness/inpath/input-path-classes/pack/resource.txt
@@ -0,0 +1 @@
+testing \ No newline at end of file
diff --git a/tests/harness/inpath/input-path-src/Main.java b/tests/harness/inpath/input-path-src/Main.java
new file mode 100644
index 000000000..83b7dfb56
--- /dev/null
+++ b/tests/harness/inpath/input-path-src/Main.java
@@ -0,0 +1,22 @@
+
+import pack.Util;
+
+public class Main {
+ public static void main(String[] args) throws java.io.IOException {
+ Util.log(args);
+ boolean expectResourceCopy = false; // XXXX check
+ if (expectResourceCopy) {
+ java.io.InputStream in =
+ Main.class.getClassLoader().getResourceAsStream("pack/resource.txt");
+ if (null == in) {
+ throw new Error("unable to read pack/resource.txt");
+ }
+ byte[] buf = new byte[7];
+ int read = in.read(buf);
+ String val = new String(buf);
+ if (!"testing".equals(val)) {
+ throw new Error("expected \"testing\", got: " + val);
+ }
+ }
+ }
+}
diff --git a/tests/harness/inpath/input-path-src/pack/Util.java b/tests/harness/inpath/input-path-src/pack/Util.java
new file mode 100644
index 000000000..939f6a81d
--- /dev/null
+++ b/tests/harness/inpath/input-path-src/pack/Util.java
@@ -0,0 +1,8 @@
+
+package pack;
+
+public class Util {
+ public static void log(String[] args) {
+ // do nothing
+ }
+}
diff --git a/tests/readme-writing-compiler-tests.html b/tests/readme-writing-compiler-tests.html
index 932c35267..3eb9896cc 100644
--- a/tests/readme-writing-compiler-tests.html
+++ b/tests/readme-writing-compiler-tests.html
@@ -455,8 +455,9 @@ The <code>compile</code> element has the following attributes
which handle most of the other compiler arguments:
<ul>
<li><code>files</code>: .aj and .java files are treated as source files,
- but .jar files are extracted and passed to the compiler
+ but .jar/zip files are extracted and passed to the compiler
as <code>-injars</code>
+ and readable directories are passed as <code>-inpath</code>.
</li><li><code>classpath</code>: directories and jar files for the classpath
</li><li><code>aspectpath</code>: binary aspects in jar files
</li><li><code>argfiles</code>: argument list files
@@ -469,7 +470,7 @@ multiple entries are separated with commas.
Here is a cooked example that uses all <code>compiler</code> attributes:
<pre>
&lt;ajc-test dir="new" title="attributes test">
- &lt;compile files="Main.java,injar.jar"
+ &lt;compile files="Main.java,injar.jar,some-directory"
staging="true"
options="-Xlint,-g:none"
argfiles="debug.lst,aspects/test.lst"
@@ -479,11 +480,34 @@ Here is a cooked example that uses all <code>compiler</code> attributes:
&lt;/ajc-test>
</pre>
+<h5>Test-only compiler attributes</h5>
+The following attributes of the compiler entity dictate harness behavior:
+
+<ul>
+<li><u>badInput</u>:
+To test invalid input, set the compiler <code>badInput</code> attribute
+to "</code>true</code>". This prevents the harness from aborting a test
+because a specified input file was not found. (However, there is no way
+to specify bad input for a directory in the files attribute intended for
+-inpath, because the harness selects readable directories.)
+</li>
+
+
+<li><u>includeClassesDir</u>:
+Set this in order to include the output classes directory explicitly
+on the classpath.
+</li>
+<li><u>reuseCompiler</u>:
+Set this to re-use a compiler from a previous compiler run.
+(This tests statefulness of a compiler across non-incremental runs.)
+</li>
+</ul>
<h5>Unsupported compiler options</h5>
The harness does not support the following AspectJ compiler
options: <code>-target {version}, -outjar {file}, -log {file}</code>.
(<code>-d {dir}</code> is used but specification is not supported.)
+
<a name="background"></a>