Matthew, I agree with what you said here and in the bugs: the harness
should set up the LTW world. Putting the java-5 projects on the tests/
project classpath is feasible, but makes ltw classes too visible. That
probably means the RunSpec consumes a system property with the ltw
implementation classpath (defaults to eclipse world, but the Ant world can
override with "../aj-build/jars/weaver5.jar:..."). See the old harness
(testing/src/.../JavaRun.java) for 1.4-style ltw setup and sample use of the
launching utility when forking.
To amplify...
Just to restate the issue: under Ant, the build/build.xml target
run-all-module-tests depends only on the module classpath, which for the tests/
project does not include the Java 5 projects (to avoid building in java 1.4).
This only affects the Ant build because in Eclipse, RunTheseBeforeYouCommitTests/run-all-junit-tests handles everything and users can add the
projects to the launch config for specific tests (though this isn't
optimal). (more background: It doesn't help to use the special source
directories for java5-src and java5-testsrc because they only work as a
compatible upgrade/addition when run under Java 5, and do not change the project
dependencies. We could run the tests under Ant in one go using RunTheseBeforeYouCommitTests, but then we wouldn't get nice html output from junitreport,
so we run each module.)
We can make tests/ depend on the java-5 projects, and make the java-5
projects buildable (but empty) in Ant under 1.4. I added the dependencies
in Eclipse and did an Ant build/test; it completed normally but there were 6
failures and 11 errors (compared to none under 1.5 and 3 failures, 5 errors
under 1.4) that I don't have time now to pursue.
However, I agree this is the job of the harness, to set up the ltw
classloading correctly. ltw is less like the test compiler runs (where the
application classpath is specified on the command line and the compiler/harness
classpath is the current runtime) and more like the test java runs (where the
classloader should be set up explicitly to get correct results). So I
think harness ltw logic should handle that (in
RunSpec.execute(AjcTestCase)). That means communicating the location of
the ltw classes via system properties (and making sure they are
built/available). A hack/prototype harness would just try the known
locations; if that works, we can work out publishing the
ltw-implementation-classpath from Ant.
The ltw support in the old harness (testing/.../JavaRun.java) dates to May
last year but is untested. It uses the launching code in
LangUtil.ProcessController and sets up 1.4-style ltw. It could be adopted
and modified to use 1.5-style when targeting 1.5.
Let me know if you want more research or some code. I'm reluctant to
change the build without access to the build machine or to update the new
harness absent a request.
Wes
P.S. - Another (worse) option is a tests-5/ module configured with
dependencies on the java-5 projects (weaver5, aspectj5rt, loadtime5).
Where sources are reused, the tests-5/ module test specifications would refer to
the original ../tests/.. sources. That project/module would simply not be
built when run under 1.4, but would drive tests under 1.5. However, this
duplicates test specifications, so it is not a good option.
------------Original Message------------
From: Matthew Webster <matthew_webster@xxxxxxxxxx>
To: "AspectJ developer discussions" <aspectj-dev@xxxxxxxxxxx>
Date: Fri, Jun-9-2006 6:24 AM
Subject: [aspectj-dev] JUnit Classpath in Batch Testing One topic of discussion on the last AspectJ call concerned executing
tests with a Java 5 project dependency e.g. weaver5. The harness dynamically
adds these tests when running under Java 5. Unfortunately with the
introduction of LTWWorld
(https://bugs.eclipse.org/bugs/show_bug.cgi?id=140695) all the LTW tests in
the "tests" project have an implicit dependency on the Java 5 projects when
run under Java 5. This is OK when running RunTheseBeforeYouCommitTests
because the "run-all-junit-tests" project has the right dependencies. This is
not the case when running individual testcases/suites in the "tests" project.
On workaround is to manually add the relevant projects to the Eclipse launch
configuration but I am concerned how this will work on the build
machine.
I have looked at the
<junit> task in build.xml and assume that "<pathelement location="${aj.jar.dir}/${module.name}-test-all.jar"/>" is the classpath used for testing a particular project. However I
cannot find where the JAR is built and hence what it comprises. I would like
to ensure that the Java 5 projects e.g. weaver5 are on the classpath when
testing _every_ project. (in RunSpec.execute(AjcTestCase)?)
Cheers
Matthew Webster AOSD Project Java Technology Centre, MP146 IBM
Hursley Park, Winchester, SO21 2JN, England Telephone: +44 196
2816139 (external) 246139 (internal) Email: Matthew Webster/UK/IBM @
IBMGB, matthew_webster@xxxxxxxxxx http://w3.hursley.ibm.com/~websterm/_______________________________________________
aspectj-dev mailing list aspectj-dev@xxxxxxxxxxx https://dev.eclipse.org/mailman/listinfo/aspectj-dev
|