diff options
-rwxr-xr-x | test/bin/scala-test | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/test/bin/scala-test b/test/bin/scala-test index 43c7c34a15..2c6088bdb1 100755 --- a/test/bin/scala-test +++ b/test/bin/scala-test @@ -134,6 +134,25 @@ test_compilation() { rm -rf "$output"; } +test_xml() { + output="$OBJDIR"/`expr "$source" : "\(.*\)\\.scala"`-$KIND.obj; + dtdfile="`expr "$source" : "\(.*\)\\.scala"`.dtd"; + xmlfile="`expr "$source" : "\(.*\)\\.scala"`.xml"; + objfile="$output/dtd.scala"; + classpath="$SCALA:$output:`$SCALA_INFO --default XERCES_CLASSES`"; + if $CYGWIN; then + classpath=`cygpath -w -p "$classpath"`; + fi; + rm -rf "$output"; + mkdir -p "$output" && + cp "$dtdfile" "$output/" && + cp "$xmlfile" "$output/dtd.xml" && + ( cd "$output"; $DTD2SCALA dtd.xml dtd ) && + $SOCOS -d "$output" $TEST_FLAGS $FLAGS "$objfile" "$source" && + java -classpath "$classpath" Test "$xmlfile" && + rm -rf "$output"; +} + test_compilation_success() { output="$OBJDIR"/`expr "$source" : "\(.*\)\\.scala"`-$KIND.obj; rm -rf "$output"; @@ -211,7 +230,7 @@ test_one() { for FROM do if [ -d "$FROM" -o -f "$FROM" ]; then - for FILE in . `find "$FROM" -name "*.scala"`; do + for FILE in . `find "$FROM" -name "*.obj" -prune -o -name "*.scala" -print`; do if [ "$FILE" = "." ]; then continue; fi; test_file; done; @@ -235,6 +254,8 @@ test_all() { test_interpretation "int" $FILES_RUN $FILES_INT; test_one "Testing jvm backend" \ test_compilation "jvm" $FILES_RUN $FILES_JVM; + test_one "Testing scala2xml tool" \ + test_xml "xml" $FILES_XML; test_one "Testing compiler (on files whose compilation should succeed)" \ test_compilation_success "pos" $FILES_POS; test_one "Testing compiler (on files whose compilation should fail)" \ @@ -255,6 +276,7 @@ print_help() { echo "--run next files test the interpreter and all backends"; echo "--int next files test the interpreter"; echo "--jvm next files test the jvm backend"; + echo "--xml next files test the scala2xml tool"; echo "--pos next files test a compilation success"; echo "--neg next files test a compilation failure"; echo "--no-run run no test, use results of last run"; @@ -354,6 +376,7 @@ add_file() { run ) FILES_RUN="$FILES_RUN $1"; return;; int ) FILES_INT="$FILES_INT $1"; return;; jvm ) FILES_JVM="$FILES_JVM $1"; return;; + xml ) FILES_XML="$FILES_XML $1"; return;; pos ) FILES_POS="$FILES_POS $1"; return;; neg ) FILES_NEG="$FILES_NEG $1"; return;; * ) abort "unknown test type \`$TEST_TYPE'";; @@ -382,6 +405,7 @@ main() { FILES_RUN=""; FILES_INT=""; FILES_JVM=""; + FILES_XML=""; FILES_POS=""; FILES_NEG=""; @@ -400,6 +424,7 @@ main() { --run ) TEST_TYPE="run"; shift 1;; --int ) TEST_TYPE="int"; shift 1;; --jvm ) TEST_TYPE="jvm"; shift 1;; + --xml ) TEST_TYPE="xml"; shift 1;; --pos ) TEST_TYPE="pos"; shift 1;; --neg ) TEST_TYPE="neg"; shift 1;; --no-run ) NORUN="true"; shift 1;; @@ -438,6 +463,8 @@ main() { find_program SOCOS scalac; find_program SURUS scalarun; find_runtime SCALA $SOCOS; + find_program DTD2SCALA dtd2scala; + find_program SCALA_INFO scala-info; if [ "$TEST_ALL" = "true" ]; then case "$TEST_TYPE" in @@ -450,6 +477,9 @@ main() { auto | jvm ) FILES_JVM="$FILES_JVM $SRCDIR/run $SRCDIR/jvm";; esac; case "$TEST_TYPE" in + auto | xml ) FILES_XML="$FILES_XML $SRCDIR/xml";; + esac; + case "$TEST_TYPE" in auto | pos ) FILES_POS="$FILES_POS $PREFIX/pos $PREFIX/cours";; esac; case "$TEST_TYPE" in |