|
6 | 6 |
|
7 | 7 | This file now requires Ant 1.4.1. 2002-04-18
|
8 | 8 |
|
9 |
| - $Header: /cvsroot/pgsql/src/interfaces/jdbc/Attic/build.xml,v 1.34 2003/08/11 21:27:52 barry Exp $ |
| 9 | + $Header: /cvsroot/pgsql/src/interfaces/jdbc/Attic/build.xml,v 1.35 2003/08/11 23:42:04 barry Exp $ |
10 | 10 |
|
11 | 11 | -->
|
12 | 12 |
|
|
48 | 48 | </condition>
|
49 | 49 | <available property="datasource" classname="javax.sql.DataSource"/>
|
50 | 50 | <available property="ssl" classname="javax.net.ssl.SSLSocketFactory"/>
|
51 |
| - <available property="junit" classname="junit.framework.Test" /> |
| 51 | + <available property="junit" classname="junit.framework.Test"/> |
| 52 | + <available property="junit.task" classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"/> |
52 | 53 | <condition property="jdbc2tests">
|
53 | 54 | <and>
|
54 |
| - <isset property="jdbc2"/> |
| 55 | + <or> |
| 56 | + <isset property="jdbc2"/> |
| 57 | + <isset property="jdbc3"/> |
| 58 | + </or> |
55 | 59 | <isset property="junit"/>
|
56 | 60 | </and>
|
57 | 61 | </condition>
|
58 | 62 | <condition property="jdbc2optionaltests">
|
59 | 63 | <and>
|
60 |
| - <isset property="jdbc2"/> |
| 64 | + <or> |
| 65 | + <isset property="jdbc2"/> |
| 66 | + <isset property="jdbc3"/> |
| 67 | + </or> |
61 | 68 | <isset property="datasource"/>
|
62 | 69 | <isset property="junit"/>
|
63 | 70 | </and>
|
|
82 | 89 | <jar jarfile="${jardir}/postgresql.jar">
|
83 | 90 | <fileset dir="${builddir}">
|
84 | 91 | <include name="${package}/**/*.class" />
|
85 |
| - <exclude name="${package}/test/**" /> |
86 | 92 | </fileset>
|
87 | 93 |
|
88 | 94 | <fileset dir="${srcdir}">
|
|
277 | 283 | <property name="username" value="test" />
|
278 | 284 | <!-- Password must be something. Doesn't matter if trust is used! -->
|
279 | 285 | <property name="password" value="password" />
|
280 |
| - <!-- junit.ui is one of textui, awtui, or swingui --> |
281 |
| - <property name="junit.ui" value="textui" /> |
282 | 286 |
|
| 287 | + <!-- The tests now build to a separate directory and jarfile from the |
| 288 | + driver build, to ensure we're really testing against the jar we just |
| 289 | + built, and not whatever happens to be in builddir. --> |
283 | 290 |
|
284 |
| - <target name="test" depends="testjdbc2,testjdbc2optional,testjdbc3"> |
285 |
| - </target> |
| 291 | + <!-- This compiles and builds the test jarfile. --> |
| 292 | + <target name="testjar" depends="jar" if="junit"> |
| 293 | + <mkdir dir="${builddir}/tests"/> |
| 294 | + <javac srcdir="${srcdir}" destdir="${builddir}/tests" debug="${debug}"> |
| 295 | + <include name="${package}/test/**" /> |
286 | 296 |
|
287 |
| - <target name="testjdbc2" depends="jar" if="jdbc2tests"> |
288 |
| - <javac srcdir="${srcdir}" destdir="${builddir}" debug="${debug}"> |
289 |
| - <include name="${package}/test/jdbc2/*" /> |
290 |
| - </javac> |
291 |
| - <java fork="yes" classname="junit.${junit.ui}.TestRunner" taskname="junit" failonerror="true"> |
292 |
| - <arg value="org.postgresql.test.jdbc2.Jdbc2TestSuite" /> |
293 |
| - <sysproperty key="database" value="${database}" /> |
294 |
| - <sysproperty key="username" value="${username}" /> |
295 |
| - <sysproperty key="password" value="${password}" /> |
296 |
| - <classpath> |
297 |
| - <pathelement location="${builddir}" /> |
298 |
| - <pathelement path="${java.class.path}" /> |
299 |
| - </classpath> |
300 |
| - </java> |
301 |
| - </target> |
| 297 | + <exclude name="${package}/test/jdbc2/**" unless="jdbc2tests"/> |
| 298 | + <exclude name="${package}/test/jdbc2/optional/**" unless="jdbc2optionaltests" /> |
| 299 | + <exclude name="${package}/test/jdbc3/**" unless="jdbc3tests" /> |
| 300 | + <exclude name="${package}/test/util/**" unless="jdbc2optionaltests"/> |
302 | 301 |
|
303 |
| - <target name="testjdbc2optional" depends="jar" if="jdbc2optionaltests"> |
304 |
| - <javac srcdir="${srcdir}" destdir="${builddir}" debug="${debug}"> |
305 |
| - <include name="${package}/test/jdbc2/optional/**" /> |
306 |
| - <include name="${package}/test/util/**" /> |
307 |
| - </javac> |
308 |
| - <java fork="yes" classname="junit.${junit.ui}.TestRunner" taskname="junit" failonerror="true"> |
309 |
| - <arg value="org.postgresql.test.jdbc2.optional.OptionalTestSuite" /> |
310 |
| - <sysproperty key="database" value="${database}" /> |
311 |
| - <sysproperty key="username" value="${username}" /> |
312 |
| - <sysproperty key="password" value="${password}" /> |
313 | 302 | <classpath>
|
314 |
| - <pathelement location="${builddir}" /> |
315 |
| - <pathelement path="${java.class.path}" /> |
| 303 | + <pathelement location="${jardir}/postgresql.jar"/> |
316 | 304 | </classpath>
|
317 |
| - </java> |
| 305 | + </javac> |
| 306 | + <jar jarfile="${jardir}/postgresql-tests.jar" basedir="${builddir}/tests"/> |
318 | 307 | </target>
|
| 308 | + |
| 309 | + <!-- This actually runs the tests --> |
| 310 | + <target name="runtest" depends="testjar" if="junit.task"> |
| 311 | + <junit> |
| 312 | + <formatter type="brief" usefile="false"/> |
319 | 313 |
|
320 |
| - <target name="testjdbc3" depends="jar" if="jdbc3tests"> |
321 |
| - <javac srcdir="${srcdir}" destdir="${builddir}" debug="${debug}"> |
322 |
| - <include name="${package}/test/jdbc3/*" /> |
323 |
| - <include name="${package}/test/util/*" /> |
324 |
| - </javac> |
325 |
| - <java fork="yes" classname="junit.${junit.ui}.TestRunner" taskname="junit" failonerror="true"> |
326 |
| - <arg value="org.postgresql.test.jdbc3.Jdbc3TestSuite" /> |
327 | 314 | <sysproperty key="database" value="${database}" />
|
328 | 315 | <sysproperty key="username" value="${username}" />
|
329 | 316 | <sysproperty key="password" value="${password}" />
|
| 317 | + |
330 | 318 | <classpath>
|
331 |
| - <pathelement location="${builddir}" /> |
| 319 | + <pathelement location="${jardir}/postgresql.jar" /> |
| 320 | + <pathelement location="${jardir}/postgresql-tests.jar" /> |
332 | 321 | <pathelement path="${java.class.path}" />
|
333 | 322 | </classpath>
|
334 |
| - </java> |
335 |
| - </target> |
336 | 323 |
|
| 324 | + <test name="org.postgresql.test.jdbc2.Jdbc2TestSuite" if="jdbc2tests"/> |
| 325 | + <test name="org.postgresql.test.jdbc2.optional.OptionalTestSuite" if="jdbc2optionaltests"/> |
| 326 | + <test name="org.postgresql.test.jdbc3.Jdbc3TestSuite" if="jdbc3tests"/> |
| 327 | + </junit> |
| 328 | + </target> |
| 329 | + |
| 330 | + <!-- This is the target invoked by the Makefile --> |
| 331 | + <target name="test" depends="testjar,runtest"/> |
337 | 332 |
|
338 | 333 | </project>
|
0 commit comments