From 8137c1492f49a291ebaf2843e6d01240a21ae96d Mon Sep 17 00:00:00 2001 From: Gilles Dubochet Date: Wed, 29 Apr 2009 11:35:28 +0000 Subject: Removed outdated test infastructure. --- test/clitest | 497 ---------------------- test/diff/diff.README | 16 - test/diff/diff.exe | Bin 150528 -> 0 bytes test/diff/libintl3.dll | Bin 92672 -> 0 bytes test/partestall | 8 - test/partestall.bat | 7 - test/scala2-nightly-test.scm | 137 ------ test/scala2-nightly-test.sh | 69 --- test/scalatest | 973 ------------------------------------------- test/scalatest.bat | 321 -------------- 10 files changed, 2028 deletions(-) delete mode 100755 test/clitest delete mode 100644 test/diff/diff.README delete mode 100755 test/diff/diff.exe delete mode 100755 test/diff/libintl3.dll delete mode 100755 test/partestall delete mode 100755 test/partestall.bat delete mode 100755 test/scala2-nightly-test.scm delete mode 100755 test/scala2-nightly-test.sh delete mode 100755 test/scalatest delete mode 100644 test/scalatest.bat diff --git a/test/clitest b/test/clitest deleted file mode 100755 index 9a26423d6e..0000000000 --- a/test/clitest +++ /dev/null @@ -1,497 +0,0 @@ -#!/bin/sh -############################################################################## -# __ # -# ________ ___ / / ___ Scala Tools Launch Script # -# / __/ __// _ | / / / _ | (c) 2002-2009, LAMP/EPFL # -# __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ # -# /____/\___/_/ |_/____/_/ | | # -# |/ # -############################################################################## - -# $Id$ - -############################################################################## -# Error functions - -# Prints a warning message on stderr. -warning() { - echo "$0: warning:" "$@" 1>&2; -} - -# Prints an error message on stderr. -error() { - echo "$0:" "$@" 1>&2; -} - -# Prints an error message on stderr and exits with a non-zero status. -abort() { - error "$@"; - exit 1; -} - -############################################################################## -# Printing functions - -# Initializes the printf functions -printf_initialization() { - case "$1" in - many ) - printf_font_outline="printf \\033[1;39m"; - printf_font_success="printf \\033[1;32m"; - printf_font_failure="printf \\033[1;31m"; - printf_font_warning="printf \\033[1;33m"; - printf_font_default="printf \\033[0;39m"; - ;; - some ) - printf_font_outline="printf \\033[1m"; - printf_font_success="printf \\033[0m"; - printf_font_failure="printf \\033[1m"; - printf_font_warning="printf \\033[1m"; - printf_font_default="printf \\033[0m"; - ;; - none ) - printf_font_outline=""; - printf_font_success=""; - printf_font_failure=""; - printf_font_warning=""; - printf_font_default=""; - ;; - * ) - abort "unknown color mode \`$1'"; - ;; - esac; -} - -# Prints formated text in outline font. -printf_outline() { - $printf_font_outline; - printf "$@"; - $printf_font_default; -} - -############################################################################## -# File name and path list conversion functions - -# Prints the OS-specific form of the specified Unix form file name. -get_os_filename() { - [ $# = 1 ] || abort "internal error"; - case "$UNAME" in - CYGWIN* ) cygpath --windows "$1";; - * ) echo "$@";; - esac; -} - -# Prints the Unix form of the specified OS-specific form file name. -get_unix_filename() { - [ $# = 1 ] || abort "internal error"; - case "$UNAME" in - CYGWIN* ) cygpath --unix "$1";; - * ) echo "$@";; - esac; -} - -# Prints the OS-specific form of the specified Unix form path list. -get_os_pathlist() { - [ $# = 1 ] || abort "internal error"; - case "$UNAME" in - CYGWIN* ) cygpath --window --path "$1";; - * ) echo "$@";; - esac; -} - -# Prints the Unix form of the specified OS-specific form path list. -get_unix_pathlist() { - [ $# = 1 ] || abort "internal error"; - case "$UNAME" in - CYGWIN* ) cygpath --unix --path "$1";; - * ) echo "$@";; - esac; -} - -############################################################################## -# Implementation of clitest - -# Prints the clitest usage. -test_print_usage() { - [ $# = 0 ] || abort "internal error"; - echo "Usage: $0 [OPTION]..." -} - -# Prints the clitest help. -test_print_help() { - [ $# = 0 ] || abort "internal error"; - test_print_usage; - echo ""; - echo "--quick use the 'quick' build instead of distribution"; - echo '--installed use the installed programs on $PATH' - echo "--debug redirect all outputs to standard output"; - echo "--info display information messages"; - echo "--javac run same tests with the Sun Java compiler"; - echo "--jikes run same tests with the IBM Java compiler"; - echo "--jredir= specify the Sun JRE installation directory (jikes)"; - echo "--objdir= specify where to place generated files"; - echo "--verbose display verbose messages"; - echo "--help, -? display this help and exit"; - echo "--version output version information and exit"; -} - -# Prints the clitest version. -test_print_version() { - [ $# = 0 ] || abort "internal error"; - echo "$SCRIPT 1.3"; -} - -# Adds a new file to the appropriate file list(s). -test_add_file() { - [ $# = 1 ] || abort "internal error"; - case "$1" in - *.scala ) - if [ ! \( -d "$1" -o -f "$1" \) ]; then - abort "don't know what to do with '$1'"; - fi; - dir=`dirname "$1"`; - file=`cd $dir && pwd`/`basename $1`; - FILES="$FILES $file";; - * ) - if [ ! -d "$1" ]; then - abort "don't know what to do with '$1'"; - fi; - dir=`cd "$1" && pwd`; - file=`find "$dir" -name "Main$SUFFIX" -a -type f -print`; - FILES="$FILES $file";; - esac; -} - -test_run() { - [ $# = 1 ] || abort "internal error"; - cmd="$1"; shift 1; - [ "$DEBUG" = "debug" ] && ( printf_outline "[DEBUG]"; echo "$cmd"); - eval "$cmd"; -} - -test_diff() { - [ $# = 2 ] || abort "internal error"; - check="$1"; shift 1; - log="$1"; shift 1; - [ "$DEBUG" = "debug" ] && return; - sed -e "s#$TEST_DIR/##g" $log > $TMP_FILE; - $DIFF $check $TMP_FILE > $DIFF_FILE - if [ -n "`cat $DIFF_FILE`" ] ; then - printf_outline "\\nDifferences between check and log files:\\n"; - file=`echo $check | sed -e "s#$PREFIX/##g"`; - printf "$file\\n"; - cat $DIFF_FILE; - fi -} - -test_compile() { - [ $# = 3 ] || abort "internal error"; - source="$1"; shift 1; - check="$1"; shift 1; - info="$1"; shift 1; - [ -d "$OUTPUT_DIR" ] || mkdir -p $OUTPUT_DIR; - [ -f "$LOG_FILE" ] && $RM $LOG_FILE; - if [ "$COMPILER" = "javac" ] || [ "$COMPILER" = "jikes" ]; then - suffix=".${COMPILER}"; - [ "$LANG" = "java5" ] && suffix=".${COMPILER}5"; - [ "$LANG" = "java6" ] && suffix=".${COMPILER}6"; - else - suffix=".$COMPILER"; - fi; - file=`echo $source | sed -e "s#$PREFIX/##g"`; - if [ "$LEVEL" = "info" ] || [ "$LEVEL" = "verbose" ] ; then - printf_outline "\\nSource file: $file\\n" - cat $source; - fi - printf "\\n"; - - #=`get_unix_filename "$source"`; - printf "Compile $file ($info) with unknown option '-dd'\\n" - test_run "env CLASSPATH= $COMPILER_COMMAND \ - -dd $OUTPUT_DIR $source 2>> $LOG_FILE 1>> $LOG_FILE"; - - printf "Compile $file ($info) with no classpath information\\n" - test_run "env CLASSPATH= $COMPILER_COMMAND \ - -d $OUTPUT_DIR $source 2>> $LOG_FILE 1>> $LOG_FILE"; - - printf "Compile $file ($info) with variable CLASSPATH\\n" - test_run "env CLASSPATH=$OUTPUT_DIR $COMPILER_COMMAND \ - -d $OUTPUT_DIR $source 2>> $LOG_FILE 1>> $LOG_FILE"; - - printf "Compile $file ($info) with option -classpath\\n" - test_run "env CLASSPATH= $COMPILER_COMMAND -classpath $OUTPUT_DIR \ - -d $OUTPUT_DIR $source 2>> $LOG_FILE 1>> $LOG_FILE"; - - printf "Compile $file ($info) with current directory as default classpath\\n" - test_run "(cd $OUTPUT_DIR && - env CLASSPATH= $COMPILER_COMMAND $source 2>> $LOG_FILE 1>> $LOG_FILE)"; - - test_diff "$check$suffix" "$LOG_FILE"; - - if [ "$LEVEL" = "verbose" ] ; then - printf_outline "\\nTest directory:\\n"; - $TREE $TMP_DIR; - fi -} - -test_execute() { - [ $# = 2 ] || abort "internal error"; - main="$1"; shift 1; - check="$1"; shift 1; - suffix=".$LANG"; - [ "$LANG" = "java6" ] && suffix=".java5"; - - [ -f "$LOG_FILE" ] && $RM $LOG_FILE; - printf "\\n"; - - printf "Execute $main with unknown option '-cpp'\\n" - test_run "env CLASSPATH= \ - $RUNTIME_COMMAND -cpp $OUTPUT_DIR $main 2 \ - 2>> $LOG_FILE 1>> $LOG_FILE"; - - printf "Execute $main with variable CLASSPATH\\n" - test_run "env CLASSPATH=$OUTPUT_DIR \ - $RUNTIME_COMMAND $main 1 \ - 2>> $LOG_FILE 1>> $LOG_FILE"; - - printf "Execute $main with option -classpath\\n" - test_run "env CLASSPATH= \ - $RUNTIME_COMMAND -classpath $OUTPUT_DIR $main 2 \ - 2>> $LOG_FILE 1>> $LOG_FILE"; - - printf "Execute $main with current directory as default classpath\\n" - test_run "(cd $OUTPUT_DIR && - env CLASSPATH= $RUNTIME_COMMAND $main 3 2>> $LOG_FILE 1>> $LOG_FILE)"; - - printf "Execute $main with quoted argument\\n" - test_run "env CLASSPATH= \ - $RUNTIME_COMMAND -classpath $OUTPUT_DIR $main 4 \"a b c\" \ - 2>> $LOG_FILE 1>> $LOG_FILE"; - - test_diff "$check$suffix" "$LOG_FILE"; -} - -test_interpret() { - [ $# = 2 ] || abort "internal error"; - main="$1"; shift 1; - check="$1"; shift 1; - [ "$LANG" = "scala" ] || return; - [ -f "$LOG_FILE" ] && $RM $LOG_FILE; - printf "\\n" - - printf "Interpret $main with unknown option '-cpp'\\n" - test_run "(env CLASSPATH= \ - printf $main'.main(Array(\"0\"))\n:q' | $INTERPRETER_COMMAND \ - -cpp $OUTPUT_DIR 2>> $LOG_FILE 1>> $LOG_FILE)"; - printf "\\n" >> $LOG_FILE # newline - - printf "Interpret $main with variable CLASSPATH\\n" - test_run "(printf $main'.main(Array(\"1\"))\n:q' \ - | env CLASSPATH=$OUTPUT_DIR $INTERPRETER_COMMAND \ - 2>> $LOG_FILE 1>> $LOG_FILE)"; - printf "\\n" >> $LOG_FILE # newline - - printf "Interpret $main with option -classpath\\n" - test_run "(env CLASSPATH= \ - printf $main'.main(Array(\"2\"))\n:q' | $INTERPRETER_COMMAND \ - -classpath $OUTPUT_DIR 2>> $LOG_FILE 1>> $LOG_FILE)"; - printf "\\n" >> $LOG_FILE # newline - - printf "Interpret $main with current directory as default classpath\\n" - test_run "(cd $OUTPUT_DIR && - printf $main'.main(Array(\"3\"))\n:q' | $INTERPRETER_COMMAND \ - 2>> $LOG_FILE 1>> $LOG_FILE)"; - printf "\\n" >> $LOG_FILE # newline - - test_diff "$check.scalaint" "$LOG_FILE"; -} - -test_docgen() { - [ $# = 2 ] || abort "internal error"; - source="$1"; shift 1; - check="$1"; shift 1; - [ -d "$OUTPUT_DIR" ] || mkdir -p $OUTPUT_DIR; - [ -f "$LOG_FILE" ] && $RM $LOG_FILE; - [ -d "$API_DIR" ] && $RM -r "$API_DIR/*" || mkdir -p $API_DIR; - suffix=".${LANG}_api"; - file=`echo $source | sed -e "s#$PREFIX/##g"`; - if [ "$LEVEL" = "info" ] || [ "$LEVEL" = "verbose" ] ; then - printf_outline "\\nSource file: $file\\n" - cat $source; - fi - printf "\\n"; - - printf "Generate documentation for $file\\n" - test_run "env CLASSPATH= $DOCGEN_COMMAND \ - -d $API_DIR $source 2>> $LOG_FILE 1>> $LOG_FILE"; - - n=`$TREE $API_DIR | wc -l`; - $TREE $API_DIR | tail -n `echo "$n-1" | bc` > "$LOG_FILE"; - test_diff "$check$suffix" "$LOG_FILE"; - - if [ "$LEVEL" = "verbose" ] ; then - printf_outline "\\nAPI directory:\\n"; - $TREE $API_DIR; - fi -} - -############################################################################## -# Initialization - -unset SCRIPT; -UNAME=`uname`; -SOURCE=$0; -SCRIPT=`basename "$SOURCE"`; -while [ -h "$SOURCE" ]; do - SCRIPT=`basename "$SOURCE"`; - LOOKUP=`ls -ld "$SOURCE"`; - TARGET=`expr "$LOOKUP" : '.*-> \(.*\)$'`; - if expr "${TARGET:-.}/" : '/.*/$' > /dev/null; then - SOURCE=${TARGET:-.}; - else - SOURCE=`dirname "$SOURCE"`/${TARGET:-.}; - fi; -done; -PREFIX=`dirname "$SOURCE"`/..; -prefix=$PREFIX; -PREFIX=`cd "$PREFIX"; pwd`; - -QUICK="$PREFIX/build/quick/bin/" -if [ -d "$PREFIX/dists" ]; then - LATEST="$PREFIX/dists/latest/bin/"; -else - if [ -d "$PREFIX/build" ]; then - LATEST="$QUICK"; - else - LATEST="$PREFIX/bin/"; - fi; -fi; -BIN_DIR="$LATEST" - -if [ -n "`which mktemp`" ] ; then - TMP_DIR=`mktemp -d` -else - TMP_DIR=${TMPDIR-/tmp}/tmp-$USER.`basename $0` -fi - -if [ -d "$PREFIX/test" ]; then - TEST_DIR="$PREFIX/test"; -elif [ -d "$PREFIX/misc/scala-test" ]; then - TEST_DIR="$PREFIX/misc/scala-test"; -else - abort "Test directory not found"; -fi; -SOURCE_DIR=$TEST_DIR/files/cli -OUTPUT_DIR=$TMP_DIR/classes -API_DIR=$TMP_DIR/api - -DIFF="diff"; -RM="rm -f"; -TREE="tree"; - -case `uname` in - CYGWIN* ) - DIFF="diff --text --strip-trailing-cr"; - ;; -esac; - -DEBUG=""; -LANG="scala"; -SUFFIX=".scala"; -COMPILER="scalac"; -LEVEL=""; -while [ $# -gt 0 ]; do - case "$1" in - --debug ) DEBUG="debug"; LEVEL="verbose"; shift 1;; - --quick ) BIN_DIR="$QUICK"; shift 1;; - --installed) BIN_DIR=""; shift 1;; - --info ) LEVEL="info"; shift 1;; - --javac ) LANG="java"; SUFFIX=".java"; COMPILER="javac"; shift 1;; - --jikes ) LANG="java"; SUFFIX=".java"; COMPILER="jikes"; shift 1;; - --jredir=* ) JRE_DIR=`expr "$1" : "--jredir=\(.*\)"`; shift 1;; - --objdir=* ) OUTPUT_DIR=`expr "$1" : "--objdir=\(.*\)"`; shift 1;; - --verbose ) LEVEL="verbose"; shift 1;; - --help ) test_print_help; exit 0;; - --version ) test_print_version; exit 0;; - -* ) abort "unknown option $1";; - * ) test_add_file "$1"; shift 1;; #test_print_usage; exit 0;; - esac; -done; - -if [ "$LANG" = "scala" ]; then - RUNTIME_COMMAND="${BIN_DIR}scala"; - COMPILER_COMMAND="${BIN_DIR}$COMPILER"; - INTERPRETER_COMMAND="${BIN_DIR}scala"; - DOCGEN_COMMAND="${BIN_DIR}scaladoc"; -elif [ "$LANG" = "java" ]; then - RUNTIME_COMMAND=`which ${JAVACMD:=java}` - BIN_DIR=`dirname $RUNTIME_COMMAND`; - [ "$COMPILER" = "javac" ] && COMPILER_COMMAND=$BIN_DIR/$COMPILER; - [ "$COMPILER" = "jikes" ] && COMPILER_COMMAND=`which $COMPILER`; - DOCGEN_COMMAND=`dirname "$COMPILER_COMMAND"`/javadoc; -else - abort "unknown language '$LANG'" -fi -[ -x "$COMPILER_COMMAND" ] || abort "Command $COMPILER_COMMAND not found"; -[ -x "$RUNTIME_COMMAND" ] || abort "Command $RUNTIME_COMMAND not found"; - -printf_initialization "${COLOR:-many}"; - -printf_outline "Output directory is : $OUTPUT_DIR\\n"; -printf_outline "Compiler command is : $COMPILER_COMMAND\\n"; -printf_outline "Runtime command is : $RUNTIME_COMMAND\\n"; - -jvm_version=`${JAVACMD:=java} -version 2>&1 | head -3 | tail -1` -printf_outline "Java runtime is : $jvm_version\\n"; -if [ "$LANG" = "scala" ]; then - [ `echo "$jvm_version" | grep -c "J9"` = "1" ] && LANG="${LANG}_j9"; -elif [ "$LANG" = "java" ]; then - if [ "$COMPILER" = "jikes" ]; then - if [ "$LANG" = "java" ]; then - jre_home=`dirname $RUNTIME_COMMAND`/..; - elif [ -n "$JRE_DIR" ]; then - jre_home=$JRE_DIR; - else - abort "Jikes requires Sun JVM (use option '--jredir')"; - fi; - cpath=`find $jre_home -name "rt.jar"`; - COMPILER_COMMAND="${COMPILER_COMMAND} -bootclasspath $cpath"; - fi; - [ `echo "$jvm_version" | grep -c "1\.5"` = "1" ] && LANG="${LANG}5"; - [ `echo "$jvm_version" | grep -c "1\.6"` = "1" ] && LANG="${LANG}6"; - [ `echo "$jvm_version" | grep -c "J9"` = "1" ] && LANG="${LANG}_j9"; -fi - -if [ "$DEBUG" = "debug" ] ; then - LOG_FILE=/dev/tty -else - LOG_FILE=${TMP_DIR}/${SCRIPT}.log -fi -DIFF_FILE=${TMP_DIR}/${SCRIPT}.diff -TMP_FILE=${TMP_DIR}/${SCRIPT}.tmp - -############################################################################## - -if [ -z "$FILES" ]; then - FILES=`find "$SOURCE_DIR" -name "Main$SUFFIX" -a -type f -print`; -fi; -for testfile in "" $FILES; do - [ -z "$testfile" ] && continue; - checkfile=`dirname "$testfile"`/`basename "$testfile" "$SUFFIX"`.check - info=`awk '$1 ~ /^\/\//{i=index($0,"@info ");if(i>0){print substr($0,i+6)}}' "$testfile"`; - test_compile "$testfile" "$checkfile" "$info"; - if [ "$?" = "0" ] ; then - scala_main=`echo "$testfile" | \ - sed -e "s#${SOURCE_DIR}/\(.*\)\${SUFFIX}#\1#g" -e "s#\/#\.#g"`; - test_execute "$scala_main" "$checkfile"; - test_interpret "$scala_main" "$checkfile"; - test_docgen "$testfile" "$checkfile"; - fi -done; - -############################################################################## -# Epilog - -$RM -r $TMP_DIR - -############################################################################## diff --git a/test/diff/diff.README b/test/diff/diff.README deleted file mode 100644 index 839a1c2c9b..0000000000 --- a/test/diff/diff.README +++ /dev/null @@ -1,16 +0,0 @@ -DiffUtils for Windows 2.8.7 ---------------------------- - -DiffUtils shows differences between files. - -Source: http://gnuwin32.sourceforge.net/packages/diffutils.htm - - -The minimal set of files required to run diff is the following: - - bin\diff.exe (150528 bytes) - bin\libiconv2.dll (898048 bytes) - bin\libintl3.dll (92672 bytes) - - -$Id: diff.README 7771 2006-06-12 13:22:39Z dubochet $ diff --git a/test/diff/diff.exe b/test/diff/diff.exe deleted file mode 100755 index 85f370d867..0000000000 Binary files a/test/diff/diff.exe and /dev/null differ diff --git a/test/diff/libintl3.dll b/test/diff/libintl3.dll deleted file mode 100755 index 2efd2117cd..0000000000 Binary files a/test/diff/libintl3.dll and /dev/null differ diff --git a/test/partestall b/test/partestall deleted file mode 100755 index a1f585e090..0000000000 --- a/test/partestall +++ /dev/null @@ -1,8 +0,0 @@ -scala -cp ~/scala/build/quick/lib/partest:$HOME/scala/build/quick/lib/actors scala.tools.partest.nest.NestRunner --run -scala -cp ~/scala/build/quick/lib/partest:$HOME/scala/build/quick/lib/actors scala.tools.partest.nest.NestRunner --jvm -scala -cp ~/scala/build/quick/lib/partest:$HOME/scala/build/quick/lib/actors scala.tools.partest.nest.NestRunner --jvm5 -scala -cp ~/scala/build/quick/lib/partest:$HOME/scala/build/quick/lib/actors scala.tools.partest.nest.NestRunner --pos -scala -cp ~/scala/build/quick/lib/partest:$HOME/scala/build/quick/lib/actors scala.tools.partest.nest.NestRunner --neg -scala -cp ~/scala/build/quick/lib/partest:$HOME/scala/build/quick/lib/actors scala.tools.partest.nest.NestRunner --shootout -sh scalatest --res -sh scalatest --script diff --git a/test/partestall.bat b/test/partestall.bat deleted file mode 100755 index b8b8155225..0000000000 --- a/test/partestall.bat +++ /dev/null @@ -1,7 +0,0 @@ -scala -cp C:\scala\build\quick\lib\partest;C:\scala\build\quick\lib\actors scala.tools.partest.nest.NestRunner --run -scala -cp C:\scala\build\quick\lib\partest;C:\scala\build\quick\lib\actors scala.tools.partest.nest.NestRunner --jvm -scala -cp C:\scala\build\quick\lib\partest;C:\scala\build\quick\lib\actors scala.tools.partest.nest.NestRunner --jvm5 -scala -cp C:\scala\build\quick\lib\partest;C:\scala\build\quick\lib\actors scala.tools.partest.nest.NestRunner --pos -scala -cp C:\scala\build\quick\lib\partest;C:\scala\build\quick\lib\actors scala.tools.partest.nest.NestRunner --neg -scala -cp C:\scala\build\quick\lib\partest;C:\scala\build\quick\lib\actors scala.tools.partest.nest.NestRunner --shootout - diff --git a/test/scala2-nightly-test.scm b/test/scala2-nightly-test.scm deleted file mode 100755 index f3c68341f0..0000000000 --- a/test/scala2-nightly-test.scm +++ /dev/null @@ -1,137 +0,0 @@ -#!/bin/sh -exec scsh -e main -s "$0" "$@" -!# - -;; Script to perform the nightly test/build of Scala. -;; -;; Always make sure that the latest version of this file is copied to -;; ~scalatest/bin/scala2-nightly-test.scm -;; -;; $Id$ - -;; SVN repository containing the Scala compiler. -(define scala-svn-repository-dir - "http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk") -(define plugin-svn-repository-dir - "http://lampsvn.epfl.ch/svn-repos/scala/plugin") - -;; SVN module containing the compiler. -(define scala-svn-module-name "scala") -(define plugin-svn-module-name "plugin") - -;; E-mail address to which the failure notification should be sent. -(define notify-email "scala-reports@epfl.ch") -;;(define notify-email "stephane.micheloud@epfl.ch") ; DEBUG -;;(define notify-email "lex.spoon@epfl.ch") ; DEBUG -;;(define notify-email "gilles.dubochet@epfl.ch") ; DEBUG - -;; Directory in which the distribution should be built. -(define nightly-build-dir -;; (expand-file-name "~lex/scala/nightly")) ; DEBUG - (expand-file-name "/home/linuxsoft/archives/scala/nightly")) - -;; End of configuration section. - -(define (main cmd-line) - (let ((prog (car cmd-line)) - (args (cdr cmd-line))) - (if (= 1 (length args)) - (scala-test (first args)) - (display-usage-and-exit prog)))) - -(define (display-usage-and-exit prog) - (format #t "Usage: ~a \n" prog) - (exit 1)) - -(define (get-public-link file) - (temp-file-iterate (lambda (link) (create-symlink file link) link) - (expand-file-name "~/public_html/log-scala2-~a.txt"))) - -(define (get-checkout-dir base-dir date) - (expand-file-name (string-append (format-date "~Y-~m-~d" date) "-scala2") base-dir)) - -(define (start-section title) - (format #t "\n* ~a\n\n" title)) - -(define (scala-test base-dir) - (let* ((checkout-dir (get-checkout-dir base-dir (date))) - (log-file (expand-file-name "log-scala2" checkout-dir))) - (create-directory checkout-dir) - (call-with-output-file log-file - (lambda (log-port) - (with-current-output-port log-port - (with-current-error-port log-port - (stdports->stdio) - (with-cwd checkout-dir - (if (not (call-with-current-continuation scala-do-test)) - (let ((link (get-public-link log-file))) - (send-warning-mail log-file - (file-name-nondirectory link))))))))))) - -(define (scala-do-test return) - (dynamic-wind - (lambda () - (display "In Emacs, read this file in -*- Outline -*- mode\n") - (start-section "Starting time") - (display (format-date "~Y-~m-~d ~H:~M ~Z\n" (date)))) - (lambda () - (let ((fail-if-error (lambda (code) (if (not (zero? code)) - (return #f))))) - (start-section "Checking out Scala module") - (fail-if-error (run (svn co ,scala-svn-repository-dir - ,scala-svn-module-name))) - (with-cwd scala-svn-module-name - (start-section "Creating small Scala distribution") - (fail-if-error (run (ant pack))) - (run (ant msil))) - - (start-section "Checking out Plugin module") - (fail-if-error (run (svn co ,plugin-svn-repository-dir - ,plugin-svn-module-name))) - - (with-cwd plugin-svn-module-name - (start-section "Creating Scala Eclipse plugin") - (fail-if-error (run (ant dist)))) - - (with-cwd scala-svn-module-name - (start-section "Testing Scala compiler") - (fail-if-error - (run (./test/scalatest --color=none - --show-log)))) - #t - ) - ) - (lambda () - (start-section "Ending time") - (display (format-date "~Y-~m-~d ~H:~M ~Z\n" (date)))))) - -(define (send-warning-mail log-file-name link-name) - (send-mail - notify-email - `(("Subject" . "Failure of nightly Scala 2 test") - ("To" . ,notify-email) - ("Reply-To" . ,notify-email)) - (string-append - "Tonight's automatic Scala test failed. More details can be found\n" - "in file "log-file-name"\n" - "which is available through the following URL:\n\n" - " http://lamp.epfl.ch/~scalatest/"link-name"\n" - "\n" - (run/string (fgrep "[FAILED]" ,log-file-name))))) - -(define (send-mail to headers body) - (let ((mail-port (make-string-output-port))) - (for-each (lambda (name/contents) - (format mail-port "~a: ~a\n" - (car name/contents) - (cdr name/contents))) - headers) - (newline mail-port) - (write-string body mail-port) - (newline mail-port) - (run (/usr/sbin/sendmail "-i" ,to) - (<< ,(string-output-port-output mail-port))))) - -;;; Local Variables: -;;; mode:scheme -;;; End: diff --git a/test/scala2-nightly-test.sh b/test/scala2-nightly-test.sh deleted file mode 100755 index eca99c8016..0000000000 --- a/test/scala2-nightly-test.sh +++ /dev/null @@ -1,69 +0,0 @@ -#!/bin/sh - -[ -z "$JAVA_SDK" ] && ( echo "Variable JAVA_SDK not specified"; exit 1 ) - -ANDROID_HOME=/home/linuxsoft/apps/android -ANT_HOME=/home/linuxsoft/apps/ant -JAVA_HOME=/home/linuxsoft/apps/$JAVA_SDK -# uses scsh wrapper in ~/bin instead (mics) -#SCSH_HOME=/home/linuxsoft/apps/scsh-rh9 -# Mono on linuxsoft is a 32-bit distro -#MONO_HOME=/home/linuxsoft/apps/mono -MONO_HOME=/opt/mono -KVEM_HOME=/home/linuxsoft/apps/java-wtk -RETROWEAVER_HOME=/home/linuxsoft/apps/retroweaver - -[ -d "$JAVA_HOME" ] || (echo "Invalid directory $JAVA_HOME"; exit 1 ) - -PATH=/usr/local/bin:/bin:/usr/bin:/usr/sbin -PATH=$ANT_HOME/bin:$JAVA_HOME/bin:$MONO_HOME/bin:$ANDROID_HOME/tools:$KVEM_HOME/bin:~/bin:$PATH - -LD_LIBRARY_PATH=/lib:/usr/lib - -ANT_OPTS="-Xms1024M -Xmx1024M -XX:MaxPermSize=128M" -BUILD_DATE=`date +"%Y-%m-%d"` - -OUTPUT_DIR=~/scala-nightly-test/$JAVA_SDK -TARGET_DIR=$OUTPUT_DIR/$BUILD_DATE-scala2 -#BUILD_DIR=$TARGET_DIR/scala/build -LATEST_DIR=$TARGET_DIR/scala/dists -LATEST_PLUGIN_DIR=$TARGET_DIR/plugin/dist -NIGHTLY_DIR=/home/linuxsoft/archives/scala/nightly - -[ -d "$OUTPUT_DIR" ] || mkdir -p "$OUTPUT_DIR" - -JAVACMD=$JAVA_HOME/bin/java - -killall -9 scshvm 2>1 -killall -9 java 2>1 - -env PATH="$PATH" ANT_OPTS="$ANT_OPTS" JAVACMD="$JAVACMD" \ - ANDROID_HOME="$ANDROID_HOME" RETROWEAVER_HOME="$RETROWEAVER_HOME" \ - ~/bin/scala2-nightly-test.scm $OUTPUT_DIR - -# only build for Java 1.5 is made available on the page -# http://www.scala-lang.org/downloads/distrib/files/nightly/ -test "$JAVA_SDK" != "java-1.5" && exit 0 - -if [ -d "$LATEST_DIR" ] && [ `ls "$LATEST_DIR"/*.zip 2>1 | wc -l` -gt 0 ]; then - sbp_script="s/\(scala[a-z\-]*[0-9]\+\.[0-9]\+\.[0-9]\+\).*\(\.sbp\)/\1-latest\2/g" - tgz_script="s/\(scala[a-z\-]*[0-9]\+\.[0-9]\+\.[0-9]\+\).*\(\.tgz\)/\1-latest\2/g" - zip_script="s/\(scala[a-z\-]*[0-9]\+\.[0-9]\+\.[0-9]\+\).*\(\.zip\)/\1-latest\2/g" - (rm -rf $NIGHTLY_DIR && mkdir $NIGHTLY_DIR) - (cd $LATEST_DIR && cp *.tgz *.zip *.md5 *.sbp *.advert $NIGHTLY_DIR) - (cd $TARGET_DIR && cp log-scala2 $NIGHTLY_DIR) - (cd $NIGHTLY_DIR && tar xzf scala-*[^sources].tgz) - (cd $NIGHTLY_DIR && for f in *.sbp; do [ -h "$f" ] && continue; ln -sf $f `echo $f | sed -e "$sbp_script"`; done) - (cd $NIGHTLY_DIR && for f in *.tgz; do [ -h "$f" ] && continue; ln -sf $f `echo $f | sed -e "$tgz_script"`; done) - (cd $NIGHTLY_DIR && for f in *.zip; do [ -h "$f" ] && continue; ln -sf $f `echo $f | sed -e "$zip_script"`; done) -fi -if [ -d "$LATEST_PLUGIN_DIR" ]; then - latest_script="s/\(scala[a-z._]*[0-9]\+\.[0-9]\+\.[0-9]\+\).*\(\.zip\)/\1-latest\2/g" - (cd $LATEST_PLUGIN_DIR && cp -r *.zip scala.update $NIGHTLY_DIR) - (cd $NIGHTLY_DIR && for f in *.zip; do [ -h "$f" ] && continue; ln -sf $f `echo $f | sed -e "$latest_script"`; done) -fi -#disabled -#if [ -d "$BUILD_DIR/api-compiler" ] && [ -d "$NIGHTLY_DIR/scala/doc/scala" ]; then -# cp -r $BUILD_DIR/api-compiler $NIGHTLY_DIR/scala/doc/scala -#fi - diff --git a/test/scalatest b/test/scalatest deleted file mode 100755 index 6792a8b3c9..0000000000 --- a/test/scalatest +++ /dev/null @@ -1,973 +0,0 @@ -#!/bin/sh -############################################################################## -# __ # -# ________ ___ / / ___ Scala Tools Launch Script # -# / __/ __// _ | / / / _ | (c) 2002-2009, LAMP/EPFL # -# __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ # -# /____/\___/_/ |_/____/_/ | | # -# |/ # -############################################################################## - -# $Id$ - -############################################################################## -# Error functions - -# Prints a warning message on stderr. -warning() { - echo "$0: warning:" "$@" 1>&2; -} - -# Prints an error message on stderr. -error() { - echo "$0:" "$@" 1>&2; -} - -# Prints an error message on stderr and exits with a non-zero status. -abort() { - error "$@"; - exit 1; -} - -############################################################################## -# Printing functions - -# Initializes the printf functions -printf_initialization() { - case "$1" in - many ) - printf_font_outline="printf \\033[1;39m"; - printf_font_success="printf \\033[1;32m"; - printf_font_failure="printf \\033[1;31m"; - printf_font_warning="printf \\033[1;33m"; - printf_font_default="printf \\033[0;39m"; - ;; - some ) - printf_font_outline="printf \\033[1m"; - printf_font_success="printf \\033[0m"; - printf_font_failure="printf \\033[1m"; - printf_font_warning="printf \\033[1m"; - printf_font_default="printf \\033[0m"; - ;; - none ) - printf_font_outline=""; - printf_font_success=""; - printf_font_failure=""; - printf_font_warning=""; - printf_font_default=""; - ;; - * ) - abort "unknown color mode \`$1'"; - ;; - esac; -} - -# Prints formated text in outline font. -printf_outline() { - $printf_font_outline; - printf "$@"; - $printf_font_default; -} - -# Prints formated text in success font. -printf_success() { - $printf_font_success; - printf "$@"; - $printf_font_default; -} - -# Prints formated text in failure font. -printf_failure() { - $printf_font_failure; - printf "$@"; - $printf_font_default; -} - -# Prints formated text in warning font. -printf_warning() { - $printf_font_warning; - printf "$@"; - $printf_font_default; -} - -############################################################################## -# File name and path list conversion functions - -# Prints the OS-specific form of the specified Unix form file name. -get_os_filename() { - [ $# = 1 ] || abort "internal error"; - case "$UNAME" in - CYGWIN* ) cygpath --windows "$1";; - * ) echo "$@";; - esac; -} - -# Prints the Unix form of the specified OS-specific form file name. -get_unix_filename() { - [ $# = 1 ] || abort "internal error"; - case "$UNAME" in - CYGWIN* ) cygpath --unix "$1";; - * ) echo "$@";; - esac; -} - -# Prints the OS-specific form of the specified Unix form path list. -get_os_pathlist() { - [ $# = 1 ] || abort "internal error"; - case "$UNAME" in - CYGWIN* ) cygpath --window --path "$1";; - * ) echo "$@";; - esac; -} - -# Prints the Unix form of the specified OS-specific form path list. -get_unix_pathlist() { - [ $# = 1 ] || abort "internal error"; - case "$UNAME" in - CYGWIN* ) cygpath --unix --path "$1";; - * ) echo "$@";; - esac; -} - -# Collects all jar files in the given path -get_ext_classpath() { - [ $# = 1 ] || abort "internal error"; - # Constructing the extension classpath - cp="" - for ext in `ls $1/*.jar` ; do - if [ -z "$cp" ] ; then - cp="$ext" - else - cp="$cp:$ext" - fi - done - - echo $cp -} - -############################################################################## -# Implementation of scalatest - -# Prints the scalatest usage. -test_print_usage() { - [ $# = 0 ] || abort "internal error"; - echo "Usage: `basename $0` [OPTION]... [FILE]..." -} - -# Prints the scalatest help. -test_print_help() { - [ $# = 0 ] || abort "internal error"; - test_print_usage; - echo ""; - echo "--auto use filenames to select the test to run"; - echo "--dis next files test the class file disassembler"; - echo "--run next files test the interpreter and all backends"; - echo "--jvm next files test the JVM backend"; - echo "--pos next files test a compilation success"; - echo "--neg next files test a compilation failure"; - echo "--res next files test the resident compiler"; - echo "--msil next files test the .NET backend"; - echo "--script next files test Scala embedded in scripts"; - echo "--ant next files test the Ant tasks"; - echo "--pending perform the tests in the 'pending' directory"; - echo "--shootout next files test Debian's language shootout benchmarks"; - echo "--quick use the 'quick' build instead of distribution"; - echo '--installed use the installed programs on $PATH' - echo "--no-run run no test, use results of last run"; - echo "--show-log show output of failed tests"; - echo "--show-diff show differences between actual and expected output"; - echo "--use-fsc use the Fast Scala compiler"; - echo "--failed test only files that failed last time"; - echo "--errors= specify the number of expected errors"; - echo "--flags= specify flags to pass on to the executable"; - echo "--color=USAGE control the color usage (USAGE=none|some|many)"; - echo "--objdir= specify where to place generated files"; - echo "--help, -? display this help and exit"; - echo "--version output version information and exit"; - echo ""; - echo "Report bugs to "; -} - -# Prints the scalatest version. -test_print_version() { - [ $# = 0 ] || abort "internal error"; - echo "$SCRIPT "'$Revision$'; -} - -# Prints the name of the specified test file. -test_print_testing() { - [ $# = 1 ] || abort "internal error"; - printf_outline "testing: "; - case "$1" in - "$TESTROOT"* ) - printf "%-60s " "[...]`expr "$1" : "$TESTROOT\(.*\)"`"; - return 0; - ;; - esac; - printf "%-60s " "$1"; -} - -# Prints a test success notification. -test_print_success() { - [ $# = 0 ] || abort "internal error"; - printf "["; - printf_success " OK "; - printf "]\\n"; -} - -# Prints a test failure notification. -test_print_failure() { - [ $# = 0 ] || abort "internal error"; - printf "["; - printf_failure "FAILED"; - printf "]\\n"; -} - - -# Tests a compilation success. -test_run_pos() { - rm -rf "$dstbase".obj && - mkdir -p "$dstbase".obj && - $SCALAC -d "$os_dstbase".obj "$@" "$os_srcbase".scala && - rm -rf "$dstbase".obj; -} - - -# Tests a compilation failure. -test_run_neg() { - rm -rf "$dstbase".obj && - mkdir -p "$dstbase".obj && - ( cd "$srcdir" && $SCALAC -d "$os_dstbase".obj "$@" "$testname".scala; ); - if [ "$?" = 0 ]; then status=1; else status=0; fi; - rm -rf "$dstbase".obj; - return $status; -} - - -# Tests resident compiler. -test_run_res() { - rm -rf "$dstbase".obj && - mkdir -p "$dstbase".obj && - (cd "$srcdir" && cat "$testname".res | $SCALAC -d "$os_dstbase".obj -Xresident -sourcepath . "$@"; ); - #(cd "$TESTROOT" && cat "$srcdir/$testname".res | $SCALAC -d "$os_dstbase".obj -Xresident -sourcepath "$srcdir" "$@"; ); - rm -rf "$dstbase".obj; -} - - -# Tests the JVM backend. -# NB. property '-Djavacmd=$JAVACMD' is e.g used by jvm/inner.scala -test_run_jvm() { - javaopts=$JAVA_OPTS; - if [ -f "$os_srcbase".javaopts ]; then - javaopts="$javaopts `cat "$os_srcbase".javaopts`" - if [ "$JAVA5" = "false" ]; then - # -Xss option available in Java versions 1.5 or newer - javaopts=`echo "$javaopts" | sed -e "s/-Xss[0-9]*[MmKk]//g"` - fi - fi - rm -rf "$dstbase".obj && - mkdir -p "$dstbase".obj && - ext_classpath=`get_os_pathlist "$JVM_EXT_CLASSPATH"` && - (cd "$srcdir" && env JAVACMD="$JAVACMD" JAVA_OPTS="$javaopts" $SCALAC -d "$os_dstbase".obj \ - -cp "$ext_classpath" "$@" "$testname".scala ) && - libpath=`get_os_pathlist "$dstdir"` && - scala_javaopts=`echo -Djava.library.path=$libpath` && - scala_lib=`get_os_filename "$SCALA_LIB"` && - classpath=`get_os_pathlist "$os_dstbase".obj:$CLASSPATH:$ext_classpath` && - env JAVA_OPTS="$scala_javaopts" $SCALA -Djavacmd="$JAVACMD" \ - -Dscalatest.output=$os_dstbase.obj -Dscalatest.lib=$scala_lib \ - -classpath "$classpath" Test "jvm" && - rm -rf "$dstbase".obj; -} - -# Test the disassemblers. -test_run_dis() { - argsfile="$srcbase".args; - [ ! -f "$argsfile" ] && argsfile=/dev/null; - rm -rf "$dstbase".obj && - mkdir -p "$dstbase".obj && - $SCALAC -d "$os_dstbase".obj "$@" "$os_srcbase".scala && - $SCALAP -classpath "$os_dstbase".obj `cat "$argsfile"` && - rm -rf "$dstbase".obj; -} - -MSIL="msil" -EXE="exe" -# Tests the .NET backend. -test_run_msil() { - assemblies=`get_os_pathlist $SCALA_ASSEM`; - rm -f "$dstbase".$MSIL && - rm -f "$dstbase".$EXE && - - $SCALAC -nowarn -Xassem "$os_dstbase" -Xassem-path $assemblies "$@" \ - -sourcepath "$PREFIX/build/msil/src" "$os_srcbase".scala && - case "$UNAME" in - CYGWIN* ) - $ILASM /qui /nol /out="$os_dstbase".$EXE "$os_dstbase".$MSIL \ - > /dev/null && -# peverify /il "$os_dstbase".EXE > /dev/null && - "$dstbase".$EXE_SUFFIX "msil";; - * ) - $ILASM /output:"$os_dstbase".$EXE "$os_dstbase".$MSIL \ - > /dev/null && - monopath=`get_os_pathlist $PREFIX/build/msil:$PREFIX/lib` && - env MONO_PATH="$monopath" $MONO "$dstbase.$EXE" "msil";; - esac && - rm -f "$dstbase".$EXE && - rm -f "$dstbase".$MSIL; -} - -# Tests the CLDC target platform. -test_run_cldc() { - rm -rf "$dstbase".unverified "$dstbase".preverified && - mkdir -p "$dstbase".unverified "$dstbase".preverified && - cpath=`get_os_pathlist $KVEM_CLDC:$KVEM_MIDP:$SCALA_CLDC:"$dstbase".unverified` && - $SCALAC -bootclasspath $cpath -target:cldc -d "$os_dstbase".unverified "$os_srcbase".scala && - $KVEM_PREVERIFY -classpath $cpath -target cldc1.0 -d "$os_dstbase".preverified "$os_dstbase".unverified && - ( echo MIDlet-Name: Test; - echo MIDlet-Version: 1.0.0; - echo MIDlet-Vendor: LAMP ) > "$dstbase".mf && - $JARCMD cfm "$dstbase".jar "$dstbase".mf -C "$os_dstbase".preverified . && - jarsize=`wc -c "$dstbase".jar | cut -d ' ' -f 1` && - ( echo MIDlet-1: Test, , Test; - echo MIDlet-Name: Test; - echo MIDlet-Version: 1.0.0; - echo MIDlet-Vendor: LAMP; - echo MIDlet-Jar-URL: "$dstbase".jar; - echo MIDlet-Jar-Size: $jarsize; - echo MicroEdition-Profile: MIDP-1.0; - echo MicroEdition-Configuration: CLDC-1.0 ) > "$dstbase".jad && - cpath=`get_os_pathlist $SCALA_CLDCAPI:"$dstbase".jar` && - $KVEM_EMULATOR -cp $cpath -Xdescriptor:"$dstbase".jad 2> /dev/null && - head $logfile -n 4 | tail -n 1 > $logfile.0 && - mv $logfile.0 $logfile -} - -# Tests the Android target platform. -test_run_android() { - rm -rf "$dstbase" && - os_classes=`get_os_filename "$dstbase"/classes` && - mkdir -p "$os_classes" && - xml_file=`get_os_filename "$dstbase"/AndroidManifest.xml` && - cp "$srcbase".xml $xml_file && - cpath=`get_os_pathlist $ANDROID_LIB:"$dstbase"` && - $SCALAC -bootclasspath $cpath -cp "$os_classes" -d "$os_classes" -encoding ascii "$os_srcbase".scala && -# echo $JAVACCMD -bootclasspath $cpath -cp "$os_classes" -d "$os_classes" -encoding ascii "$os_srcbase"/**/*.java && - extdirs=`get_os_pathlist "$ANDROID_HOME/tools/lib"` && - dex_file=`get_os_filename "$os_dstbase"/classes.dex` && - scala_lib=`get_os_filename "$SCALA_LIB"` && - $JAVACMD -Djava.ext.dirs=$extdirs -Xmx384M -jar $DX_LIB \ - --dex --output=$dex_file --locals=full --positions=lines \ - "$scala_lib" "$os_classes" && - ( cd "$dstbase" && zip -9q Test.apk *.xml *.dex && - $ANDROID_ADB shell '"cd data/app; rm Test.apk"' 2>&1 1> /dev/null && - $ANDROID_ADB install Test.apk 2> /dev/null) -} - -# Tests a script with Scala code embedded in it -test_run_script() { - argsfile="$srcbase.args" - if [ ! -r "$argsfile" ]; then - argsfile=/dev/null - fi - chmod +x "$srcbase.scala" 2> /dev/null - PATH="$BIN_DIR:$PATH" "$srcbase.scala" `cat $argsfile` -} - -# Tests the Scala Ant task -test_run_ant() { - if [ "$BIN_DIR" = "" ]; then BINARY=installed - elif [ "$BIN_DIR" = "$QUICK" ]; then BINARY=quick - else BINARY=latest - fi; - testname=`basename "$srcbase"`; - buildfile=`get_os_filename "$srcdir/$testname-build.xml"`; - rm -rf "$dstbase".obj && - $ANT -f "$buildfile" -Dbinary="$BINARY" -Dbuild.dir="$os_dstbase".obj && - rm -rf "$dstbase".obj; -} - -# Tests the shootout benchmarks -test_run_shootout() { - javaopts=$JAVA_OPTS; - if [ -f "$os_srcbase".javaopts ]; then - javaopts="$javaopts `cat "$os_srcbase".javaopts`" - if [ "$JAVA5" = "false" ]; then - # -Xss option available in Java versions 1.5 or newer - javaopts=`echo "$javaopts" | sed -e "s/-Xss[0-9]*[MmKk]//g"` - fi - fi - rm -rf "$dstbase".obj && - mkdir -p "$dstbase".obj && - testfile=`get_os_filename "$dstbase".obj/test.scala` && - cat "$os_srcbase".scala.runner "$os_srcbase".scala > "$testfile" && - ext_classpath=`get_os_pathlist "$JVM_EXT_CLASSPATH"` && - $SCALAC -d "$os_dstbase".obj -cp "$ext_classpath" "$@" "$testfile" && - scala_lib=`get_os_filename "$SCALA_LIB"` && - classpath=`get_os_pathlist "$os_dstbase".obj:$CLASSPATH:$ext_classpath` && - src_dir=`get_os_filename "$srcdir"` && - env JAVACMD="$JAVACMD" JAVA_OPTS="$javaopts" \ - $SCALA -Dscalatest.cwd="$src_dir" -Dscalatest.output=$os_dstbase.obj \ - -Dscalatest.lib=$scala_lib -classpath "$classpath" Test && - rm -rf "$dstbase".obj; -} - -# Checks the specified test. -test_check_test() { - [ $# = 1 ] || abort "internal error"; - testfile="$1"; shift 1; - # compute test name - testname=`basename "$testfile" ."$TEST_EXT"`; - - # compute source and destination directories (absolute paths) - srcdir=`dirname "$testfile"`; - srcdir=`cd "$srcdir"; pwd`; - - dstdir="$OBJDIR""$srcdir"; - - # compute source and destination base names - srcbase="$srcdir"/"$testname"; - - dstbase="$dstdir"/"$testname"-$kind; - os_srcbase=`get_os_filename "$srcbase"`; - os_dstbase=`get_os_filename "$dstbase"`; - - # compute flags file - flagsfile="$srcbase".flags; - [ ! -f "$flagsfile" ] && flagsfile=/dev/null; - - # compute check file - checkfile="$srcbase"-$kind.check; - [ ! -f "$checkfile" ] && checkfile="$srcbase".check; - [ ! -f "$checkfile" ] && checkfile=/dev/null; - - # compute log file - logfile="$dstbase".log; - - # if we are testing only failed tests, skip successful tests - if [ "$FAILED" = "true" -a ! -f "$logfile" ]; then - return 0; - fi; - - # if that's the first file of the section print section header - if [ -n "$header" ]; then - printf_outline "$header\\n"; - unset header; - fi; - - # print tested file - test_print_testing "$testfile"; - - # run test - if [ "$NORUN" = "true" ]; then - [ ! -f "$logfile" ]; - else - rm -f "$logfile"; - { [ -d "$dstdir" ] || mkdir -p "$dstdir"; } && - ( test_run_$kind `cat "$flagsfile"` $FLAGS 1> "$logfile" 2>&1; ) && - $DIFF "$logfile" "$checkfile" 1> /dev/null 2>&1 && - rm -f "$logfile"; - fi; - - # print result - if [ "$?" = 0 ]; then - SUCCESS_COUNT=`echo "$SUCCESS_COUNT+1" | bc`; - test_print_success; - else - FAILURE_COUNT=`echo "$FAILURE_COUNT+1" | bc`; - test_print_failure; - [ ! -f "$logfile" ] && logfile=/dev/null; - [ "$SHOWLOG" = "true" ] && cat "$logfile"; - [ "$SHOWDIFF" = "true" ] && $DIFF "$logfile" "$checkfile"; - fi; -} - -# Checks the specified file -test_check_file() { - [ $# = 1 ] || abort "internal error"; - file="$1"; shift 1; - for testfile in "" `find "$file" -name "*.obj" -prune -o -name "*.$TEST_EXT" -a -type f -print`; do - [ -z "$testfile" ] && continue; - test_check_test "$testfile"; - done; -} - -# Checks all files of the specified kind. -test_check_kind() { - [ $# -ge 2 ] || abort "internal error"; - header="$1"; shift 1; - kind="$1"; shift 1; - if [ "$kind" = "res" ]; then TEST_EXT="res"; else TEST_EXT="scala"; fi; - - for file in "" "$@"; do - [ -z "$file" ] && continue; - test_check_file "$file"; - done - [ -z "$header" ] && echo ""; -} - -# Checks everything. -test_check_all() { - [ $# = 0 ] || abort "internal error"; - test_check_kind "Testing disassembler" \ - "dis" $FILES_DIS; - test_check_kind "Testing JVM backend" \ - "jvm" $FILES_RUN $FILES_JVM; - test_check_kind "Testing compiler (on files whose compilation should succeed)" \ - "pos" $FILES_POS; - test_check_kind "Testing compiler (on files whose compilation should fail)" \ - "neg" $FILES_NEG; - test_check_kind "Testing .NET backend" \ - "msil" $FILES_MSIL; - test_check_kind "Testing Scala embedded in script files" \ - "script" $FILES_SCRIPT; - test_check_kind "Testing Scala Ant tasks" \ - "ant" $FILES_ANT; - test_check_kind "Testing resident compiler" \ - "res" $FILES_RES; - test_check_kind "Testing shootout benchmarks" \ - "shootout" $FILES_SHOOTOUT; - test_check_kind "Testing CLDC benchmarks" \ - "cldc" $FILES_CLDC; - test_check_kind "Testing Android benchmarks" \ - "android" $FILES_ANDROID; -} - - -# Adds a new file to the appropriate file list(s). -test_add_file() { - [ $# = 1 ] || abort "internal error"; - case "$1" in - *.scala | *.res ) - if [ ! \( -d "$1" -o -f "$1" \) ]; then - abort "don't know what to do with '$1'"; - fi;; - * ) - if [ ! -d "$1" ]; then - abort "don't know what to do with '$1'"; - fi;; - esac; - TEST_ALL="false"; - case "$TEST_TYPE" in - auto ) ;; - android) FILES_ANDROID="$FILES_ANDROID $1"; return;; - cldc ) FILES_CLDC="$FILES_CLDC $1"; return;; - dis ) FILES_DIS="$FILES_DIS $1"; return;; - run ) FILES_RUN="$FILES_RUN $1"; return;; - jvm ) FILES_JVM="$FILES_JVM $1"; return;; - pos ) FILES_POS="$FILES_POS $1"; return;; - neg ) FILES_NEG="$FILES_NEG $1"; return;; - res ) FILES_RES="$FILES_RES $1"; return;; - msil ) FILES_MSIL="$FILES_MSIL $1"; return;; - script ) FILES_SCRIPT="$FILES_SCRIPT $1"; return;; - ant ) FILES_ANT="$FILES_ANT $1"; return;; - shootout ) FILES_SHOOTOUT="$FILES_SHOOTOUT $1"; return;; - * ) abort "unknown test type \`$TEST_TYPE'";; - esac; - case "$1" in - android | */android | */android/* | android/* ) FILES_ANDROID="$FILES_ANDROID $1";; - cldc | */cldc | */cldc/* | cldc/* ) FILES_CLDC="$FILES_CLDC $1";; - dis | */dis | */dis/* | dis/* ) FILES_DIS="$FILES_DIS $1";; - run | */run | */run/* | run/* ) FILES_RUN="$FILES_RUN $1";; - jvm5 | */jvm5 | */jvm5* | jvm5/* ) - if [ "$JAVA5" = "true" ]; then - FILES_JVM="$FILES_JVM $1" - fi;; - jvm | */jvm | */jvm/* | jvm/* ) FILES_JVM="$FILES_JVM $1";; - pos | */pos | */pos/* | pos/* ) FILES_POS="$FILES_POS $1";; - neg | */neg | */neg/* | neg/* ) FILES_NEG="$FILES_NEG $1";; - res | */res | */res/* | res/* ) FILES_RES="$FILES_RES $1";; - msil | */msil | */msil/* | msil/* ) FILES_MSIL="$FILES_MSIL $1";; - script | */script | */script/* | script/* ) FILES_SCRIPT="$FILES_SCRIPT $1";; - shootout | */shootout | */shootout/* | shootout/* ) FILES_SHOOTOUT="$FILES_SHOOTOUT $1";; - * ) abort "don't known what to do with \`$1'";; - esac; -} - -test_get_location() { - [ $# = 1 ] || abort "internal error"; - source="$1"; shift 1; - script=`basename "$source"`; - while [ -h "$source" ]; do - script=`basename "$source"`; - lookup=`ls -ld "$source"`; - target=`expr "$lookup" : '.*-> \(.*\)$'`; - if expr "${target:-.}/" : '/.*/$' > /dev/null; then - source=${target:-.}; - else - source=`dirname "$source"`/${target:-.}; - fi; - done; - location=`dirname "$source"`; - location=`cd "$location"; pwd`; - echo $location; -} - -############################################################################## -# Definition of UNAME, SOURCE, SCRIPT and PREFIX - -unset SCRIPT; -UNAME=`uname`; -SOURCE=$0; -SCRIPT=`basename "$SOURCE"`; -while [ -h "$SOURCE" ]; do - SCRIPT=`basename "$SOURCE"`; - LOOKUP=`ls -ld "$SOURCE"`; - TARGET=`expr "$LOOKUP" : '.*-> \(.*\)$'`; - if expr "${TARGET:-.}/" : '/.*/$' > /dev/null; then - SOURCE=${TARGET:-.}; - else - SOURCE=`dirname "$SOURCE"`/${TARGET:-.}; - fi; -done; -PREFIX=`dirname "$SOURCE"`/..; -PREFIX=`cd "$PREFIX"; pwd`; - -############################################################################## -# Invocation of $SCRIPT - -# Print deprecation warning -echo "######################################################################" -echo "## DEPRECATION WARNING ##" -echo "######################################################################" -echo "## The 'scalatest' runner script has been deprecated. Please use ##" -echo "## 'partest' instead. ##" -echo "######################################################################" -echo "" - -NORUN="false"; -SHOWLOG="false"; -SHOWDIFF="false"; -USEFSC="false"; -FAILED="false"; -ERRORS=0; -SUCCESS_COUNT=0; -FAILURE_COUNT=0; -if [ -d "$PREFIX/test" ]; then - TESTROOT="$PREFIX/test"; -elif [ -d "$PREFIX/misc/scala-test" ]; then - TESTROOT="$PREFIX/misc/scala-test"; -else - abort "Test directory not found"; -fi; -SRCDIR="$TESTROOT/files"; -OBJDIR=""""; - -TEST_ALL="true"; -TEST_TYPE="auto"; -FILES_RUN=""; -FILES_JVM=""; -FILES_POS=""; -FILES_RES=""; -FILES_NEG=""; -FILES_MSIL=""; -FILES_SCRIPT=""; -FILES_DIS=""; -FILES_ANT=""; -FILES_SHOOTOUT=""; -FILES_CLDC=""; -FILES_ANDROID=""; - -QUICK="$PREFIX/build/quick/bin" -QUICK_LIB="$PREFIX/build/quick/lib/library" -QUICK_COMP="$PREFIX/build/quick/lib/compiler" -QUICK_ACT="$PREFIX/build/quick/lib/actors" -QUICK_PREDEF="$PREFIX/build/quick/lib/predef.dll" -QUICK_CLDC="$PREFIX/build/cldc/lib/scalaapi10-unverified.jar" # unverified -QUICK_CLDCAPI="$PREFIX/build/cldc/lib/scalaapi10.jar" # preverified - -JVM_EXT_CLASSPATH=`get_ext_classpath $TESTROOT/files/lib` - -if [ -d "$PREFIX/dists" ]; then - LATEST="$PREFIX/dists/latest/bin"; - LATEST_LIB="$PREFIX/dists/latest/lib/scala-library.jar"; - LATEST_COMP="$PREFIX/dists/latest/lib/scala-compiler.jar"; - LATEST_PREDEF="$PREFIX/dists/latest/lib/predef.dll"; - LATEST_CLDC=$QUICK_CLDC; - LATEST_CLDCAPI=$QUICK_CLDCAPI; -elif [ -d "$PREFIX/build" ]; then - LATEST="$QUICK"; - LATEST_LIB=$QUICK_LIB; - LATEST_COMP=$QUICK_COMP; - LATEST_ACT=$QUICK_ACT; - LATEST_PREDEF=$QUICK_PREDEF; - LATEST_CLDC=$QUICK_CLDC; - LATEST_CLDCAPI=$QUICK_CLDCAPI; -elif [ -d "$PREFIX/bin" ]; then - LATEST="$PREFIX/bin"; - LATEST_LIB="$PREFIX/lib/scala-library.jar"; - LATEST_COMP="$PREFIX/lib/scala-compiler.jar"; - LATEST_PREDEF="$PREFIX/lib/predef.dll"; - LATEST_CLDC="$PREFIX/lib/scalaapi10-unverified.jar"; - LATEST_CLDCAPI="$PREFIX/lib/scalaapi10.jar"; -else - abort "Scala binaries could not be found"; -fi; -BIN_DIR="$LATEST/" # BIN_DIR should have a trailing / when needed, so that - # it can also be set to the empty string - -SCALA_LIB="$LATEST_LIB"; -SCALA_COMP="$LATEST_COMP"; -SCALA_ACT="$LATEST_ACT"; -SCALA_CLDC="$LATEST_CLDC"; -SCALA_CLDCAPI="$LATEST_CLDCAPI"; - -[ -x "$JAVACMD" ] || JAVACMD=java; -[ -n "$JAVA_OPTS" ] || JAVA_OPTS="-Xmx256M -Xms16M"; -case `$JAVACMD \-version 2>&1 | xargs` in - *1.5.*IBM* ) JAVA5="true"; IBM_J9="true"; JAVA_OPTS="$JAVA_OPTS -Xss2M";; - *1.6.*IBM* ) JAVA5="true"; IBM_J9="true";; - *1.[5-7].* ) JAVA5="true";; - *1.4.*GNU* ) JAVA5="false"; GIJ="true"; JAVA_OPTS="--mx256m --ms16m";; - * ) JAVA5="false";; -esac; - -case "$UNAME" in - CYGWIN* ) DIFF="diff --text --strip-trailing-cr";; - * ) DIFF="diff --strip-trailing-cr";; -esac; - -while [ $# -gt 0 ]; do - case "$1" in - --android ) TEST_TYPE="android"; shift 1;; - --auto ) TEST_TYPE="auto"; shift 1;; - --cldc ) TEST_TYPE="cldc"; shift 1;; - --dis ) TEST_TYPE="dis"; shift 1;; - --run ) TEST_TYPE="run"; shift 1;; - --jvm ) TEST_TYPE="jvm"; shift 1;; - --pos ) TEST_TYPE="pos"; shift 1;; - --neg ) TEST_TYPE="neg"; shift 1;; - --res ) TEST_TYPE="res"; shift 1;; - --msil ) TEST_TYPE="msil"; shift 1;; - --script ) TEST_TYPE="script"; shift 1;; - --ant ) TEST_TYPE="ant"; shift 1;; - --shootout ) TEST_TYPE="shootout"; shift 1;; - --quick ) BIN_DIR="$QUICK/"; SCALA_LIB=$QUICK_LIB; - SCALA_COMP=$QUICK_COMP; SCALA_ACT=$QUICK_ACT; - SCALA_PREDEF=$QUICK_PREDEF; shift 1;; - --installed ) BIN_DIR=""; shift 1;; - --no-run ) NORUN="true"; shift 1;; - --show-log ) SHOWLOG="true"; shift 1;; - --show-diff ) SHOWDIFF="true"; shift 1;; - --use-fsc ) USEFSC="true"; shift 1;; - --failed ) FAILED="true"; shift 1;; - --pending ) SRCDIR="$TESTROOT/pending"; shift 1;; - --errors= ) abort "illegal empty argument for option --errors";; - --errors=* ) ERRORS=`expr "$1" : "--errors=\([0-9]*\)$"`;shift 1;; - --flags= ) abort "illegal empty argument for option --flags";; - --flags=* ) FLAGS=`expr "$1" : "--flags=\(.*\)"`; shift 1;; - --color= ) abort "illegal empty argument for option --color";; - --color=* ) COLOR=`expr "$1" : "--color=\(.*\)"`; shift 1;; - --objdir=* ) OBJDIR=`expr "$1" : "--objdir=\(.*\)"`; shift 1;; - --help| -? ) test_print_help; exit 0;; - --version ) test_print_version; exit 0;; - -* ) abort "unknown option $1";; - * ) test_add_file "$1"; shift 1;; - esac; -done; - -if [ "$TEST_TYPE" = "msil" ]; then - FLAGS="$FLAGS -target:msil"; -elif [ "$JAVA5" = "false" ]; then - FLAGS="$FLAGS -target:jvm-1.4"; -fi; - -if [ -z "$ERRORS" ]; then - abort "illegal non-numerical argument for option --errors"; -fi; - -if [ -z "$COLOR" -a -n "$EMACS" ]; then - COLOR="none"; -fi; -printf_initialization "${COLOR:-many}"; - -if [ "$TEST_ALL" = "true" ]; then - case "$TEST_TYPE" in - android ) FILES_ANDROID="$FILES_ANDROID $SRCDIR/android";; - esac; - case "$TEST_TYPE" in - cldc ) FILES_CLDC="$FILES_CLDC $SRCDIR/cldc";; - esac; - case "$TEST_TYPE" in - dis ) FILES_DIS="$FILES_DIS $SRCDIR/dis";; - esac; - case "$TEST_TYPE" in - run ) FILES_RUN="$FILES_RUN $SRCDIR/run";; - esac; - case "$TEST_TYPE" in - auto | shootout ) FILES_SHOOTOUT="$FILES_SHOOTOUT $SRCDIR/shootout";; - esac; - case "$TEST_TYPE" in - auto | jvm ) - FILES_JVM="$FILES_JVM $SRCDIR/run $SRCDIR/jvm" - if [ "$JAVA5" = "true" ]; then - FILES_JVM="$FILES_JVM $SRCDIR/jvm5"; - fi;; - esac; - case "$TEST_TYPE" in - auto | pos ) FILES_POS="$FILES_POS $SRCDIR/pos";; - esac; - case "$TEST_TYPE" in - auto | neg ) FILES_NEG="$FILES_NEG $SRCDIR/neg";; - esac; - case "$TEST_TYPE" in - auto | res ) FILES_RES="$FILES_RES $SRCDIR/res";; - esac; - case "$TEST_TYPE" in - msil ) FILES_MSIL="$FILES_MSIL $SRCDIR/run";; - esac; - case "$TEST_TYPE" in - auto | script ) FILES_SCRIPT="$FILES_SCRIPT $SRCDIR/script";; - esac; - case "$TEST_TYPE" in - ant ) FILES_ANT="$FILES_ANT $SRCDIR/ant";; - esac; -fi; - -SCALA="${BIN_DIR}scala"; -[ -z "$SCALAC_OPTS" ] && SCALAC_OPTS="-deprecation"; -if [ "$USEFSC" = "true" ]; then - SCALAC_CMD="${BIN_DIR}fsc"; -else - SCALAC_CMD="${BIN_DIR}scalac"; -fi; - -scalac=`which "$SCALAC_CMD" 2> /dev/null` -if [ -z "$scalac" ] || [ ! -x "$scalac" ]; then - printf_failure "Missing command \"$SCALAC_CMD\"; run 'ant '.\\n"; - exit 1; -fi; -SCALAC="$SCALAC_CMD $SCALAC_OPTS"; -SCALAP="scalap"; - -CLASSPATH=$SCALA_COMP:$SCALA_ACT -SCALA_ASSEM=$SCALA_PREDEF:$PREFIX/lib/scalaruntime.dll:$PREFIX/lib/mscorlib.dll - -if [ -z "$ANT" ]; then - if [ -d "$ANT_HOME" ]; then - ANT="$ANT_HOME/bin/ant"; - else - ANT="ant"; - fi -fi; -if [ -z "$ILASM" ]; then - if [ -d "$MONO_HOME" ]; then - ILASM="$MONO_HOME/bin/ilasm"; - else - ILASM="ilasm"; - fi -fi; -if [ -z "$MONO" ]; then - if [ -d "$MONO_HOME" ]; then - MONO="$MONO_HOME/bin/mono"; - else - MONO="mono"; - fi -fi; - -if [ -n "$OBJDIR" ]; then - if [ -d "$OBJDIR" ] || mkdir -p "$OBJDIR"; then - OBJDIR=`cd "$OBJDIR"; pwd`; - else - abort "could not create directory '$OBJDIR'"; - fi -fi; - -printf_outline "Source directory is : $SRCDIR\\n"; -bin_dir=$BIN_DIR -if [ -z "$bin_dir" ]; then - scalac=`which $SCALAC_CMD`; - bin_dir=`test_get_location $scalac`; -fi; -printf_outline "Scala binaries in : $bin_dir\\n"; -scala_version=`${SCALAC_CMD} -version 2>&1` -printf_outline "Scala version is : $scala_version\\n"; -[ -n "$SCALAC_OPTS" ] && printf_outline "Scalac options are : $SCALAC_OPTS\\n"; - -if [ $TEST_TYPE = "msil" ]; then - ilasm_version=`$ILASM --version 2>&1`; - printf_outline "ILasm version is : $ilasm_version\\n"; - mono_version=`$MONO --version | head -1`; - printf_outline "Mono version is : $mono_version\\n"; - if [ -f "$SCALA_PREDEF" ]; then - printf_outline "DLL library is : $SCALA_PREDEF\\n"; - else - printf_failure "Missing library \"predef.dll\"; run 'ant msil'.\\n"; - exit 1; - fi -else - javacmd=`which $JAVACMD 2>/dev/null`; - bin_dir=`test_get_location $javacmd`; - printf_outline "Java binaries in : $bin_dir\\n"; - if [ "$GIJ" = "true" ]; then - jvm_version=`$JAVACMD -version 2>&1 | head -2 | tail -1` - else - jvm_version=`$JAVACMD -version 2>&1 | head -3 | tail -1` - fi; - printf_outline "Java runtime is : $jvm_version\\n"; - [ -n "$JAVA_OPTS" ] && printf_outline "Java options are : $JAVA_OPTS\\n"; - if [ "$TEST_TYPE" = "ant" ]; then - ant_version=`$ANT -version`; - printf_outline "Ant version is : $ant_version\\n"; - elif [ "$TEST_TYPE" = "cldc" ]; then - if [ -d "$KVEM_HOME" ]; then - KVEM_PREVERIFY="$KVEM_HOME/bin/preverify"; - KVEM_EMULATOR="$KVEM_HOME/bin/emulator"; - KVEM_CLDC="$KVEM_HOME/lib/cldcapi10.jar"; - KVEM_MIDP="$KVEM_HOME/lib/midpapi10.jar"; - JARCMD="$bin_dir/jar"; - elif [ -d "/home/linuxsoft/apps/" ]; then - error "option '--cldc' requires variable KVEM_HOME to be set" - abort "(eg. export KVEM_HOME=/home/linuxsoft/apps/java-wtk)"; - else - abort "option '--cldc' requires variable KVEM_HOME to be set"; - fi; - kvem_version=`$KVEM_EMULATOR -version | head -1`; - printf_outline "Emulator version is : $kvem_version\\n"; - elif [ "$TEST_TYPE" = "android" ]; then - if [ -s "$ANDROID_HOME" ]; then - ANDROID_ADB="$ANDROID_HOME/tools/adb"; - ANDROID_EMULATOR="$ANDROID_HOME/tools/emulator"; - ANDROID_LIB="$ANDROID_HOME/android.jar"; - DX_LIB="$ANDROID_HOME/tools/lib/dx.jar"; - JAVACCMD="$bin_dir/javac"; - JARCMD="$bin_dir/jar"; - elif [ -d "/home/linuxsoft/apps/" ]; then - error "option '--android' requires variable ANDROID_HOME to be set" - abort "(eg. export ANDROID_HOME=/home/linuxsoft/apps/android)"; - else - abort "option '--android' requires variable ANDROID_HOME to be set"; - fi; - android_version="m3-rc22a"; #not yet available through command - printf_outline "Emulator version is : $android_version\\n"; - status=`$ANDROID_ADB shell '"exit"' 2>&1 | wc -l` && - [ "$status" = "0" ] || abort "Start the Android emulator before running the tests!!!"; - fi -fi; -printf_outline "\\n"; - -START_SECONDS=`date +%s`; -test_check_all; -END_SECONDS=`date +%s`; - -TOTAL_COUNT=`echo "$FAILURE_COUNT+$SUCCESS_COUNT" | bc`; - -ELAPSED_SECONDS=`expr $END_SECONDS - $START_SECONDS`; -case "$UNAME" in - Darwin* ) ELAPSED_TIME=`date -r $ELAPSED_SECONDS +%T`;; - * ) ELAPSED_TIME=`date --date="1970-01-01 $ELAPSED_SECONDS sec" +%T`;; -esac; - -if [ $FAILURE_COUNT -eq 0 ]; then - printf_success "All of $TOTAL_COUNT tests were successful (elapsed time: $ELAPSED_TIME)\\n"; -else - printf_failure "$FAILURE_COUNT of $TOTAL_COUNT tests failed (elapsed time: $ELAPSED_TIME)\\n"; -fi; - -if [ $FAILURE_COUNT -eq "$ERRORS" ]; then - exit 0; -else - exit 1; -fi; - -############################################################################## diff --git a/test/scalatest.bat b/test/scalatest.bat deleted file mode 100644 index b0dc3bfb55..0000000000 --- a/test/scalatest.bat +++ /dev/null @@ -1,321 +0,0 @@ -@echo off - -rem ########################################################################## -rem # Copyright 2002-2009 LAMP/EPFL -rem # -rem # This is free software; see the distribution for copying conditions. -rem # There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A -rem # PARTICULAR PURPOSE. -rem ########################################################################## - -rem We adopt the following conventions: -rem - System/user environment variables start with a letter -rem - Local batch variables start with an underscore ('_') - -echo ###################################################################### -echo ## DEPRECATION WARNING ## -echo ###################################################################### -echo ## The 'scalatest' runner script has been deprecated. Please use ## -echo ## 'partest' instead. ## -echo ###################################################################### -echo. - -if "%OS%"=="Windows_NT" ( - @setlocal - call :set_home -) else ( - set _SCALA_HOME=%SCALA_HOME% - if "%_SCALA_HOME%"=="" goto err_home -) - -rem We use the value of the JAVACMD environment variable if defined -set _JAVACMD=%JAVACMD% -if "%_JAVACMD%"=="" set _JAVACMD=java - -set _BIN=dists\latest\bin -set _NORUN= -set _TYPE=auto -set _SHOWLOG= -set _SHOWDIFF= -set _FAILED= - -set _ARGS= -:loop -rem Argument %1 may contain quotes so we use parentheses here -if (%1)==() goto exec -if (%1)==(--auto) set _TYPE=auto& goto next -if (%1)==(--run) set _TYPE=run& goto next -if (%1)==(--jvm) set _TYPE=jvm& goto next -if (%1)==(--pos) set _TYPE=pos& goto next -if (%1)==(--neg) set _TYPE=neg& goto next -if (%1)==(--msil) set _TYPE=msil& goto next -if (%1)==(--quick) set _BIN=build\quick\bin& goto next -if (%1)==(--no-run) set _NORUN=1& goto next -if (%1)==(--show-log) set _SHOWLOG=1& goto next -if (%1)==(--show-diff) set _SHOWDIFF=1& goto next -if (%1)==(--failed) set _FAILED=1& goto next -if (%1)==(--help) call :prt_help & goto :eof -if (%1)==(-h) call :prt_help & goto :eof -if (%1)==(-?) call :prt_help & goto :eof -if (%1)==(--version) call :prt_version & goto :eof -if (%1)==(-v) call :prt_version & goto :eof -call :chk_option %1 -if errorlevel 0 goto err_opt -set _ARGS=%_ARGS% %1 -:next -shift -goto loop - -:exec -if exist "%_SCALA_HOME%\meta\universe" ( - set _BINDIR=%_SCALA_HOME%\bin - set _SRCDIR=%_SCALA_HOME%\misc\scala-test\files - set _DIFFDIR=%_SCALA_HOME%\bin\diff -) else ( - set _BINDIR=%_SCALA_HOME%\%_BIN% - set _SRCDIR=%_SCALA_HOME%\test\files - set _DIFFDIR=%_SCALA_HOME%\test\diff -) - -set _SCALA=%_BINDIR%\scala -set _SCALAC=%_BINDIR%\scalac -set _SCALAP=%_BINDIR%\scalap -set _DIFF=%_DIFFDIR%\diff.exe --text --strip-trailing-cr - -if not exist "%_BINDIR%" goto err_bin - -set _OBJDIR= -set _TMPDIR=%TEMP% - -if not "%_OBJDIR%"=="" ( - if not exist "%_OBJDIR%" mkdir "%_OBJDIR%" -) -if not "%_TMPDIR%"=="" ( - if not exist "%_TMPDIR%" mkdir "%_TMPDIR%" -) - -call :prt_dir "Source directory is :" "%_SRCDIR%" -call :prt_dir "Scala binaries are in:" "%_BINDIR%" -call :set_version -call :prt_dir "Scala version is :" "%_NSC_VERSION%" -call :prt_dir "Java runtime is :" "%_JVM_VERSION%" - -set _FILES_POS= -set _FILES_RUN= -set _FILES_JVM= -set _FILES_NEG= -set _FILES_MSIL= - -if %_TYPE%==pos ( - set _FILES_POS=%_SRCDIR%\pos -) else if %_TYPE%==run ( - set _FILES_RUN=%_SRCDIR%\run -) else if %_TYPE%==jvm ( - set _FILES_JVM=%_SRCDIR%\jvm - set _FILES_RUN=%_SRCDIR%\run -) else if %_TYPE%==neg ( - set _FILES_NEG=%_SRCDIR%\neg -) else if %_TYPE%==msil ( - set _FILES_MSIL=%_SRCDIR%\msil -) else if %_TYPE%==auto ( - set _FILES_POS=%_SRCDIR%\pos - set _FILES_NEG=%_SRCDIR%\neg - set _FILES_JVM=%_SRCDIR%\jvm - set _FILES_RUN=%_SRCDIR%\run -) else ( - goto err_test -) -:start -call :chk_all -goto end - -rem ########################################################################## -rem # subroutines -rem # NB. goto/call commands use only the first 8 characters of a label - -:prt_dir - echo %~1 %~2 - goto :eof - -:prt_header - echo. - echo %~1 - goto :eof - -:prt_help - echo Usage: scalatest [OPTION]... - echo. - echo --auto use filenames to select the test to run - echo --run next files test the interpreter and all backends - echo --jvm next files test the JVM backend - echo --pos next files test a compilation success - echo --neg next files test a compilation failure - echo --msil next files test the .NET - echo --quick use the 'quick' build instead of the distribution - echo --no-run run no test, use results of last run - echo --show-log show output of failed tests - echo --show-diff show differences between actual and expected output - echo --failed test only files that failed last time - echo --help, -h, -? display this help and exit - echo --version, -v output version information and exit - goto :eof - -:prt_version - echo Scala test suite 0.9.3 -- (c) 2002-2009 LAMP/EPFL - goto :eof - -:prt_status - set _MSG=testing: [...]\%~1\%2 - if not "%_STATUS%"=="0" goto failed - set /a _CNT_SUCCESS=_CNT_SUCCESS+1 - echo %_MSG% [OK] - goto :eof - :failed - set /a _CNT_FAILURE=_CNT_FAILURE+1 - echo %_MSG% [FAILED] - if not "%_SHOWLOG%"=="" type %_LOGFILE% - goto :eof - -rem Variable "%~dps0" works on WinXP SP2 or newer -rem (see http://support.microsoft.com/?kbid=833431) -rem set _SCALA_HOME=%~dps0.. -:set_home - set _BINDIR= - for %%i in (%~sf0) do set _BINDIR=%_BINDIR%%%~dpsi - set _SCALA_HOME=%_BINDIR%.. - goto :eof - -:set_version - set _TMPFILE=%_TMPDIR%\.version - call %_SCALAC% -version 2> %_TMPFILE% - for /f "tokens=*" %%f in (%_TMPFILE%) do @set _VERSION=%%f - set _NSC_VERSION=%_VERSION% - %_JAVACMD% -version 2> %_TMPFILE% - for /f "skip=2 tokens=*" %%f in (%_TMPFILE%) do @set _VERSION=%%f - set _JVM_VERSION=%_VERSION% - goto :eof - -:chk_option - echo %~1 | findstr /r /c:"-.*" 1>NUL - goto :eof - -rem Tests a compilation success. -:test_pos - rmdir /s/q %_DSTBASE%.obj 2>NUL - mkdir %_DSTBASE%.obj - call %_SCALAC% -d %_DSTBASE%.obj %1 1>NUL 2>NUL - if errorlevel 1 goto status_pos - set _STATUS=0 - goto next_pos - :status_pos - set _STATUS=1 - :next_pos - rmdir /s/q %_DSTBASE%.obj - goto :eof - -rem Tests a compilation failure. -:test_neg - rmdir /s/q %_DSTBASE%.obj 2>NUL - mkdir %_DSTBASE%.obj - call %_SCALAC% -d %_DSTBASE%.obj %1 1>NUL 2>NUL - if errorlevel 1 goto status_neg - set _STATUS=1 - goto next_neg - :status_neg - set _STATUS=0 - :next_neg - rmdir /s/q %_DSTBASE%.obj - goto :eof - -rem Tests the JVM backend. -:test_jvm - rmdir /s/q %_DSTBASE%.obj 2>NUL - mkdir %_DSTBASE%.obj - call %_SCALAC% -d %_DSTBASE%.obj %1 2>NUL - if errorlevel 1 goto status_jvm - call %_SCALA% -cp %_DSTBASE%.obj Test "jvm" 1>%_LOGFILE% 2>NUL - if errorlevel 1 goto status_jvm - set _STATUS=0 - goto next_jvm - :status_jvm - set _STATUS=1 - :next_jvm - rmdir /s/q %_DSTBASE%.obj - goto :eof - -:chk_test - if "%_OBJDIR%"=="" ( - set _DSTDIR=%_SRCDIR% - ) else ( - set _DSTDIR=%_OBJDIR% - ) - set _DSTBASE=%_DSTDIR%\%~n1-%_KIND% - set _LOGFILE=%_DSTBASE%.log - set _CHKFILE=%~dpn1.check - - if not '%_HEADER%'=='' call :prt_header %_HEADER% & set _HEADER= - - if "%_KIND%"=="jvm" call :test_jvm %1 & goto status - if "%_KIND%"=="pos" call :test_pos %1 & goto status - if "%_KIND%"=="neg" call :test_neg %1 & goto status - goto :eof - :status - if exist %_LOGFILE% %_DIFF% %_LOGFILE% %_CHKFILE% 2>NUL - call :prt_status %_KIND% %~nx1 - del /s/q %_LOGFILE% 2>NUL 1>NUL - goto :eof - -:chk_file - set _CNT_SUCCESS=0 - set _CNT_FAILURE=0 - for %%f in (%1\*.scala) do call :chk_test %%f - set /a _CNT_TOTAL=_CNT_SUCCESS+_CNT_FAILURE - if "%_CNT_FAILURE%"=="0" goto success - echo %_CNT_FAILURE% of %_CNT_TOTAL% tests failed - goto :eof - :success - echo All of %_CNT_TOTAL% tests were successful - goto :eof - -:chk_kind - set _HEADER=%1 - shift - set _KIND=%1 - shift - :loop_kind - if "%1"=="" goto done - call :chk_file %1 - shift - goto loop_kind - :done - goto :eof - -rem Checks everything. -:chk_all - call :chk_kind "Testing JVM backend" jvm %_FILES_RUN% %_FILES_JVM% - call :chk_kind "Testing compiler (on files whose compilation should succeed)" pos %_FILES_POS% - call :chk_kind "Testing compiler (on files whose compilation should fail)" neg %_FILES_NEG% - call :chk_kind "Testing .NET backend" msil %_FILES_MSIL% - goto :eof - -rem ########################################################################## -rem # errors - -:err_bin -echo ERROR: missing command "%_SCALAC%; run "ant build". -goto end - -:err_home -echo ERROR: Windows NT or newer is required to run this batch command. -goto end - -:err_test -echo ERROR: Illegal test type %_TYPE%. -goto end - -:err_opt -echo ERROR: Unknown option %1 -goto end - -:end -if "%OS%"=="Windows_NT" @endlocal -- cgit v1.2.3