diff options
author | Felix Mulder <felix.mulder@gmail.com> | 2017-03-13 11:50:53 +0100 |
---|---|---|
committer | Felix Mulder <felix.mulder@gmail.com> | 2017-03-29 10:33:22 +0200 |
commit | c52457c7554f5a0648190562e6750067f811844c (patch) | |
tree | 3cbc8ea26b37b2604ccf3acb7ed9cbb99ec8f85e /compiler/test/dotty | |
parent | 3acba311aaf831c1b249341142e1308ed1f73050 (diff) | |
download | dotty-c52457c7554f5a0648190562e6750067f811844c.tar.gz dotty-c52457c7554f5a0648190562e6750067f811844c.tar.bz2 dotty-c52457c7554f5a0648190562e6750067f811844c.zip |
Add ability to compile single files
Diffstat (limited to 'compiler/test/dotty')
-rw-r--r-- | compiler/test/dotty/tools/dotc/ParallelTesting.scala | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/compiler/test/dotty/tools/dotc/ParallelTesting.scala b/compiler/test/dotty/tools/dotc/ParallelTesting.scala index f1363e49f..2ce585a96 100644 --- a/compiler/test/dotty/tools/dotc/ParallelTesting.scala +++ b/compiler/test/dotty/tools/dotc/ParallelTesting.scala @@ -272,7 +272,6 @@ trait ParallelTesting { } private def requirements(f: String, sourceDir: JFile, outDir: String): Unit = { - require(f.contains("/tests"), "only allowed to run integration tests from `tests` dir using this method") require(sourceDir.isDirectory && sourceDir.exists, "passed non-directory to `compileFilesInDir`") require(outDir.last == '/', "please specify an `outDir` with a trailing slash") } @@ -283,6 +282,22 @@ trait ParallelTesting { else (dirs, f :: files) } + def compileFileInDir(f: String, flags: Array[String])(implicit outDirectory: String): CompilationTest = { + // each calling method gets its own unique output directory, in which we + // place the dir being compiled: + val callingMethod = Thread.currentThread.getStackTrace.apply(3).getMethodName + val outDir = outDirectory + callingMethod + "/" + val sourceFile = new JFile(f) + val parent = sourceFile.getParentFile + require( + sourceFile.exists && !sourceFile.isDirectory && + (parent ne null) && parent.exists && parent.isDirectory, + s"Source file: $f, didn't exist" + ) + + new CompilationTest(toCompilerDirFromFile(sourceFile, parent, outDir) :: Nil, f, flags) + } + def compileFilesInDir(f: String, flags: Array[String])(implicit outDirectory: String): CompilationTest = { // each calling method gets its own unique output directory, in which we // place the dir being compiled: |