Skip to content

Commit dc0c818

Browse files
committed
Plugin tests should be bootstrapped-only
They require having the current compiler on the classpath, and the non-bootstrapped compiler cannot be loaded if it was compiled with an old Dotty.
1 parent c33d3cf commit dc0c818

File tree

2 files changed

+25
-23
lines changed

2 files changed

+25
-23
lines changed

compiler/test/dotty/tools/dotc/BootstrappedOnlyCompilationTests.scala

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import org.junit.experimental.categories.Category
1010
import scala.concurrent.duration._
1111
import vulpix._
1212

13+
import java.nio.file._
14+
1315
@Category(Array(classOf[BootstrappedOnlyTests]))
1416
class BootstrappedOnlyCompilationTests extends ParallelTesting {
1517
import ParallelTesting._
@@ -109,4 +111,27 @@ class BootstrappedOnlyCompilationTests extends ParallelTesting {
109111
compileDir("compiler/src/dotty/tools/dotc/core/tasty", picklingWithCompilerOptions) +
110112
compileDir("compiler/src/dotty/tools/dotc/core/unpickleScala2", picklingWithCompilerOptions)
111113
}.limitThreads(4).checkCompile()
114+
115+
@Test def testPlugins: Unit = {
116+
val pluginFile = "plugin.properties"
117+
118+
// 1. hack with absolute path for -Xplugin
119+
// 2. copy `pluginFile` to destination
120+
def compileFilesInDir(dir: String): CompilationTest = {
121+
val outDir = defaultOutputDir + "testPlugins/"
122+
val sourceDir = new java.io.File(dir)
123+
124+
val dirs = sourceDir.listFiles.toList.filter(_.isDirectory)
125+
val targets = dirs.map { dir =>
126+
val compileDir = createOutputDirsForDir(dir, sourceDir, outDir)
127+
Files.copy(dir.toPath.resolve(pluginFile), compileDir.toPath.resolve(pluginFile), StandardCopyOption.REPLACE_EXISTING)
128+
val flags = TestFlags(withCompilerClasspath, noCheckOptions).and("-Xplugin:" + compileDir.getAbsolutePath)
129+
SeparateCompilationSource("testPlugins", dir, flags, compileDir)
130+
}
131+
132+
new CompilationTest(targets)
133+
}
134+
135+
compileFilesInDir("tests/plugins/neg").checkExpectedErrors()
136+
}
112137
}

compiler/test/dotty/tools/dotc/CompilationTests.scala

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -272,29 +272,6 @@ class CompilationTests extends ParallelTesting {
272272

273273
tests.foreach(_.delete())
274274
}
275-
276-
@Test def testPlugins: Unit = {
277-
val pluginFile = "plugin.properties"
278-
279-
// 1. hack with absolute path for -Xplugin
280-
// 2. copy `pluginFile` to destination
281-
def compileFilesInDir(dir: String): CompilationTest = {
282-
val outDir = defaultOutputDir + "testPlugins/"
283-
val sourceDir = new java.io.File(dir)
284-
285-
val dirs = sourceDir.listFiles.toList.filter(_.isDirectory)
286-
val targets = dirs.map { dir =>
287-
val compileDir = createOutputDirsForDir(dir, sourceDir, outDir)
288-
Files.copy(dir.toPath.resolve(pluginFile), compileDir.toPath.resolve(pluginFile), StandardCopyOption.REPLACE_EXISTING)
289-
val flags = TestFlags(withCompilerClasspath, noCheckOptions).and("-Xplugin:" + compileDir.getAbsolutePath)
290-
SeparateCompilationSource("testPlugins", dir, flags, compileDir)
291-
}
292-
293-
new CompilationTest(targets)
294-
}
295-
296-
compileFilesInDir("tests/plugins/neg").checkExpectedErrors()
297-
}
298275
}
299276

300277
object CompilationTests {

0 commit comments

Comments
 (0)