Skip to content

Commit

Permalink
Fix Scala 2 nightly test failures by tagging them as flaky or skipping
Browse files Browse the repository at this point in the history
  • Loading branch information
Gedochao committed Aug 1, 2024
1 parent 1b1214e commit b9e65fc
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import scala.build.internal.Regexes.scala3LtsRegex
import scala.build.errors.ScalaVersionError

class BuildOptionsTests extends TestUtil.ScalaCliBuildSuite {
override def munitFlakyOK: Boolean = TestUtil.isCI

val extraRepoTmpDir = os.temp.dir(prefix = "scala-cli-tests-extra-repo-")
val directories = Directories.under(extraRepoTmpDir)
Expand Down Expand Up @@ -217,7 +218,7 @@ class BuildOptionsTests extends TestUtil.ScalaCliBuildSuite {
)
}

test("-S 2.nightly option works") {
test("-S 2.nightly option works".flaky) {
val options = BuildOptions(
scalaOptions = ScalaOptions(
scalaVersion = Some(MaybeScalaVersion("2.nightly"))
Expand All @@ -230,7 +231,7 @@ class BuildOptionsTests extends TestUtil.ScalaCliBuildSuite {
)
}

test("-S 2.13.nightly option works") {
test("-S 2.13.nightly option works".flaky) {
val options = BuildOptions(
scalaOptions = ScalaOptions(
scalaVersion = Some(MaybeScalaVersion("2.13.nightly"))
Expand All @@ -256,7 +257,7 @@ class BuildOptionsTests extends TestUtil.ScalaCliBuildSuite {
)
}

test("-S 2.12.nightly option works") {
test("-S 2.12.nightly option works".flaky) {
val options = BuildOptions(
scalaOptions = ScalaOptions(
scalaVersion = Some(MaybeScalaVersion("2.12.nightly"))
Expand All @@ -269,7 +270,7 @@ class BuildOptionsTests extends TestUtil.ScalaCliBuildSuite {
)
}

test("-S 2.13.9-bin-4505094 option works without repo specification") {
test("-S 2.13.9-bin-4505094 option works without repo specification".flaky) {
val options = BuildOptions(
scalaOptions = ScalaOptions(
scalaVersion = Some(MaybeScalaVersion("2.13.9-bin-4505094"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import com.eed3si9n.expecty.Expecty.expect
import scala.util.Properties

class ReplTests213 extends ReplTestDefinitions with Test213 {
test("repl custom repositories work") {
test("repl custom repositories work".flaky) {
TestInputs.empty.fromRoot { root =>
os.proc(
TestUtil.cli,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,6 @@ trait RunScalacCompatTestDefinitions {
}
}

override def munitFlakyOK: Boolean = TestUtil.isCI && Properties.isMac && TestUtil.isNativeCli

def verifyScala212VersionCompiles(scalaPatchVersion: String): Unit = {
TestInputs(os.rel / "s.sc" -> "println(util.Properties.versionNumberString)").fromRoot {
root =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class RunTests212 extends RunTestDefinitions with Test212 {
)
}
}
test("2.12.nightly") {
test("2.12.nightly".flaky) {
TestInputs(os.rel / "sample.sc" -> "println(util.Properties.versionNumberString)").fromRoot {
root =>
val res =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package scala.cli.integration
import com.eed3si9n.expecty.Expecty.expect

class RunTests213 extends RunTestDefinitions with Test213 {
test("ensure typesafe PR validation snapshot Scala versions are supported") {
test("ensure typesafe PR validation snapshot Scala versions are supported".flaky) {
TestInputs(os.rel / "sample.sc" -> "println(util.Properties.versionNumberString)").fromRoot {
root =>
val snapshotScalaVersion = "2.13.11-bin-89f3de5-SNAPSHOT"
Expand All @@ -22,7 +22,7 @@ class RunTests213 extends RunTestDefinitions with Test213 {
expect(res.out.trim() == "2.13.11-20221128-143922-89f3de5")
}
}
test("2.13.nightly") {
test("2.13.nightly".flaky) {
TestInputs(os.rel / "sample.sc" -> "println(util.Properties.versionNumberString)").fromRoot {
root =>
val res =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ abstract class ScalaCliSuite extends munit.FunSuite {
Option(System.getenv("SCALA_CLI_IT_GROUP"))
.flatMap(_.toIntOption)
.exists(_ != group.idx)

override def munitFlakyOK: Boolean = TestUtil.isCI
}

object ScalaCliSuite {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ class SipScalaTests extends ScalaCliSuite with SbtTestHelper with MillTestHelper
}

test(
s"default Scala version ($sv2) coming straight from a predefined local repository $withBloopString"
s"default Scala version ($sv2) coming straight from a predefined local repository $withBloopString".flaky
) {
TestInputs(
os.rel / "simple.sc" -> "println(scala.util.Properties.versionNumberString)"
Expand Down
8 changes: 4 additions & 4 deletions website/docs/commands/compile.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ having to pass their addresses as input after the `--repo` flag.

For compiling with the latest Scala 2 nightly build:

```bash
```bash ignore
scala-cli Hello.scala -S 2.nightly
```

Expand All @@ -111,21 +111,21 @@ scala-cli Hello.scala -S 3.nightly

For compiling with a specific nightly build you have the full version:

```bash
```bash ignore
scala-cli Hello.scala -S 2.13.9-bin-4505094
```

For setting this inside scala files, use [`using` directives](../guides/introduction/using-directives.md):

```scala compile
```scala
//> using scala 2.nightly
```

```scala compile
//> using scala 3.nightly
```

```scala compile
```scala
//> using scala 2.13.9-bin-4505094
```

Expand Down

0 comments on commit b9e65fc

Please sign in to comment.