Skip to content

Commit 23c6cef

Browse files
Merge pull request #3962 from dotty-staging/no-legacy-no-more
Remove legacy tests
2 parents a09f385 + cf8bbb3 commit 23c6cef

35 files changed

+216
-924
lines changed

.drone.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,6 @@ pipeline:
1414

1515
# TESTS:
1616
# We run tests in parallel. Tests run in a copy of the working directory to avoid conflict
17-
test_legacy:
18-
group: test
19-
image: lampepfl/dotty:2018-01-17
20-
commands:
21-
- cp -R . /tmp/0/ && cd /tmp/0/
22-
- ./project/scripts/sbt legacyTests
23-
2417
test:
2518
group: test
2619
image: lampepfl/dotty:2018-01-17

compiler/test/dotc/tests.scala

Lines changed: 0 additions & 389 deletions
This file was deleted.

compiler/test/dotty/TestCategories.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ package dotty
33
/** SlowTest category for JUnit */
44
trait SlowTests
55

6-
/** Legacy tests category for JUnit */
7-
trait LegacyTests
6+
/** Meta tests category for JUnit */
7+
trait VulpixMetaTests

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

Lines changed: 0 additions & 438 deletions
This file was deleted.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package dotty.tools
2+
package vulpix
3+
4+
import org.junit.Test
5+
import org.junit.experimental.categories.Category
6+
import scala.concurrent.duration._
7+
import dotty.Properties
8+
import TestConfiguration._
9+
10+
/** Meta tests for the Vulpix test suite. This test follows the structure of
11+
* CompilationTests.scala. It is ment to be called from bash to diff with
12+
* output againts an expected result.
13+
*/
14+
@Category(Array(classOf[dotty.VulpixMetaTests]))
15+
class VulpixMetaTests extends ParallelTesting {
16+
def maxDuration = 1.seconds
17+
def numberOfSlaves = 5
18+
def safeMode = Properties.testsSafeMode
19+
def isInteractive = SummaryReport.isInteractive
20+
def testFilter = Properties.testsFilter
21+
implicit val summaryReport: SummaryReporting = new SummaryReport
22+
implicit def testGroup: TestGroup = TestGroup("VulpixMetaTests")
23+
24+
@Test def compilePos: Unit = compileFilesInDir("tests/vulpix-tests/meta/pos", defaultOptions).checkCompile()
25+
@Test def compileNeg: Unit = compileFilesInDir("tests/vulpix-tests/meta/neg", defaultOptions).checkExpectedErrors()
26+
@Test def runAll: Unit = compileFilesInDir("tests/vulpix-tests/meta/run", defaultOptions).checkRuns()
27+
}

compiler/test/dotty/tools/vulpix/VulpixTests.scala

