-
-
Notifications
You must be signed in to change notification settings - Fork 349
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix
PromptLogger
60s delay, improve test grouping prompt lines, bre…
…akup large `scalalib` test suites (#3649) * Break up some of the long-poll tests in scalalib.test into small classes, in preparation for `testForkGrouping` * Fix issue with `PromptLogger` waiting an extra 60s when paused before exiting when calling `shutdown` * Improve the prompt line message for the test groups to show a collapsed list of test class names (which will get further collapsed by the prompt as necessary)
- Loading branch information
Showing
16 changed files
with
958 additions
and
722 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package mill.scalalib | ||
|
||
import scala.util.Properties | ||
import mill.api.Result | ||
import mill.testkit.{UnitTester, TestBaseModule} | ||
import utest._ | ||
|
||
// Ensure the assembly is runnable, even if we have assembled lots of dependencies into it | ||
// Reproduction of issues: | ||
// - https://github.com/com-lihaoyi/mill/issues/528 | ||
// - https://github.com/com-lihaoyi/mill/issues/2650 | ||
|
||
object AssemblyExeTests extends TestSuite with AssemblyTestUtils { | ||
|
||
def tests: Tests = Tests { | ||
test("Assembly") { | ||
test("exe") { | ||
test("small") - UnitTester(TestCase, sourceRoot = sources).scoped { eval => | ||
val Right(result) = eval(TestCase.exe.small.assembly) | ||
val originalPath = result.value.path | ||
val resolvedPath = | ||
if (Properties.isWin) { | ||
val winPath = originalPath / os.up / s"${originalPath.last}.bat" | ||
os.copy(originalPath, winPath) | ||
winPath | ||
} else originalPath | ||
runAssembly(resolvedPath, TestCase.millSourcePath, checkExe = true) | ||
} | ||
|
||
test("large-should-fail") - UnitTester(TestCase, sourceRoot = sources).scoped { eval => | ||
val Left(Result.Failure(msg, Some(res))) = eval(TestCase.exe.large.assembly) | ||
val expectedMsg = | ||
"""The created assembly jar contains more than 65535 ZIP entries. | ||
|JARs of that size are known to not work correctly with a prepended shell script. | ||
|Either reduce the entries count of the assembly or disable the prepended shell script with: | ||
| | ||
| def prependShellScript = "" | ||
|""".stripMargin | ||
assert(msg == expectedMsg) | ||
|
||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package mill.scalalib | ||
|
||
import mill.testkit.{UnitTester, TestBaseModule} | ||
import utest._ | ||
|
||
object AssemblyNoExeTests extends TestSuite with AssemblyTestUtils { | ||
|
||
def tests: Tests = Tests { | ||
test("Assembly") { | ||
test("noExe") { | ||
test("small") - UnitTester(TestCase, sourceRoot = sources).scoped { eval => | ||
val Right(result) = eval(TestCase.noExe.small.assembly) | ||
runAssembly(result.value.path, TestCase.millSourcePath) | ||
|
||
} | ||
test("large") - UnitTester(TestCase, sourceRoot = sources).scoped { eval => | ||
val Right(result) = eval(TestCase.noExe.large.assembly) | ||
runAssembly(result.value.path, TestCase.millSourcePath) | ||
|
||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package mill.scalalib | ||
|
||
import mill._ | ||
import mill.util.Jvm | ||
import mill.testkit.{UnitTester, TestBaseModule} | ||
|
||
trait AssemblyTestUtils { | ||
|
||
object TestCase extends TestBaseModule { | ||
trait Setup extends ScalaModule { | ||
def scalaVersion = "2.13.11" | ||
|
||
def sources = Task.Sources(T.workspace / "src") | ||
|
||
def ivyDeps = super.ivyDeps() ++ Agg( | ||
ivy"com.lihaoyi::scalatags:0.8.2", | ||
ivy"com.lihaoyi::mainargs:0.4.0", | ||
ivy"org.apache.avro:avro:1.11.1" | ||
) | ||
} | ||
|
||
trait ExtraDeps extends ScalaModule { | ||
def ivyDeps = super.ivyDeps() ++ Agg( | ||
ivy"dev.zio::zio:2.0.15", | ||
ivy"org.typelevel::cats-core:2.9.0", | ||
ivy"org.apache.spark::spark-core:3.4.0", | ||
ivy"dev.zio::zio-metrics-connectors:2.0.8", | ||
ivy"dev.zio::zio-http:3.0.0-RC2" | ||
) | ||
} | ||
|
||
object noExe extends Module { | ||
object small extends Setup { | ||
override def prependShellScript: T[String] = "" | ||
} | ||
|
||
object large extends Setup with ExtraDeps { | ||
override def prependShellScript: T[String] = "" | ||
} | ||
} | ||
|
||
object exe extends Module { | ||
object small extends Setup | ||
|
||
object large extends Setup with ExtraDeps | ||
} | ||
|
||
} | ||
|
||
val sources = os.Path(sys.env("MILL_TEST_RESOURCE_DIR")) / "assembly" | ||
def runAssembly(file: os.Path, wd: os.Path, checkExe: Boolean = false): Unit = { | ||
println(s"File size: ${os.stat(file).size}") | ||
Jvm.runSubprocess( | ||
commandArgs = Seq(Jvm.javaExe, "-jar", file.toString(), "--text", "tutu"), | ||
envArgs = Map.empty[String, String], | ||
workingDir = wd | ||
) | ||
if (checkExe) { | ||
Jvm.runSubprocess( | ||
commandArgs = Seq(file.toString(), "--text", "tutu"), | ||
envArgs = Map.empty[String, String], | ||
workingDir = wd | ||
) | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.