We're now set up to support automated unit tests. Besides the fact

that I like unit tests, my Unicode conversion work is going to have to
be thorougly tested for reasons I will outline in
http://thdltools.sf.net/BuildSystems.html later today.

Added the freely licensed JUnit 3.8.1 binary to the repository, along
with some README files.  Added a new supporting buildfile,
junitbuild.xml.  'ant clean check' is now good to go (though it uses
the text UI for JUnit, and some developers may want the Swing GUI)

Also, I cleaned up build.xml a bit, including adding all buildfiles
(but not junit.jar and things like that) to the source distribution
('ant src-dist') rather than just build.xml.
This commit is contained in:
dchandler 2003-01-12 20:24:01 +00:00
parent 190a3d9b60
commit a31fed2ea7
7 changed files with 115 additions and 15 deletions

View file

@ -2,4 +2,5 @@ bin
jskad.log jskad.log
savant.log savant.log
qd.log qd.log
TEST*
*~ *~

View file

@ -25,7 +25,9 @@
extensions/jmf.jar extensions/jmf.jar
See the developers site, linked to from http://thdltools.sf.net/, See the developers site, linked to from http://thdltools.sf.net/,
for info on where to find these. for info on where to find these. (You may be able to use Ant's
copies of some of them, if you really can't wait to get started.
Examine the contents of '$ANT_HOME/lib'.)
--> -->
@ -47,6 +49,7 @@
<property name="license" location="license"/> <property name="license" location="license"/>
<property name="bin" location="bin"/> <property name="bin" location="bin"/>
<property name="jskadbin" location="bin/jskad"/> <property name="jskadbin" location="bin/jskad"/>
<property name="junitbin" location="bin/for-junit"/>
<property name="qdbin" location="bin/qd"/> <property name="qdbin" location="bin/qd"/>
<property name="ttstandalonebin" location="bin/tt-standalone"/> <property name="ttstandalonebin" location="bin/tt-standalone"/>
<property name="ttappletjwsbin" location="bin/tt-applet-and-java-web-start"/> <property name="ttappletjwsbin" location="bin/tt-applet-and-java-web-start"/>
@ -156,6 +159,7 @@
<mkdir dir="${dist}/source"/> <mkdir dir="${dist}/source"/>
<mkdir dir="${bin}"/> <mkdir dir="${bin}"/>
<mkdir dir="${jskadbin}"/> <mkdir dir="${jskadbin}"/>
<mkdir dir="${junitbin}"/>
<mkdir dir="${qdbin}"/> <mkdir dir="${qdbin}"/>
<mkdir dir="${ttstandalonebin}"/> <mkdir dir="${ttstandalonebin}"/>
<mkdir dir="${tthandheldbin}"/> <mkdir dir="${tthandheldbin}"/>
@ -167,8 +171,30 @@
</target> </target>
<target name="test-all" <!--
depends="clean,distclean,compile,dist,src-dist,self-contained-dist,public-javadocs-dist,private-javadocs-dist,releases,web-start-releases,nightly-build" See http://thdltools.sourceforge.net/BuildSystems.html for full
details on unit testing our software. If you're eager enough
to get started, just read
extensions/to-be-installed-with-ant/README.TXT.
Just as with 'ant dist', it is wise to 'ant clean' before
running 'ant check'.
-->
<target name="check"
description="Compiles and runs all JUnit tests (that can be run given the present extension JARs) for the entire project. Our coverage is currently quite low."
depends="compile-junit-tests">
<ant antfile="junitbuild.xml" target="run-all-junit-tests"
inheritAll="false" inheritRefs="false">
<reference refid="entire.class.path"/>
<property name="junitbin" value="${junitbin}"/>
</ant>
<echo message=""/>
<echo message="You may now examine the files TEST-* for more details."/>
</target>
<!-- Use 'ant check' for testing the software, and this merely for putting the build system through its paces: -->
<target name="test-all-ant-targets"
depends="clean,distclean,compile,dist,src-dist,self-contained-dist,public-javadocs-dist,private-javadocs-dist,releases,web-start-releases,check,nightly-build"
description="runs every target in this buildfile in a smart order; useful for testing the buildfile and your build environment" /> description="runs every target in this buildfile in a smart order; useful for testing the buildfile and your build environment" />
@ -255,6 +281,20 @@
</copy> </copy>
</target> </target>
<target name="compile-junit-tests" depends="init"
description="compiles all JUnit test cases that can be compiled in the present CLASSPATH (NB that this distinction is just wishful thinking for now becuase we have such weak test coverage at this point)" >
<antcall target="our-internal-javac-task">
<param name="mybin" value="${junitbin}"/>
<param name="my.included.source.file"
value="org/thdl/util/ThdlLazyExceptionTest.java"/>
</antcall>
<antcall target="our-internal-javac-task">
<param name="mybin" value="${junitbin}"/>
<param name="my.included.source.file"
value="org/thdl/util/TrieTest.java"/>
</antcall>
</target>
<target name="savant-compile" depends="init" <target name="savant-compile" depends="init"
description="compiles Savant" > description="compiles Savant" >
<antcall target="copy-tmw-fonts-to-bin-dir"> <antcall target="copy-tmw-fonts-to-bin-dir">
@ -529,7 +569,7 @@
includes="*" includes="*"
prefix="."/> prefix="."/>
<zipfileset dir="." <zipfileset dir="."
includes="build.xml" includes="*build.xml"
prefix="."/> prefix="."/>
<zipfileset dir="." <zipfileset dir="."
includes="docs/*package-list/**" includes="docs/*package-list/**"
@ -636,7 +676,7 @@
<!-- DLC FIXME: This used to inlude Jskad2Javascript.class, etc. But it no longer does. Compile those extra files, if Edward hasn't removed them! --> <!-- DLC FIXME: This used to include Jskad2Javascript.class, etc. But it no longer does. Compile those extra files if Edward hasn't removed them! -->
<target name="jskad-all-in-one-dist" depends="jskad-compile" <target name="jskad-all-in-one-dist" depends="jskad-compile"
description="generates the self-contained binary distribution for Jskad" > description="generates the self-contained binary distribution for Jskad" >
<!-- Now put everything in ${bin} and ${ext}/netscape, plus <!-- Now put everything in ${bin} and ${ext}/netscape, plus
@ -706,6 +746,9 @@
<delete file="${dist}/QuillDriver.jnlp"/> <delete file="${dist}/QuillDriver.jnlp"/>
<delete file="${dist}/Jskad.jnlp"/> <delete file="${dist}/Jskad.jnlp"/>
<delete file="${source}/org/thdl/util/ThdlVersion.java"/> <delete file="${source}/org/thdl/util/ThdlVersion.java"/>
<delete>
<fileset dir="." includes="TEST-org.thdl*"/>
</delete>
</target> </target>
@ -801,7 +844,7 @@
</java> </java>
</target> </target>
<!-- DLC NOW --> <!-- DLC NOW convert to junit tests. -->
<target name="test-tsheg-bar" depends="jskad-dist" description="runs tsheg bar tests"> <target name="test-tsheg-bar" depends="jskad-dist" description="runs tsheg bar tests">
<java classname="org.thdl.tib.text.tshegbar.test" fork="yes"> <java classname="org.thdl.tib.text.tshegbar.test" fork="yes">
<classpath> <classpath>
@ -960,10 +1003,6 @@
<src path="${source}"/> <src path="${source}"/>
<include name="${my.included.source.file}" /> <include name="${my.included.source.file}" />
<!-- Exclude JUnit tests: -->
<exclude name="**/*Test.java" />
<exclude name="**/*AllTests.java" />
<!-- Don't compile these resources (we could leave this out, but <!-- Don't compile these resources (we could leave this out, but
Ant's debugging output would confuse us, and having this Ant's debugging output would confuse us, and having this
explicit is a Good Thing: --> explicit is a Good Thing: -->
@ -1278,7 +1317,11 @@ public class ThdlVersion {
]]></echo> ]]></echo>
</target> </target>
<!-- DLC TODO: jardiffs for the JWS stuff. --> <!--
Note that jardiffs for the JWS stuff are done by the JWS system
itself when appropriate and when the server is configured
correctly. We have no work to do on that front.
-->
<target name="copy-SQD-jars" <target name="copy-SQD-jars"
description="Unpacks the JARs/WARs/ZIP files that Savant and QuillDriver use to the chosen bin/ directory"> description="Unpacks the JARs/WARs/ZIP files that Savant and QuillDriver use to the chosen bin/ directory">
<unjar src="${ext}/jdom.jar" dest="${unjardest}"/> <unjar src="${ext}/jdom.jar" dest="${unjardest}"/>
@ -1297,6 +1340,7 @@ public class ThdlVersion {
<fileset dir="Fonts/TibetanMachineWeb"/> <fileset dir="Fonts/TibetanMachineWeb"/>
</copy> </copy>
</target> </target>
</project> </project>
<!-- My TO-DO list: --> <!-- My TO-DO list: -->

5
extensions/README.TXT Normal file
View file

@ -0,0 +1,5 @@
This directory is where we place third-party JARs of which our
software is a client. The subdirectory to-be-installed-with-ant/
contains a README file for you, also.
See 'http://thdltools.sf.net/BuildSystems.html' for more info.

View file

@ -0,0 +1,8 @@
Copy the JARs in this directory into Ant's lib/ directory (i.e.,
$ANT_HOME/lib, the same directory where 'optional.jar', shipped with
Ant, lives). The build system has been designed so that you needn't
do this to do basic development activities, but some build targets are
only functional if you perform this step.
See http://thdltools.sf.net/BuildSystems.html for more info.

