Skip to content

Commit 0cbee8f

Browse files
committed
Run all tests with Scala 2 library TASTy
Run all tests with Scala 2 library TASTy with some failing tests blacklisted.
1 parent 50498d8 commit 0cbee8f

File tree

10 files changed

+111
-12
lines changed

10 files changed

+111
-12
lines changed

.github/workflows/ci.yaml

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,51 @@ jobs:
142142
run: |
143143
./project/scripts/sbt ";sjsSandbox/run ;sjsSandbox/test ;sjsJUnitTests/test ;set sjsJUnitTests/scalaJSLinkerConfig ~= switchToESModules ;sjsJUnitTests/test ;sjsCompilerTests/test"
144144
145-
- name: Test with Scala 2 library TASTy
145+
- name: Test with Scala 2 library TASTy (fast)
146146
run: ./project/scripts/sbt ";set ThisBuild/Build.useScala2LibraryTasty := true ;scala3-bootstrapped/testCompilation i5; scala3-bootstrapped/testCompilation tests/run/typelevel-peano.scala" # only test a subset of test to avoid doubling the CI execution time
147147

148+
test_scala2_library_tasty:
149+
runs-on: [self-hosted, Linux]
150+
container:
151+
image: lampepfl/dotty:2021-03-22
152+
options: --cpu-shares 4096
153+
volumes:
154+
- ${{ github.workspace }}/../../cache/sbt:/root/.sbt
155+
- ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache
156+
- ${{ github.workspace }}/../../cache/general:/root/.cache
157+
if: "github.event_name == 'schedule' && github.repository == 'lampepfl/dotty'
158+
|| (
159+
github.event_name == 'pull_request'
160+
&& contains(github.event.pull_request.body, '[test_scala2_library_tasty]')
161+
)
162+
|| (
163+
github.event_name == 'workflow_dispatch'
164+
&& github.repository == 'lampepfl/dotty'
165+
)"
166+
167+
steps:
168+
- name: Set JDK 16 as default
169+
run: echo "/usr/lib/jvm/java-16-openjdk-amd64/bin" >> $GITHUB_PATH
170+
171+
- name: Reset existing repo
172+
run: git -c "http.https://github.com/.extraheader=" fetch --recurse-submodules=no "https://github.com/lampepfl/dotty" && git reset --hard FETCH_HEAD || true
173+
174+
- name: Checkout cleanup script
175+
uses: actions/checkout@v3
176+
177+
- name: Cleanup
178+
run: .github/workflows/cleanup.sh
179+
180+
- name: Git Checkout
181+
uses: actions/checkout@v3
182+
183+
- name: Add SBT proxy repositories
184+
run: cp -vf .github/workflows/repositories /root/.sbt/ ; true
185+
186+
- name: Test with Scala 2 library TASTy
187+
run: ./project/scripts/sbt ";set ThisBuild/Build.useScala2LibraryTasty := true ;scala3-bootstrapped/testCompilation"
188+
189+
148190
test_windows_fast:
149191
runs-on: [self-hosted, Windows]
150192
if: "(
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
## tests/run-macros
2+
tasty-extractors-1
3+
tasty-extractors-2
4+
tasty-extractors-types
5+
6+
## tests/neg
7+
i8752.scala
8+
f-interpolator-neg.scala # Additional: A pure expression does nothing in statement position
9+
10+
## (#18882) tests/init-global/neg
11+
t9312.scala
12+
unapplySeq-implicit-arg.scala
13+
unapplySeq-implicit-arg2.scala
14+
unapplySeq-implicit-arg3.scala
15+
16+
## (#18882) tests/init-global/pos
17+
patmat.scala
18+
patmat-interpolator.scala
19+
unapplySeq-implicit-arg-pos.scala
20+
global-cycle11.scala
21+
22+
## tests/patmat
23+
t7746.scala # order of exhaustivity suggestions differs
24+
t4408.scala # order of exhaustivity suggestions differs
25+
patmat-ortype.scala # order of exhaustivity suggestions differs
26+
i13003.scala # order of exhaustivity suggestions differs
27+
28+
## Other issues
29+
# - CompilationTests.pos: tests/pos-special/stdlib
30+
# - CoverageTests.checkInstrumentedRuns

