When I try to test some specific module in
cdk I am using the -Dmodule functionality with the
Ant build.xml build system. Since the
update in src the compile module have a continue procedure,
here you have a good example.
Thus, if I want to test only the module formula, I am doing the following:
$ rm dist/jar/cdk-formula.jar $ rm dist/jar/cdk-test-formula.jar
$ rm reports/result-formula.txt $ ant -Dmodule=formula -Dsource=src/main compile-module
$ ant -Dmodule=test-formula -Dsource=src/test compile-module
$ ant -Dmodule=formula test-module
$ cat reports/results-formula.txtThe three first line remove all code related to formula. Afterwards the module, the test is compiled. Finally the tests are tested.
One of the inconvenient which I come across is that I had to write each time the same thing and when I changed of module rewrite again. In short I would like to write only the module to test. That is the origin I wrote a small script which may be it can interest somebody.
#!/bin/bash
#====================================================#
# Script to compile specific module of the Chemistry Development kit with the #
# the Ant build.xml system. #
#====================================================#
ANT="ant"
BUILD="build.xml"
if [ ! -f $BUILD ]
then
echo "Build file [$BUILD] not found - Aborting"
exit
fi
if [ $# -ne 1 ]
then
echo "Error in $0 - Invalid Argument Count"
echo "Syntax: $0 module_name"
exit
else
modJ="dist/jar/cdk-"$1".jar"
if [ -f $modJ ]
then
echo "removing "$modJ
fi
mod_testJ="dist/jar/cdk-test-"$1".jar"
if [ -f $mod_testJ ]
then
echo "removing "$mod_testJ
fi
mod_report="reports/result-"$1".txt"
if [ -f $mod_report ]
then
echo "removing "$mod_report
fi
script1=$ANT" -f "$BUILD" -Dmodule="$1" -Dsource=src/main compile-module"
echo "building: "$script1
$script1
script2=$ANT" -f "$BUILD" -Dmodule=test-"$1" -Dsource=src/test compile-module"
echo "building: "$script2
$script2
script3=$ANT" -f "$BUILD" -Dmodule="$1" test-module"
echo "building: "$script3
$script3
cat $mod_report
fi