Binary file not shown.

44
junitbuild.xml Normal file
View file

@ -0,0 +1,44 @@
<!-- @author David Chandler, dchandler@users.sourceforge.net
We have a document,
http://thdltools.sourceforge.net/BuildSystems.html, that you
probably should read.
-->
<project name="THDLTools" default="fail-nicely" basedir=".">
<description>
This Jakarta Ant buildfile is used to do the low-level work of
unit testing our system. This is separate from build.xml because
to use this build file, you must have installed JUnit and the
JUnit Ant tasks (i.e., $ANT_HOME/lib/junit.jar and
$ANT_HOME/lib/optional.jar). Thus, this buildfile contains only
targets that must interact with JUnit.
Read the comments of this buildfile to learn more, or see
'http://thdltools.sourceforge.net/BuildSystems.html'.
</description>
<taskdef name="junit"
classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"/>
<target name="fail-nicely"
description="Tells the user to use build.xml, not this subbuildfile.">
<fail message="Do not use this file directly; use build.xml file instead, which then uses this file."/>
</target>
<!-- This creates output files TEST* in the Jskad/ directory. -->
<target name="run-all-junit-tests"
description="Assuming that compilation of appropriate classes has been done, this target runs all the JUnit tests in the project.">
<junit fork="no" printsummary="yes" haltonfailure="yes" haltonerror="yes">
<classpath>
<pathelement location="${junitbin}"/>
<path refid="entire.class.path"/>
</classpath>
<formatter type="plain"/>
<test name="org.thdl.util.ThdlLazyExceptionTest"/>
<test name="org.thdl.util.TrieTest"/>
</junit>
</target>
</project>

View file

@ -2,9 +2,7 @@
We have a document, We have a document,
http://thdltools.sourceforge.net/BuildSystems.html, that you http://thdltools.sourceforge.net/BuildSystems.html, that you
probably should read. FIXME: update this document to describe probably should read.
the two-buildfile system.
--> -->
<project name="THDLTools" default="fail-nicely" basedir="."> <project name="THDLTools" default="fail-nicely" basedir=".">
@ -16,7 +14,7 @@
This is separate from build.xml because to use this build file, This is separate from build.xml because to use this build file,
you must have installed the Venus Application Publisher's (Vamp's) you must have installed the Venus Application Publisher's (Vamp's)
Ant tasks. Read the comments of this buildfile to learn more, or Ant tasks. Read the comments of this buildfile to learn more, or
see http://thdltools.sourceforge.net/BuildSystems.html. see 'http://thdltools.sourceforge.net/BuildSystems.html'.
</description> </description>