diff --git a/.classpath b/.classpath index 16370e936..283c64846 100644 --- a/.classpath +++ b/.classpath @@ -1,6 +1,7 @@ + @@ -17,5 +18,6 @@ + diff --git a/build.xml b/build.xml index d9a49fd17..d62e2e118 100644 --- a/build.xml +++ b/build.xml @@ -24,8 +24,10 @@ + + @@ -34,14 +36,28 @@ + + + + + + + - + + + + + + + + @@ -137,6 +153,7 @@ + diff --git a/gridworks b/gridworks index 009a209f9..800a89990 100755 --- a/gridworks +++ b/gridworks @@ -44,6 +44,8 @@ and is one of build ..................... Build Gridworks run ....................... Run Gridworks + + test ...................... Test Gridworks make_dmg ........ Make MacOSX DMG distribution make_exe ........ Make Windows EXE distribution @@ -205,6 +207,30 @@ make_dmg() { rm -f "$GRIDWORKS_BUILD_DIR/temp_gridworks.dmg" } +test() { + if [ ! -d $GRIDWORKS_TEST_DIR/classes ] ; then + ant build_tests + echo "" + fi + + CLASSPATH="$GRIDWORKS_BUILD_DIR/classes:$GRIDWORKS_TEST_DIR/classes:$GRIDWORKS_TEST_DIR/lib/*:$GRIDWORKS_LIB_DIR/*" + + if [ "$1" == "" ] ; then + cd $GRIDWORKS_TEST_DIR/classes + TESTS=`find . -name '*.class' | sed s@/@.@g | sed s@.class@@ | sed s@..@@` + cd ../.. + else + TESTS=$1 + fi + + RUN_CMD="$JAVA -cp $CLASSPATH $OPTS org.junit.runner.JUnitCore $TESTS" + + echo "$RUN_CMD" + echo "" + + exec $RUN_CMD +} + run() { if [ ! -d $GRIDWORKS_BUILD_DIR/classes ] ; then ant build @@ -279,7 +305,7 @@ ACTION=$1; shift # ----- Verify and Set Required Environment Variables ------------------------- if [ "$JAVA_OPTIONS" == "" ] ; then - JAVA_OPTIONS="-Xms256M -Xmx1024M -XX:+UseLargePages -XX:+UseParallelGC" + JAVA_OPTIONS="-Xms256M -Xmx1024M -XX:+UseParallelGC" fi add_option "$JAVA_OPTIONS" @@ -298,6 +324,10 @@ if [ "$GRIDWORKS_WEBAPP" == "" ] ; then fi add_option "-Dgridworks.webapp=$GRIDWORKS_WEBAPP" +if [ "$GRIDWORKS_TEST_DIR" == "" ] ; then + GRIDWORKS_TEST_DIR="tests" +fi + if [ "$GRIDWORKS_BUILD_DIR" == "" ] ; then GRIDWORKS_BUILD_DIR="build" fi @@ -326,6 +356,9 @@ case "$ACTION" in distclean) ant distclean;; + test) + test $1;; + run) run;; diff --git a/tests/lib-src/junit-4.8.1-sources.jar b/tests/lib-src/junit-4.8.1-sources.jar new file mode 100644 index 000000000..8d7a34703 Binary files /dev/null and b/tests/lib-src/junit-4.8.1-sources.jar differ diff --git a/tests/src/com/metaweb/gridworks/tests/GridworksTests.java b/tests/src/com/metaweb/gridworks/tests/GridworksTests.java new file mode 100644 index 000000000..cc362720f --- /dev/null +++ b/tests/src/com/metaweb/gridworks/tests/GridworksTests.java @@ -0,0 +1,9 @@ +package com.metaweb.gridworks.tests; + +import org.junit.Test; + +public class GridworksTests { + + @Test public void test() { + } +} \ No newline at end of file