This patch rearranges how tests are built and run from build.xml:
+ Make all testsuites (jdbc2, jdbc2.optional, jdbc3) independent
i.e. they run only their own tests and not those of earlier
versions.
+ Run all applicable testsuites for the configured JDBC version,
e.g. run jdbc2, jdbc2.optional, and jdbc3 if we are configured
for JDBC3. The rationale is that the JDBC2 tests should work
on JDBC2 *or any later version*.
+ Use Ant's <junit> task instead of running a JUnit UI. This cleans
up the buildfile and produces somewhat nicer output than the text-ui.
As Ant doesn't try to find the task class until the containing target
is run, and we conditionalize running the test task on the
presence of both JUnit and the JUnit task, this shouldn't cause
errors if the task isn't present.
+ Merge the various per-version test targets into a single target with
conditional <test> elements.
+ Use a separate builddir for the tests to help isolate them from the
driver. Build a new postgresql-tests.jar jarfile containing just the tests.
+ Run the tests using the actual driver jarfile (and test jarfile)
rather than whatever's in builddir. This should help make sure that you
are testing the actual driver that will be used. One sideeffect of this
is that PSQLException can find its resource bundle when running tests now
(previously it couldn't as srcdir was not in the test classpath).
I've tested this against Ant 1.5.3 and a 1.4 JDK, with and without JUnit and
ant-optional (for the JUnit task) present. I don't have the resources to
test other JDKs or Ant versions at the moment.
-O