Skip to content

Commit 707fca6

Browse files
Disable flaky os-lib tests; make mill use cache
1 parent 7a77cea commit 707fca6

File tree

2 files changed

+20
-12
lines changed

2 files changed

+20
-12
lines changed

community-build/test/scala/dotty/communitybuild/CommunityBuildTest.scala

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,19 @@ import org.junit.{Ignore, Test}
77
import org.junit.Assert.{assertEquals, fail}
88
import org.junit.experimental.categories.Category
99

10-
case class MillCommunityProject(project: String, testCommand: String,
11-
publishCommand: String = "", extraArgs: List[String] = Nil,
12-
dependencies: List[MillCommunityProject] = Nil)
10+
final case class MillCommunityProject(project: String, testCommand: String,
11+
updateCommand: String, publishCommand: String = "",
12+
extraArgs: List[String] = Nil, dependencies: List[MillCommunityProject] = Nil)
1313
import communityBuildCommons.{ log, exec, communitybuildDir }
1414

1515
private var published = false
1616

17-
final def test()(given suite: CommunityBuildTest) =
18-
dependencies.foreach(_.publish())
19-
suite.test(project, "./mill", extraArgs :+ testCommand)
17+
def test(update: Boolean)(given suite: CommunityBuildTest) =
18+
val millCmd = if update then updateCommand else testCommand
19+
if !update then dependencies.foreach(_.publish())
20+
suite.test(project, "./mill", extraArgs :+ millCmd)
2021

21-
final def publish() =
22+
def publish() =
2223
if !published
2324
log(s"Publishing $project")
2425
val projectDir = communitybuildDir.resolve("community-projects").resolve(project)
@@ -58,26 +59,30 @@ object projects
5859
project = "utest",
5960
testCommand = s"utest.jvm[$compilerVersion].test",
6061
publishCommand = s"utest.jvm[$compilerVersion].publishLocal",
62+
updateCommand = "utest.jvm[$compilerVersion].compileClasspath",
6163
extraArgs = List("-i", "-D", s"dottyVersion=$compilerVersion")
6264
)
6365

6466
val sourcecode = MillCommunityProject(
6567
project = "sourcecode",
6668
testCommand = s"sourcecode.jvm[$compilerVersion].test",
69+
updateCommand = s"sourcecode.jvm[$compilerVersion].compileClasspath",
6770
publishCommand = s"sourcecode.jvm[$compilerVersion].publishLocal",
6871
extraArgs = List("-i", "-D", s"dottyVersion=$compilerVersion"),
6972
)
7073

7174
val oslib = MillCommunityProject(
7275
project = "os-lib",
7376
testCommand = s"os[$compilerVersion].test",
77+
updateCommand = s"os[$compilerVersion].compileClasspath",
7478
extraArgs = List("-i", "-D", s"dottyVersion=$compilerVersion"),
7579
dependencies = List(utest, sourcecode)
7680
)
7781

7882
val oslibWatch = MillCommunityProject(
7983
project = "os-lib",
8084
testCommand = s"os.watch[$compilerVersion].test",
85+
updateCommand = s"os.watch[$compilerVersion].compileClasspath",
8186
extraArgs = List("-i", "-D", s"dottyVersion=$compilerVersion"),
8287
dependencies = List(utest, sourcecode)
8388
)
@@ -88,6 +93,7 @@ class CommunityBuildTest {
8893
import communityBuildCommons._
8994

9095
given CommunityBuildTest = this
96+
val updateCacheRun = false
9197

9298
def testSbt(project: String, testCommand: String, updateCommand: String, extraSbtArgs: Seq[String] = Nil) = {
9399
// Workaround for https://github.com/sbt/sbt/issues/4395
@@ -228,13 +234,13 @@ class CommunityBuildTest {
228234
updateCommand = "dotty-community-build/update"
229235
)
230236

231-
@Test def utest = projects.utest.test()
237+
@Test def utest = projects.utest.test(updateCacheRun)
232238

233-
@Test def sourcecode = projects.sourcecode.test()
239+
@Test def sourcecode = projects.sourcecode.test(updateCacheRun)
234240

235-
@Test def oslib = projects.oslib.test()
241+
@Test def oslib = projects.oslib.test(updateCacheRun)
236242

237-
@Test def oslibWatch = projects.oslibWatch.test()
243+
@Test def oslibWatch = projects.oslibWatch.test(updateCacheRun)
238244

239245
@Test def stdLib213 = testSbt(
240246
project = "stdLib213",
@@ -291,6 +297,8 @@ class UpdateCategory
291297

292298
@Category(Array(classOf[UpdateCategory]))
293299
class CommunityBuildUpdate extends CommunityBuildTest {
300+
override val updateCacheRun = true
301+
294302
override def testSbt(project: String, testCommand: String, updateCommand: String, extraSbtArgs: Seq[String]): Unit =
295303
super.testSbt(project, updateCommand, null, extraSbtArgs)
296304
}

0 commit comments

Comments
 (0)