Lines changed: 0 additions & 84 deletions
This file was deleted.
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
package dotty.tools
2+
package vulpix
3+
4+
import org.junit.Assert._
5+
import org.junit.Test
6+
7+
import scala.concurrent.duration._
8+
import scala.util.control.NonFatal
9+
10+
/** Unit tests for the Vulpix test suite */
11+
class VulpixUnitTests extends ParallelTesting {
12+
import TestConfiguration._
13+
14+
implicit val _: SummaryReporting = new NoSummaryReport
15+
16+
implicit def testGroup: TestGroup = TestGroup("VulpixTests")
17+
18+
def maxDuration = 3.seconds
19+
def numberOfSlaves = 5
20+
def safeMode = sys.env.get("SAFEMODE").isDefined
21+
def isInteractive = !sys.env.contains("DRONE")
22+
def testFilter = None
23+
24+
// To fail with something else than an AssertionError
25+
def fail(): Unit = throw new Exception("didn't fail properly")
26+
27+
@Test def missingFile: Unit =
28+
try {
29+
compileFile("tests/vulpix-tests/unit/i-dont-exist.scala", defaultOptions).expectFailure.checkExpectedErrors()
30+
fail()
31+
} catch {
32+
case _: IllegalArgumentException => // pass!
33+
}
34+
35+
@Test def pos1Error: Unit =
36+
compileFile("tests/vulpix-tests/unit/posFail1Error.scala", defaultOptions).expectFailure.checkCompile()
37+
38+
@Test def negMissingAnnot: Unit =
39+
compileFile("tests/vulpix-tests/unit/negMissingAnnot.scala", defaultOptions).expectFailure.checkExpectedErrors()
40+
41+
@Test def negAnnotWrongLine: Unit =
42+
compileFile("tests/vulpix-tests/unit/negAnnotWrongLine.scala", defaultOptions).expectFailure.checkExpectedErrors()
43+
44+
@Test def negTooManyAnnots: Unit =
45+
compileFile("tests/vulpix-tests/unit/negTooManyAnnots.scala", defaultOptions).expectFailure.checkExpectedErrors()
46+
47+
@Test def negNoPositionAnnot: Unit =
48+
compileFile("tests/vulpix-tests/unit/negNoPositionAnnots.scala", defaultOptions).expectFailure.checkExpectedErrors()
49+
50+
@Test def runCompileFail: Unit =
51+
compileFile("tests/vulpix-tests/unit/posFail1Error.scala", defaultOptions).expectFailure.checkRuns()
52+
53+
@Test def runWrongOutput1: Unit =
54+
compileFile("tests/vulpix-tests/unit/runWrongOutput1.scala", defaultOptions).expectFailure.checkRuns()
55+
56+
@Test def runWrongOutput2: Unit =
57+
compileFile("tests/vulpix-tests/unit/runWrongOutput2.scala", defaultOptions).expectFailure.checkRuns()
58+
59+
@Test def runDiffOutput1: Unit =
60+
compileFile("tests/vulpix-tests/unit/runDiffOutput1.scala", defaultOptions).expectFailure.checkRuns()
61+
62+
@Test def runStackOverflow: Unit =
63+
compileFile("tests/vulpix-tests/unit/stackOverflow.scala", defaultOptions).expectFailure.checkRuns()
64+
65+
@Test def runOutRedirects: Unit =
66+
compileFile("tests/vulpix-tests/unit/i2147.scala", defaultOptions).expectFailure.checkRuns()
67+
68+
@Test def infiteNonRec: Unit =
69+
compileFile("tests/vulpix-tests/unit/infinite.scala", defaultOptions).expectFailure.checkRuns()
70+
71+
@Test def infiteTailRec: Unit =
72+
compileFile("tests/vulpix-tests/unit/infiniteTail.scala", defaultOptions).expectFailure.checkRuns()
73+
74+
@Test def infiniteAlloc: Unit =
75+
compileFile("tests/vulpix-tests/unit/infiniteAlloc.scala", defaultOptions).expectFailure.checkRuns()
76+
77+
@Test def deadlock: Unit =
78+
compileFile("tests/vulpix-tests/unit/deadlock.scala", defaultOptions).expectFailure.checkRuns()
79+
80+
@Test def badJava: Unit =
81+
try {
82+
compileFile("tests/vulpix-tests/unit/BadJava.java", defaultOptions).suppressAllOutput.checkCompile()
83+
fail()
84+
} catch {
85+
case ae: AssertionError => assertTrue(ae.getMessage.contains("java compilation failed"))
86+
}
87+
88+
@Test def runTimeout: Unit = {
89+
try {
90+
compileFile("tests/vulpix-tests/unit/timeout.scala", defaultOptions).checkRuns()
91+
fail()
92+
} catch {
93+
case ae: AssertionError =>
94+
assertEquals(ae.getMessage, "Run test failed, but should not, reasons:\n - test 'tests/vulpix-tests/unit/timeout.scala' timed out")
95+
}
96+
}
97+
}

