added '--ant' option to scalatest
git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@9009 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
This commit is contained in:
parent
301c10cdd4
commit
a3af33868e
|
@ -433,7 +433,7 @@ BUILD QUICK-TEST LAYER
|
||||||
<locker
|
<locker
|
||||||
srcdir="${src.dir}/compiler"
|
srcdir="${src.dir}/compiler"
|
||||||
destdir="${quick.dir}/lib/compiler"
|
destdir="${quick.dir}/lib/compiler"
|
||||||
addparams="${nsc.params}"
|
addparams="${nsc.params}" deprecation="yes"
|
||||||
scalacdebugging="${nsc.log-files}">
|
scalacdebugging="${nsc.log-files}">
|
||||||
<classpath>
|
<classpath>
|
||||||
<pathelement location="${quick.dir}/lib/library"/>
|
<pathelement location="${quick.dir}/lib/library"/>
|
||||||
|
|
|
@ -0,0 +1,149 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!-- $Id: $ -->
|
||||||
|
|
||||||
|
<project name="test" default="build" basedir=".">
|
||||||
|
|
||||||
|
<!-- Prevents system classpath from being used -->
|
||||||
|
<property name="build.sysclasspath" value="ignore"/>
|
||||||
|
|
||||||
|
<!-- ===========================================================================
|
||||||
|
PROPERTIES
|
||||||
|
============================================================================ -->
|
||||||
|
|
||||||
|
<property name="source.dir" value="${basedir}"/>
|
||||||
|
|
||||||
|
<property file="./build.properties"/>
|
||||||
|
|
||||||
|
<condition property="quick.binary">
|
||||||
|
<equals arg1="${binary}" arg2="quick"/>
|
||||||
|
</condition>
|
||||||
|
<condition property="latest.binary">
|
||||||
|
<equals arg1="${binary}" arg2="latest"/>
|
||||||
|
</condition>
|
||||||
|
<condition property="installed.binary">
|
||||||
|
<equals arg1="${binary}" arg2="installed"/>
|
||||||
|
</condition>
|
||||||
|
|
||||||
|
<fail message="Property 'binary' must be set to either 'quick', 'lastest' or 'installed'.">
|
||||||
|
<condition><not><or>
|
||||||
|
<isset property="quick.binary"/>
|
||||||
|
<isset property="latest.binary"/>
|
||||||
|
<isset property="installed.binary"/>
|
||||||
|
</or></not></condition>
|
||||||
|
</fail>
|
||||||
|
<echo level="verbose" message="binary=${binary}"/>
|
||||||
|
|
||||||
|
<property name="build.dir" value="${java.io.tmpdir}/classes-${user.name}"/>
|
||||||
|
|
||||||
|
<!-- ===========================================================================
|
||||||
|
INITIALISATION
|
||||||
|
============================================================================ -->
|
||||||
|
|
||||||
|
<target name="quick.init" if="quick.binary">
|
||||||
|
<property name="quick.dir" value="../../../build/quick"/>
|
||||||
|
<available file="${quick.dir}" property="quick.present"/>
|
||||||
|
<fail
|
||||||
|
message="Quick build could not be found."
|
||||||
|
unless="quick.present"
|
||||||
|
/>
|
||||||
|
<property name="scala.dir" value="${quick.dir}"/>
|
||||||
|
<property name="scala-library.lib" value="${scala.dir}/lib/library/"/>
|
||||||
|
<property name="scala-compiler.lib" value="${scala.dir}/lib/compiler/"/>
|
||||||
|
<property name="fjbg.lib" value="${scala.dir}/lib/fjbg.jar"/>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="latest.init" if="latest.binary">
|
||||||
|
<property name="latest.dir" value="../../../dists/latest"/>
|
||||||
|
<available file="${latest.dir}" property="latest.present"/>
|
||||||
|
<fail
|
||||||
|
message="Latest build could not be found."
|
||||||
|
unless="latest.present"
|
||||||
|
/>
|
||||||
|
<property name="scala.dir" value="${latest.dir}"/>
|
||||||
|
<property name="scala-library.lib" value="${scala.dir}/lib/scala-library.jar"/>
|
||||||
|
<property name="scala-compiler.lib" value="${scala.dir}/lib/scala-compiler.jar"/>
|
||||||
|
<property name="fjbg.lib" value=""/>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="installed.init" if="installed.binary">
|
||||||
|
<property name="installed.dir" value="/home/linuxsoft/apps/scala/share/scala"/>
|
||||||
|
<available file="${installed.dir}" property="installed.present"/>
|
||||||
|
<fail
|
||||||
|
message="Installed distribution could not be found."
|
||||||
|
unless="installed.present"
|
||||||
|
/>
|
||||||
|
<property name="scala.dir" value="${installed.dir}"/>
|
||||||
|
<property name="scala-library.lib" value="${scala.dir}/lib/scala-library.jar"/>
|
||||||
|
<property name="scala-compiler.lib" value="${scala.dir}/lib/scala-compiler.jar"/>
|
||||||
|
<property name="fjbg.lib" value=""/>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="init" depends="quick.init, latest.init, installed.init">
|
||||||
|
<echo level="verbose" message="scala.dir=${scala.dir}"/>
|
||||||
|
<fail message="Scala library '${scala-library.lib}' is not available">
|
||||||
|
<condition><not><and>
|
||||||
|
<available classname="scala.Predef"
|
||||||
|
classpath="${scala-library.lib}"/>
|
||||||
|
<available classname="scala.List"
|
||||||
|
classpath="${scala-library.lib}"/>
|
||||||
|
<available classname="scala.runtime.ObjectRef"
|
||||||
|
classpath="${scala-library.lib}"/>
|
||||||
|
</and></not></condition>
|
||||||
|
</fail>
|
||||||
|
<fail message="Scala library '${scala-compiler.lib}' is not available">
|
||||||
|
<condition><not><and>
|
||||||
|
<available classname="scala.tools.nsc.Main"
|
||||||
|
classpath="${scala-compiler.lib}"/>
|
||||||
|
<available classname="scala.tools.util.StringOps"
|
||||||
|
classpath="${scala-compiler.lib}"/>
|
||||||
|
</and></not></condition>
|
||||||
|
</fail>
|
||||||
|
<path id="scala.classpath">
|
||||||
|
<pathelement location="${scala-library.lib}"/>
|
||||||
|
<pathelement location="${scala-compiler.lib}"/>
|
||||||
|
<pathelement location="${fjbg.lib}"/> <!-- only present for 'quick' -->
|
||||||
|
</path>
|
||||||
|
<taskdef resource="scala/tools/ant/antlib.xml">
|
||||||
|
<classpath>
|
||||||
|
<path refid="scala.classpath"/>
|
||||||
|
</classpath>
|
||||||
|
</taskdef>
|
||||||
|
<path id="build.classpath">
|
||||||
|
<!--<pathelement location="${scala-actors.lib}"/>-->
|
||||||
|
<pathelement location="${scala-library.lib}"/>
|
||||||
|
<pathelement location="${build.dir}"/>
|
||||||
|
</path>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<!-- ===========================================================================
|
||||||
|
BUILD
|
||||||
|
============================================================================ -->
|
||||||
|
|
||||||
|
<target name="build" depends="init">
|
||||||
|
<echo level="verbose" message="ouput.dir=${build.dir}"/>
|
||||||
|
<mkdir dir="${build.dir}"/>
|
||||||
|
<scalac
|
||||||
|
srcdir="${source.dir}"
|
||||||
|
includes="**/*.scala"
|
||||||
|
destdir="${build.dir}"
|
||||||
|
classpathref="build.classpath"
|
||||||
|
/>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<!-- ===========================================================================
|
||||||
|
CLEAN
|
||||||
|
============================================================================ -->
|
||||||
|
|
||||||
|
<macrodef name="remove">
|
||||||
|
<attribute name="dir"/>
|
||||||
|
<sequential>
|
||||||
|
<delete dir="@{dir}" includeemptydirs="yes" quiet="yes" failonerror="no"/>
|
||||||
|
</sequential>
|
||||||
|
</macrodef>
|
||||||
|
|
||||||
|
<target name="clean">
|
||||||
|
<remove dir="${build.dir}"/>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
</project>
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
Buildfile: /home/michelou/projects/scala-installer/dependencies/scala/test/files/ant/test-build.xml
|
||||||
|
|
||||||
|
quick.init:
|
||||||
|
|
||||||
|
latest.init:
|
||||||
|
|
||||||
|
installed.init:
|
||||||
|
|
||||||
|
init:
|
||||||
|
|
||||||
|
build:
|
||||||
|
[scalac] Compiling 1 source file to /tmp/classes-michelou
|
||||||
|
|
||||||
|
BUILD SUCCESSFUL
|
||||||
|
Total time: 3 seconds
|
|
@ -0,0 +1,6 @@
|
||||||
|
package test
|
||||||
|
|
||||||
|
object Main {
|
||||||
|
def main(args: Array[String]): Unit =
|
||||||
|
Console.println(args.toList)
|
||||||
|
}
|
|
@ -151,6 +151,7 @@ test_print_help() {
|
||||||
echo "--neg next files test a compilation failure";
|
echo "--neg next files test a compilation failure";
|
||||||
echo "--msil next files test the .NET backend";
|
echo "--msil next files test the .NET backend";
|
||||||
echo "--script next files test Scala embedded in scripts";
|
echo "--script next files test Scala embedded in scripts";
|
||||||
|
echo "--ant next files test the Ant tasks";
|
||||||
echo "--quick use the 'quick' build instead of distribution";
|
echo "--quick use the 'quick' build instead of distribution";
|
||||||
echo '--installed use the installed programs on $PATH'
|
echo '--installed use the installed programs on $PATH'
|
||||||
echo "--no-run run no test, use results of last run";
|
echo "--no-run run no test, use results of last run";
|
||||||
|
@ -276,6 +277,18 @@ test_run_script() {
|
||||||
PATH="$BIN_DIR:$PATH" "$srcbase.scala" `cat $argsfile`
|
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" -D=output.dir "$os_dstbase".obj &&
|
||||||
|
rm -rf "$dstbase".obj;
|
||||||
|
}
|
||||||
|
|
||||||
# Checks the specified test.
|
# Checks the specified test.
|
||||||
test_check_test() {
|
test_check_test() {
|
||||||
|
@ -396,6 +409,8 @@ test_check_all() {
|
||||||
"msil" $FILES_MSIL;
|
"msil" $FILES_MSIL;
|
||||||
test_check_kind "Testing Scala embedded in script files" \
|
test_check_kind "Testing Scala embedded in script files" \
|
||||||
"script" $FILES_SCRIPT;
|
"script" $FILES_SCRIPT;
|
||||||
|
test_check_kind "Testing Scala Ant tasks" \
|
||||||
|
"ant" $FILES_ANT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -422,6 +437,7 @@ test_add_file() {
|
||||||
neg ) FILES_NEG="$FILES_NEG $1"; return;;
|
neg ) FILES_NEG="$FILES_NEG $1"; return;;
|
||||||
msil ) FILES_MSIL="$FILES_MSIL $1"; return;;
|
msil ) FILES_MSIL="$FILES_MSIL $1"; return;;
|
||||||
script ) FILES_SCRIPT="$FILES_SCRIPT $1"; return;;
|
script ) FILES_SCRIPT="$FILES_SCRIPT $1"; return;;
|
||||||
|
ant ) FILES_ANT="$FILES_ANT $1"; return;;
|
||||||
* ) abort "unknown test type \`$TEST_TYPE'";;
|
* ) abort "unknown test type \`$TEST_TYPE'";;
|
||||||
esac;
|
esac;
|
||||||
case "$1" in
|
case "$1" in
|
||||||
|
@ -508,6 +524,7 @@ FILES_NEG="";
|
||||||
FILES_MSIL="";
|
FILES_MSIL="";
|
||||||
FILES_SCRIPT="";
|
FILES_SCRIPT="";
|
||||||
FILES_DIS="";
|
FILES_DIS="";
|
||||||
|
FILES_ANT="";
|
||||||
|
|
||||||
QUICK="$PREFIX/build/quick/bin"
|
QUICK="$PREFIX/build/quick/bin"
|
||||||
QUICK_LIB="$PREFIX/build/quick/lib/library"
|
QUICK_LIB="$PREFIX/build/quick/lib/library"
|
||||||
|
@ -552,6 +569,7 @@ while [ $# -gt 0 ]; do
|
||||||
--neg ) TEST_TYPE="neg"; shift 1;;
|
--neg ) TEST_TYPE="neg"; shift 1;;
|
||||||
--msil ) TEST_TYPE="msil"; shift 1;;
|
--msil ) TEST_TYPE="msil"; shift 1;;
|
||||||
--script ) TEST_TYPE="script"; shift 1;;
|
--script ) TEST_TYPE="script"; shift 1;;
|
||||||
|
--ant ) TEST_TYPE="ant"; shift 1;;
|
||||||
--quick ) BIN_DIR="$QUICK/"; SCALA_LIB=$QUICK_LIB; shift 1;;
|
--quick ) BIN_DIR="$QUICK/"; SCALA_LIB=$QUICK_LIB; shift 1;;
|
||||||
--installed ) BIN_DIR=""; shift 1;;
|
--installed ) BIN_DIR=""; shift 1;;
|
||||||
--no-run ) NORUN="true"; shift 1;;
|
--no-run ) NORUN="true"; shift 1;;
|
||||||
|
@ -612,11 +630,15 @@ if [ "$TEST_ALL" = "true" ]; then
|
||||||
case "$TEST_TYPE" in
|
case "$TEST_TYPE" in
|
||||||
auto | script ) FILES_SCRIPT="$FILES_SCRIPT $SRCDIR/script";;
|
auto | script ) FILES_SCRIPT="$FILES_SCRIPT $SRCDIR/script";;
|
||||||
esac;
|
esac;
|
||||||
|
case "$TEST_TYPE" in
|
||||||
|
ant ) FILES_ANT="$FILES_ANT $SRCDIR/ant";;
|
||||||
|
esac;
|
||||||
fi;
|
fi;
|
||||||
|
|
||||||
SCALA="${BIN_DIR}scala";
|
SCALA="${BIN_DIR}scala";
|
||||||
SCALAC="${BIN_DIR}scalac -encoding iso-8859-1";
|
SCALAC="${BIN_DIR}scalac -encoding iso-8859-1";
|
||||||
SCALAP="scalap";
|
SCALAP="scalap";
|
||||||
|
ANT="ant";
|
||||||
|
|
||||||
if [ -n "$OBJDIR" ]; then
|
if [ -n "$OBJDIR" ]; then
|
||||||
if [ -d "$OBJDIR" ] || mkdir -p "$OBJDIR"; then
|
if [ -d "$OBJDIR" ] || mkdir -p "$OBJDIR"; then
|
||||||
|
|
Loading…
Reference in New Issue