summaryrefslogtreecommitdiff
path: root/test/partest
diff options
context:
space:
mode:
authorSom Snytt <som.snytt@gmail.com>2013-03-29 22:45:08 -0700
committerSom Snytt <som.snytt@gmail.com>2013-04-18 15:34:20 -0700
commit01edd0436c19314ea581f86362b1d547a4b7fdb8 (patch)
tree9c3c98a293edca806cbdb10cbd828de1e0cf8a5f /test/partest
parent86651c1205de9d901a9f0a0214888ac7c4724b81 (diff)
downloadscala-01edd0436c19314ea581f86362b1d547a4b7fdb8.tar.gz
scala-01edd0436c19314ea581f86362b1d547a4b7fdb8.tar.bz2
scala-01edd0436c19314ea581f86362b1d547a4b7fdb8.zip
SI-7314 Partest locates tools.jar and javac
This commit lets partest locate tools.jar the way REPL does, with the addition that java.home.parent is also tried. The partest script will use JAVAC_CMD if set, or else JAVA_HOME, and will try the sibling of JAVACMD if set (on the theory that if you specify java, you are avoiding the path lookup and javac may also be in that special place), or else query the path for javac. The use cases are: no env vars, look around java.home; JDK or JAVA_HOME is set; JAVACMD is set; and finally tools.jar can live in jre/lib/ext and the fallback deep search will find it. These cases have been tried on cygwin with Java installed under s"Program${space}Files", which is usually the most brittle environment. That means tested with bash. The windows partest.bat has not been upgraded or side-graded.
Diffstat (limited to 'test/partest')
-rwxr-xr-xtest/partest25
1 files changed, 22 insertions, 3 deletions
diff --git a/test/partest b/test/partest
index 8243316cca..e3270f8eaa 100755
--- a/test/partest
+++ b/test/partest
@@ -75,6 +75,22 @@ if [ -z "$EXT_CLASSPATH" ] ; then
fi
fi
+# Locate a javac command
+# Try: JAVA_HOME, sibling to specific JAVACMD, or PATH
+# Don't fail if there is no javac, since not all tests require it.
+if [ -z "$JAVAC_CMD" ] ; then
+ if [ -n "${JAVA_HOME}" ] && [ -f "${JAVA_HOME}/bin/javac" ] ; then
+ JAVAC_CMD="${JAVA_HOME}/bin/javac"
+ fi
+ if [ -z "$JAVAC_CMD" ] && [ -n "$JAVACMD" ] ; then
+ JDIR=`dirname "${JAVACMD}"`
+ JAVAC_CMD="${JDIR}/javac"
+ fi
+ if [ -z "$JAVAC_CMD" ] ; then
+ JAVAC_CMD=`type -p javac`
+ fi
+fi
+
if $cygwin; then
if [ "$OS" = "Windows_NT" ] && cygpath -m .>/dev/null 2>/dev/null ; then
format=mixed
@@ -87,6 +103,9 @@ if $cygwin; then
if [ -n "${JAVACMD}" ] ; then
JAVACMD=`cygpath --$format "$JAVACMD"`
fi
+ if [ -n "${JAVAC_CMD}" ] ; then
+ JAVAC_CMD=`cygpath --$format "$JAVAC_CMD"`
+ fi
SCALA_HOME=`cygpath --$format "$SCALA_HOME"`
EXT_CLASSPATH=`cygpath --path --$format "$EXT_CLASSPATH"`
fi
@@ -97,8 +116,8 @@ fi
JAVA_OPTS="-Xmx1024M -Xms64M -XX:MaxPermSize=128M $JAVA_OPTS"
# the ant task doesn't supply any options by default,
-# so don't to that here either -- note that you may want to pass -optimise
-# to mimic what happens during nightlies
+# so don't do that here either -- note that you may want to pass -optimise
+# to mimic what happens during nightlies.
# [ -n "$SCALAC_OPTS" ] || SCALAC_OPTS="-deprecation"
partestDebugStr=""
@@ -114,5 +133,5 @@ fi
-Dpartest.javacmd="${JAVACMD}" \
-Dpartest.java_opts="${JAVA_OPTS}" \
-Dpartest.scalac_opts="${SCALAC_OPTS}" \
- -Dpartest.javac_cmd="${JAVA_HOME}/bin/javac" \
+ -Dpartest.javac_cmd="${JAVAC_CMD}" \
scala.tools.partest.nest.NestRunner "$@"