From fa6054b874d1a9b6428d30f88a0346fc994c97de Mon Sep 17 00:00:00 2001 From: Felix Mulder Date: Wed, 23 Nov 2016 15:42:46 +0100 Subject: Make tests depend on environment variables for classpath jars sbt adds the correct jars to classpath and the tests depend on `packageAll` which creates these. When using something else however, these together with `sbt-interfaces` do not get propagated from the build. To remedy this and make the testing a bit more flexible, we now take these from `sys.props` instead, see `tests/dotty/Jars.scala`. If the props aren't defined we fall back to the ones default to sbt. --- compiler/test/dotc/tests.scala | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) (limited to 'compiler/test/dotc/tests.scala') diff --git a/compiler/test/dotc/tests.scala b/compiler/test/dotc/tests.scala index a3946947c..7d3dbd8db 100644 --- a/compiler/test/dotc/tests.scala +++ b/compiler/test/dotc/tests.scala @@ -1,5 +1,6 @@ package dotc +import dotty.Jars import dotty.tools.dotc.CompilerTest import org.junit.{Before, Test} @@ -32,18 +33,28 @@ class tests extends CompilerTest { ) val classPath = { - val paths = List( - "../library/target/scala-2.11/dotty-library_2.11-0.1-SNAPSHOT.jar", - "./target/scala-2.11/dotty-compiler_2.11-0.1-SNAPSHOT.jar", - "../interfaces/target/dotty-interfaces-0.1-SNAPSHOT.jar" - ).map { p => + val paths = Jars.dottyTestDeps map { p => val file = new JFile(p) assert( file.exists, - s"""File "$p" couldn't be found. Run `packageAll` from build tool before testing""" + s"""|File "$p" couldn't be found. Run `packageAll` from build tool before + |testing. + | + |If running without sbt, test paths need to be setup environment variables: + | + | - DOTTY_LIBRARY + | - DOTTY_COMPILER + | - DOTTY_INTERFACES + | - DOTTY_EXTRAS + | + |Where these all contain locations, except extras which is a comma + |separated list of jars. + | + |When compiling with eclipse, you need the sbt-interfaces jar, but + |it in extras.""" ) file.getAbsolutePath - }.mkString(":") + } mkString (":") List("-classpath", paths) } @@ -338,10 +349,16 @@ class tests extends CompilerTest { @Test def tasty_tests = compileDir(testsDir, "tasty", testPickling) @Test def tasty_bootstrap = { + val f = new JFile(getClass.getProtectionDomain.getCodeSource.getLocation.getPath) + println(f) + println(System.getProperty("java.class.path")) + + val opt = List("-priorityclasspath", defaultOutputDir, "-Ylog-classpath") // first compile dotty compileDir(dottyDir, ".", List("-deep", "-Ycheck-reentrant", "-strict"))(allowDeepSubtypes) + compileDir(dottyDir, "tools", opt) compileDir(toolsDir, "dotc", opt) compileDir(dotcDir, "ast", opt) -- cgit v1.2.3