aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Mulder <felix.mulder@gmail.com>2016-10-25 17:01:53 +0200
committerGuillaume Martres <smarter@ubuntu.com>2016-11-22 01:35:06 +0100
commit0da788c52121e44de6be0cdc7a0c4c6e1b125ff9 (patch)
treee0658e385f711e679effbcd65e94f921a9208cee
parent0bd959813d94edd01d44513b57f633594805c9d7 (diff)
downloaddotty-0da788c52121e44de6be0cdc7a0c4c6e1b125ff9.tar.gz
dotty-0da788c52121e44de6be0cdc7a0c4c6e1b125ff9.tar.bz2
dotty-0da788c52121e44de6be0cdc7a0c4c6e1b125ff9.zip
Add bin project to separate scripted tests from compiler tests
-rw-r--r--bin/test/TestScripts.scala (renamed from test/scripts/TestDotc.scala)26
-rw-r--r--project/Build.scala23
2 files changed, 31 insertions, 18 deletions
diff --git a/test/scripts/TestDotc.scala b/bin/test/TestScripts.scala
index f662a2695..1a200c1b9 100644
--- a/test/scripts/TestDotc.scala
+++ b/bin/test/TestScripts.scala
@@ -7,7 +7,7 @@ import scala.io.Source
import scala.sys.process.{Process, ProcessLogger}
import java.io.{File => JFile, FileNotFoundException}
-class TestDotc {
+class TestScripts {
private val lineSep = util.Properties.lineSeparator
private def doUnlessWindows(op: => Unit) =
if (!System.getProperty("os.name").toLowerCase.contains("windows"))
@@ -28,11 +28,13 @@ class TestDotc {
}
try {
- for (jar <- Source.fromFile(".packages").getLines())
+ for (jar <- Source.fromFile("../.packages").getLines())
delete(jar)
- delete(".packages")
- delete("src/dotty/tools/dotc/Dummy.scala")
+ delete("../.packages")
+ delete("./src/dotty/tools/dotc/Dummy.scala")
+ delete("HelloWorld.class")
+ delete("HelloWorld$.class")
} catch {
case _: FileNotFoundException => ()
}
@@ -45,7 +47,7 @@ class TestDotc {
* execute it using dotr
*/
@Test def buildAndRunHelloWorld = doUnlessWindows {
- val (retDotc, dotcOutput) = executeScript("bin/dotc tests/pos/HelloWorld.scala")
+ val (retDotc, dotcOutput) = executeScript("./bin/dotc ./tests/pos/HelloWorld.scala")
// Check correct output of building and running dotc
assert(
@@ -53,7 +55,7 @@ class TestDotc {
s"bin/dotc script did not run properly. Output:$lineSep$dotcOutput"
)
- val (retDotr, dotrOutput) = executeScript("bin/dotr HelloWorld")
+ val (retDotr, dotrOutput) = executeScript("./bin/dotr HelloWorld")
assert(
retDotr == 0 && dotrOutput == "hello world",
s"Running hello world exited with status: $retDotr and output: $dotrOutput"
@@ -64,13 +66,13 @@ class TestDotc {
* rebuild dotty if needed
*/
@Test def rebuildIfNecessary = doUnlessWindows {
- val (retFirstBuild, _) = executeScript("bin/dotc tests/pos/HelloWorld.scala")
+ val (retFirstBuild, _) = executeScript("./bin/dotc ./tests/pos/HelloWorld.scala")
assert(retFirstBuild == 0, "building dotc failed")
- // Create a new file
- new JFile("src/dotty/tools/dotc/Dummy.scala").createNewFile()
+ // Create a new file to force rebuild
+ new JFile("./src/dotty/tools/dotc/Dummy.scala").createNewFile()
- val (retSecondBuild, output) = executeScript("bin/dotc tests/pos/HelloWorld.scala")
+ val (retSecondBuild, output) = executeScript("./bin/dotc ./tests/pos/HelloWorld.scala")
assert(
retSecondBuild == 0 && output.contains("rebuilding"),
s"Rebuilding the tool should result in jar files being rebuilt. Status: $retSecondBuild, output:$lineSep$output")
@@ -78,10 +80,10 @@ class TestDotc {
/** if no changes to dotty, dotc script should be fast */
@Test def beFastOnNoChanges = doUnlessWindows {
- val (retFirstBuild, _) = executeScript("bin/dotc tests/pos/HelloWorld.scala")
+ val (retFirstBuild, _) = executeScript("./bin/dotc ./tests/pos/HelloWorld.scala")
assert(retFirstBuild == 0, "building dotc failed")
- val (ret, output) = executeScript("bin/dotc tests/pos/HelloWorld.scala")
+ val (ret, output) = executeScript("./bin/dotc ./tests/pos/HelloWorld.scala")
assert(
ret == 0 && !output.contains("rebuilding"),
s"Project recompiled when it didn't need to be. Status $ret, output:$lineSep$output")
diff --git a/project/Build.scala b/project/Build.scala
index e650325d4..e7fab03eb 100644
--- a/project/Build.scala
+++ b/project/Build.scala
@@ -216,33 +216,44 @@ object DottyBuild extends Build {
";dotty-interfaces/package" +
";dotty-compiler/package" +
";dotty-library/package" +
- ";test:package"
+ ";dotty-compiler/test:package"
) ++
addCommandAlias(
"partest",
";packageAll" +
";test:runMain dotc.build" +
";lockPartestFile" +
- ";test:test" +
- ";runPartestRunner"
+ ";dotty-compiler/test:test" +
+ ";runPartestRunner" +
+ ";bin/test" // script tests need to run after the unit tests
) ++
- addCommandAlias("partest-only",
+ addCommandAlias(
+ "partest-only",
";packageAll" +
";test:runMain dotc.build" +
";lockPartestFile" +
- ";test:test-only dotc.tests" +
+ ";dotty-compiler/test:test-only dotc.tests" +
";runPartestRunner"
) ++
addCommandAlias(
"partest-only-no-bootstrap",
";packageAll" +
";lockPartestFile" +
- ";test:test-only dotc.tests" +
+ ";dotty-compiler/test:test-only dotc.tests" +
";runPartestRunner"
)
).
settings(publishing)
+ /* Contains unit tests for the scripts */
+ lazy val bin = project.in(file("bin")).
+ settings(sourceStructure).
+ settings(
+ parallelExecution in Test := false,
+ libraryDependencies +=
+ "com.novocode" % "junit-interface" % "0.11" % "test"
+ )
+
lazy val `dotty-library` = project.in(file("library")).
settings(sourceStructure).
settings(