compiler/test/dotty/Properties.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ object Properties {
8585
/** scala-library TASTy jar */
8686
def scalaLibraryTasty: Option[String] = sys.props.get("dotty.tests.tasties.scalaLibrary")
8787

88+
/** If we are using the scala-library TASTy jar */
89+
def usingScalaLibraryTasty: Boolean = scalaLibraryTasty.isDefined
90+
8891
/** scala-asm jar */
8992
def scalaAsm: String = sys.props("dotty.tests.classes.scalaAsm")
9093

compiler/test/dotty/tools/TestSources.scala

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import java.io.File
66
import java.nio.file._
77

88
import scala.jdk.CollectionConverters._
9+
import dotty.Properties
910

1011
object TestSources {
1112

@@ -36,6 +37,14 @@ object TestSources {
3637
def runTestRecheckExcluded: List[String] = loadList(runTestRecheckExcludesFile)
3738
def runLazyValsAllowlist: List[String] = loadList(runLazyValsAllowlistFile)
3839

40+
// other lists
41+
42+
def scala2LibraryTastyBlacklistFile: String = "compiler/test/dotc/scala2-library-tasty.blacklist"
43+
44+
def scala2LibraryTastyBlacklisted: List[String] =
45+
if Properties.usingScalaLibraryTasty then loadList(scala2LibraryTastyBlacklistFile)
46+
else Nil
47+
3948
// load lists
4049

4150
private def loadList(path: String): List[String] = {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ class BootstrappedOnlyCompilationTests {
120120

121121
@Test def runMacros: Unit = {
122122
implicit val testGroup: TestGroup = TestGroup("runMacros")
123-
compileFilesInDir("tests/run-macros", defaultOptions.and("-Xcheck-macros"))
123+
compileFilesInDir("tests/run-macros", defaultOptions.and("-Xcheck-macros"), FileFilter.exclude(TestSources.scala2LibraryTastyBlacklisted))
124124
.checkRuns()
125125
}
126126

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,10 @@ class CompilationTests {
4444
// Run tests for legacy lazy vals
4545
compileFilesInDir("tests/pos", defaultOptions.and("-Ysafe-init", "-Ylegacy-lazy-vals", "-Ycheck-constraint-deps"), FileFilter.include(TestSources.posLazyValsAllowlist)),
4646
compileDir("tests/pos-special/java-param-names", defaultOptions.withJavacOnlyOptions("-parameters")),
47-
compileDir("tests/pos-special/stdlib", allowDeepSubtypes),
47+
) ::: (
48+
// FIXME: This fails due to a bug involving self types and capture checking
49+
if Properties.usingScalaLibraryTasty then Nil
50+
else List(compileDir("tests/pos-special/stdlib", allowDeepSubtypes))
4851
)
4952

5053
if scala.util.Properties.isJavaAtLeast("16") then
@@ -130,7 +133,7 @@ class CompilationTests {
130133
@Test def negAll: Unit = {
131134
implicit val testGroup: TestGroup = TestGroup("compileNeg")
132135
aggregateTests(
133-
compileFilesInDir("tests/neg", defaultOptions),
136+
compileFilesInDir("tests/neg", defaultOptions, FileFilter.exclude(TestSources.scala2LibraryTastyBlacklisted)),
134137
compileFilesInDir("tests/neg-deep-subtype", allowDeepSubtypes),
135138
compileFilesInDir("tests/neg-custom-args/captures", defaultOptions.and("-language:experimental.captureChecking")),
136139
compileFile("tests/neg-custom-args/sourcepath/outer/nested/Test1.scala", defaultOptions.and("-sourcepath", "tests/neg-custom-args/sourcepath")),
@@ -153,7 +156,7 @@ class CompilationTests {
153156
@Test def runAll: Unit = {
154157
implicit val testGroup: TestGroup = TestGroup("runAll")
155158
aggregateTests(
156-
compileFilesInDir("tests/run", defaultOptions.and("-Ysafe-init")),
159+
compileFilesInDir("tests/run", defaultOptions.and("-Ysafe-init"), FileFilter.exclude(TestSources.scala2LibraryTastyBlacklisted)),
157160
compileFilesInDir("tests/run-deep-subtype", allowDeepSubtypes),
158161
compileFilesInDir("tests/run-custom-args/captures", allowDeepSubtypes.and("-language:experimental.captureChecking")),
159162
// Run tests for legacy lazy vals.
@@ -213,8 +216,8 @@ class CompilationTests {
213216
@Test def checkInitGlobal: Unit = {
214217
implicit val testGroup: TestGroup = TestGroup("checkInitGlobal")
215218
val options = defaultOptions.and("-Ysafe-init-global", "-Xfatal-warnings")
216-
compileFilesInDir("tests/init-global/neg", options).checkExpectedErrors()
217-
compileFilesInDir("tests/init-global/pos", options).checkCompile()
219+
compileFilesInDir("tests/init-global/neg", options, FileFilter.exclude(TestSources.scala2LibraryTastyBlacklisted)).checkExpectedErrors()
220+
compileFilesInDir("tests/init-global/pos", options, FileFilter.exclude(TestSources.scala2LibraryTastyBlacklisted)).checkCompile()
218221
}
219222

220223
// initialization tests

compiler/test/dotty/tools/dotc/coverage/CoverageTests.scala

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package dotty.tools.dotc.coverage
33
import org.junit.Test
44
import org.junit.AfterClass
55
import org.junit.Assert.*
6+
import org.junit.Assume.*
67
import org.junit.experimental.categories.Category
78
import dotty.{BootstrappedOnlyTests, Properties}
89
import dotty.tools.vulpix.*
@@ -28,10 +29,18 @@ class CoverageTests:
2829

2930
@Test
3031
def checkCoverageStatements(): Unit =
32+
assumeFalse(
33+
"FIXME: test output differs when using Scala 2 library TASTy",
34+
Properties.usingScalaLibraryTasty
35+
)
3136
checkCoverageIn(rootSrc.resolve("pos"), false)
3237

3338
@Test
3439
def checkInstrumentedRuns(): Unit =
40+
assumeFalse(
41+
"FIXME: test output differs when using Scala 2 library TASTy",
42+
Properties.usingScalaLibraryTasty
43+
)
3544
checkCoverageIn(rootSrc.resolve("run"), true)
3645

3746
def checkCoverageIn(dir: Path, run: Boolean)(using TestGroup): Unit =

compiler/test/dotty/tools/dotc/transform/PatmatExhaustivityTest.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,14 @@ class PatmatExhaustivityTest {
6363

6464
@Test
6565
def patmatExhaustivity: Unit = {
66+
val blacklisted = TestSources.scala2LibraryTastyBlacklisted.toSet
6667
val res = Directory(testsDir).list.toList
6768
.filter(f => f.extension == "scala" || f.isDirectory)
6869
.filter { f =>
6970
val path = if f.isDirectory then f.path + "/" else f.path
7071
Properties.testsFilter.isEmpty || Properties.testsFilter.exists(path.contains)
7172
}
73+
.filterNot(f => blacklisted.contains(f.name))
7274
.map(f => if f.isDirectory then compileDir(f.jpath) else compileFile(f.jpath))
7375

7476
val failed = res.filter(!_)

docs/_docs/contributing/sending-in-a-pr.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,11 @@ Below are commonly used ones:
125125
Depending on what your PR is addressing, sometimes it doesn't make sense to run
126126
parts of the CI that usually ony runs on nightly builds.
127127

128-
|---------------------------|----------------------------------------------------|
129-
| `[test_java8]` | Execute unit tests on Java 8 |
130-
| `[test_windows_full]` | Execute unit tests on Windows |
131-
| `[test_non_bootstrapped]` | Execute unit tests using non-bootstrapped compiler |
128+
|-------------------------------|---------------------------------------------------------------------------|
129+
| `[test_java8]` | Execute unit tests on Java 8 |
130+
| `[test_windows_full]` | Execute unit tests on Windows |
131+
| `[test_non_bootstrapped]` | Execute unit tests using non-bootstrapped compiler |
132+
| `[test_scala2_library_tasty]` | Execute unit tests using bootstrapped-compiler with Scala 2 library TASTy |
132133

133134
### 7: Create your PR!
134135

project/Build.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ object Build {
176176
// Use the TASTy jar from `scala2-library-tasty` in the classpath
177177
// This only works with `scala3-bootstrapped/scalac` and tests in `scala3-bootstrapped`
178178
//
179-
// Enable in SBT with: set ThisBuild/Build.useScala2LibraryTasty := true
179+
// Enable in SBT with: `set ThisBuild/Build.useScala2LibraryTasty := true`
180180
val useScala2LibraryTasty = settingKey[Boolean]("Use the TASTy jar from `scala2-library-tasty` in the classpath")
181181

182182
// Used to compile files similar to ./bin/scalac script

0 commit comments

Comments
 (0)