summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authormichelou <michelou@epfl.ch>2006-04-04 14:37:34 +0000
committermichelou <michelou@epfl.ch>2006-04-04 14:37:34 +0000
commitce508d2ea12645df34e0330c6d5e8e3411475ce9 (patch)
tree9c02391a18f233a59c4d30d7216d88b6436349d8 /test
parentac8b46abda17de619beb2b27dfe9d820c5e189cf (diff)
downloadscala-ce508d2ea12645df34e0330c6d5e8e3411475ce9.tar.gz
scala-ce508d2ea12645df34e0330c6d5e8e3411475ce9.tar.bz2
scala-ce508d2ea12645df34e0330c6d5e8e3411475ce9.zip
updated script 'test/scalatest' to also work wh...
updated script 'test/scalatest' to also work when packaged with sbaz
Diffstat (limited to 'test')
-rwxr-xr-xtest/scalatest48
1 files changed, 38 insertions, 10 deletions
diff --git a/test/scalatest b/test/scalatest
index 7edff5a5fe..a5bd6a3547 100755
--- a/test/scalatest
+++ b/test/scalatest
@@ -413,6 +413,25 @@ test_add_file() {
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
@@ -431,10 +450,8 @@ while [ -h "$SOURCE" ]; do
fi;
done;
PREFIX=`dirname "$SOURCE"`/..;
-prefix=$PREFIX;
PREFIX=`cd "$PREFIX"; pwd`;
-
##############################################################################
# Invocation of $SCRIPT
@@ -445,7 +462,13 @@ FAILED="false";
ERRORS=0;
SUCCESS_COUNT=0;
FAILURE_COUNT=0;
-TESTROOT="$PREFIX/test";
+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="""";
@@ -460,12 +483,12 @@ FILES_MSIL="";
QUICK="$PREFIX/build/quick/exec"
if [ -d "$PREFIX/dists" ]; then
LATEST="$PREFIX/dists/latest/bin";
+elif [ -d "$PREFIX/build" ]; then
+ LATEST="$QUICK";
+elif [ -d "$PREFIX/bin" ]; then
+ LATEST="$PREFIX/bin";
else
- if [ -d "$PREFIX/build" ]; then
- LATEST="$QUICK";
- else
- LATEST="$PREFIX/bin";
- fi;
+ abort "Scala binaries 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
@@ -536,7 +559,7 @@ fi;
SCALA="${BIN_DIR}scala";
SOCOS="${BIN_DIR}scalac";
-SCALAP="$LATEST/scalap";
+SCALAP="${BIN_DIR}scalap";
SCALA_SCALA_ARGS="-Xmx512M $SCALA_SCALA_ARGS";
export SCALA_SCALA_ARGS;
@@ -550,7 +573,12 @@ if [ -n "$OBJDIR" ]; then
fi
printf_outline "Source directory is : $SRCDIR\\n";
-printf_outline "Scala binaries in : $BIN_DIR\\n";
+bin_dir=$BIN_DIR
+if [ -z "$bin_dir" ]; then
+ bin_dir=`which "$SOCOS"` && bin_dir=`dirname "$bin_dir"`/;
+ bin_dir=`test_get_location ${bin_dir}scalac`;
+fi;
+printf_outline "Scala binaries in : $bin_dir\\n";
jvm_version=`${JAVACMD:=java} -version 2>&1 | head -3 | tail -1`
printf_outline "Java runtime is : $jvm_version\\n\\n";