Skip to content

Commit 1933890

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 1933890

File tree

2 files changed

+23
-23
lines changed

2 files changed

+23
-23
lines changed

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

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,4 +109,27 @@ class BootstrappedOnlyCompilationTests extends ParallelTesting {
109109
compileDir("compiler/src/dotty/tools/dotc/core/tasty", picklingWithCompilerOptions) +
110110
compileDir("compiler/src/dotty/tools/dotc/core/unpickleScala2", picklingWithCompilerOptions)
111111
}.limitThreads(4).checkCompile()
112+
113+
@Test def testPlugins: Unit = {
114+
val pluginFile = "plugin.properties"
115+
116+
// 1. hack with absolute path for -Xplugin
117+
// 2. copy `pluginFile` to destination
118+
def compileFilesInDir(dir: String): CompilationTest = {
119+
val outDir = defaultOutputDir + "testPlugins/"
120+
val sourceDir = new java.io.File(dir)
121+
122+
val dirs = sourceDir.listFiles.toList.filter(_.isDirectory)
123+
val targets = dirs.map { dir =>
124+
val compileDir = createOutputDirsForDir(dir, sourceDir, outDir)
125+
Files.copy(dir.toPath.resolve(pluginFile), compileDir.toPath.resolve(pluginFile), StandardCopyOption.REPLACE_EXISTING)
126+
val flags = TestFlags(withCompilerClasspath, noCheckOptions).and("-Xplugin:" + compileDir.getAbsolutePath)
127+
SeparateCompilationSource("testPlugins", dir, flags, compileDir)
128+
}
129+
130+
new CompilationTest(targets)
131+
}
132+
133+
compileFilesInDir("tests/plugins/neg").checkExpectedErrors()
134+
}
112135
}

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)