project/Build.scala

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -501,8 +501,8 @@ object Build {
501501
baseDirectory in Test := baseDirectory.value / "..",
502502

503503
test in Test := {
504-
// Exclude legacy tests by default
505-
(testOnly in Test).toTask(" -- --exclude-categories=dotty.LegacyTests").value
504+
// Exclude VulpixMetaTests
505+
(testOnly in Test).toTask(" -- --exclude-categories=dotty.VulpixMetaTests").value
506506
},
507507

508508
testOptions in Test += Tests.Argument(
@@ -1148,8 +1148,7 @@ object Build {
11481148
dependsOn(dottyCompiler).
11491149
dependsOn(dottyLibrary).
11501150
nonBootstrappedSettings(
1151-
addCommandAlias("run", "dotty-compiler/run") ++
1152-
addCommandAlias("legacyTests", "dotty-compiler/testOnly dotc.tests")
1151+
addCommandAlias("run", "dotty-compiler/run")
11531152
)
11541153

11551154
def asDottyCompiler(implicit mode: Mode): Project = project.withCommonSettings.

project/scripts/cmdTests

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,3 +93,24 @@ mkdir -p out/scriptedtest0
9393

9494
# echo ":quit" | ./dist-bootstrapped/target/pack/bin/dotr # not supported by CI
9595
mkdir -p _site && ./bin/dotd -project Hello -siteroot _site tests/run/hello.scala
96+
97+
echo "running Vulpix meta test"
98+
tmp=$(mktemp)
99+
if ./project/scripts/sbt "dotty-compiler/testOnly dotty.tools.vulpix.VulpixMetaTests" > "$tmp" 2>&1; then
100+
cat "$tmp"
101+
echo "failed: sbt exited without error on VulpixMetaTests, these tests are expected to fail"
102+
exit -1
103+
fi
104+
tmp1=$(mktemp)
105+
cat "$tmp" | sed '/Test run started/,$!d' > "$tmp1"
106+
set +x # Or the code below produces too much noise
107+
while read expected <&4 && read actual <&3; do
108+
if [[ "$expected" != *"SKIP" ]]; then
109+
if [ "$actual" != "$expected" ]; then
110+
echo "failed Vulpix meta: the output of sbt differs from the expected output"
111+
echo "expected : $expected"
112+
echo "actual : $actual"
113+
exit -1
114+
fi
115+
fi
116+
done 3<"$tmp1" 4<"./tests/vulpix-tests/meta/sbt-output.check"

project/scripts/sbt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ sbt -J-Xmx4096m \
1212
-J-XX:MaxMetaspaceSize=1024m \
1313
-Ddotty.drone.mem=4096m \
1414
-Dsbt.ivy.home=/var/cache/drone/ivy2 \
15+
-no-colors \
1516
"$CMD"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
class MissingErrorAnnotation {
2+
// Missing annotation for the following unbound identifier:
3+
a
4+
5+
// Another one (to check that both of them get reported)
6+
b
7+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
class NegTest {
2+
a // Does not compile
3+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
hello
2+
world
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
object Test {
2+
def main(args: Array[String]): Unit = {
3+
println("world")
4+
println("hello") // Out of order
5+
}
6+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
[info] Test run started
2+
[info] Test dotty.tools.vulpix.VulpixMetaTests.runAll started
3+
Testing tests/vulpix-tests/meta/run/wrong-check-file.scala
4+
Output from 'tests/vulpix-tests/meta/run/wrong-check-file.scala' did not match check file.
5+
Diff (expected on the left, actual right):
6+
hello | world
7+
world | hello
8+
EOF | EOF
9+
10+
[error] Test dotty.tools.vulpix.VulpixMetaTests.runAll failed: java.lang.AssertionError: Run test failed, but should not, reasons:
11+
[error] , took 1.682 sec SKIP
12+
[error] at dotty.tools.vulpix.ParallelTesting$CompilationTest.checkRuns(ParallelTesting.scala:993) SKIP
13+
[error] at dotty.tools.vulpix.VulpixMetaTests.runAll(VulpixMetaTests.scala:26) SKIP
14+
[error] ...
15+
[info] Test dotty.tools.vulpix.VulpixMetaTests.compileNeg started
16+
Testing tests/vulpix-tests/meta/neg/missing-error-annotation.scala
17+
18+
Wrong number of errors encountered when compiling ../out/VulpixMetaTests/neg/missing-error-annotation, expected: 0, actual: 2
19+
[error] Test dotty.tools.vulpix.VulpixMetaTests.compileNeg failed: java.lang.AssertionError: Neg test shouldn't have failed, but did. Reasons:
20+
[error]
21+
[error] - encountered 2 error(s), took 0.093 sec SKIP
22+
[error] at dotty.tools.vulpix.ParallelTesting$CompilationTest.checkExpectedErrors(ParallelTesting.scala:975) SKIP
23+
[error] at dotty.tools.vulpix.VulpixMetaTests.compileNeg(VulpixMetaTests.scala:25) SKIP
24+
[error] ...
25+
[info] Test dotty.tools.vulpix.VulpixMetaTests.compilePos started
26+
Testing tests/vulpix-tests/meta/pos/does-not-compile.scala
27+
-- [E006] Unbound Identifier Error: /home/olivier/workspace/dotty/tests/vulpix-tests/meta/pos/does-not-compile.scala:2:2 SKIP
28+
2 | a // Does not compile
29+
| ^
30+
| not found: a
31+
[error] Test dotty.tools.vulpix.VulpixMetaTests.compilePos failed: java.lang.AssertionError: Expected no errors when compiling, failed for the following reason(s):
32+
[error]
33+
[error] - encountered 1 error(s), took 0.069 sec SKIP
34+
[error] at dotty.tools.vulpix.ParallelTesting$CompilationTest.checkCompile(ParallelTesting.scala:958) SKIP
35+
[error] at dotty.tools.vulpix.VulpixMetaTests.compilePos(VulpixMetaTests.scala:24) SKIP
36+
[error] ...
37+
[info] Test run finished: 3 failed, 0 ignored, 3 total, 1.982s SKIP
38+
[error] Failed: Total 3, Failed 3, Errors 0, Passed 0
39+
[error] Failed tests:
40+
[error] dotty.tools.vulpix.VulpixMetaTests
41+
[error] (dotty-compiler/test:testOnly) sbt.TestsFailedException: Tests unsuccessful
42+
[error] Total time: 3 s, completed Feb 5, 2018 5:10:12 PM SKIP
File renamed without changes.
File renamed without changes.

tests/vulpix-tests/unit/timeout.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
object Test {
2+
def main(args: Array[String]): Unit = {
3+
Thread.sleep(10 * 1000)
4+
}
5+
}

0 commit comments

Comments
 (0)