Skip to content

Commit

Permalink
Use process pool for test runner (0.12.x) (#4679)
Browse files Browse the repository at this point in the history
ported for 0.12.x from #4614

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
  • Loading branch information
HollandDM and autofix-ci[bot] authored Mar 10, 2025
1 parent 95f1fe3 commit 3bc4294
Show file tree
Hide file tree
Showing 122 changed files with 1,705 additions and 154 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,6 @@ dist/
build/
*.bak
mill-assembly.jar
mill-native
mill-native
*.mill.orig
*.mill.rej
7 changes: 7 additions & 0 deletions docs/modules/ROOT/pages/javalib/testing.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ include::partial$example/javalib/testing/3-integration-suite.adoc[]

include::partial$example/javalib/testing/4-test-grouping.adoc[]

== Test Work Stealing Scheduler

include::partial$example/javalib/testing/5-test-stealing.adoc[]

== Test Grouping & Test Work Stealing

include::partial$example/javalib/testing/6-test-group-stealing.adoc[]

== Github Actions Test Reports

Expand Down
7 changes: 7 additions & 0 deletions docs/modules/ROOT/pages/kotlinlib/testing.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ include::partial$example/kotlinlib/testing/3-integration-suite.adoc[]

include::partial$example/kotlinlib/testing/4-test-grouping.adoc[]

== Test Work Stealing Scheduler

include::partial$example/kotlinlib/testing/5-test-stealing.adoc[]

== Test Grouping & Test Work Stealing

include::partial$example/kotlinlib/testing/6-test-group-stealing.adoc[]

== Github Actions Test Reports

Expand Down
8 changes: 8 additions & 0 deletions docs/modules/ROOT/pages/scalalib/testing.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ include::partial$example/scalalib/testing/3-integration-suite.adoc[]

include::partial$example/scalalib/testing/4-test-grouping.adoc[]

== Test Work Stealing Scheduler

include::partial$example/scalalib/testing/5-test-stealing.adoc[]

== Test Grouping & Test Work Stealing

include::partial$example/scalalib/testing/6-test-group-stealing.adoc[]

== Github Actions Test Reports

If you use Github Actions for CI, you can use https://github.com/mikepenz/action-junit-report in
Expand Down
15 changes: 15 additions & 0 deletions example/javalib/testing/5-test-stealing/build.mill
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//// SNIPPET:BUILD1
package build
import mill._, javalib._

object foo extends JavaModule {
object test extends JavaTests {
def testFramework = "com.novocode.junit.JUnitFramework"
def ivyDeps = Agg(
ivy"com.novocode:junit-interface:0.11",
ivy"org.mockito:mockito-core:4.6.1"
)
def testEnableWorkStealing = true
}
}
//// SNIPPET:END
11 changes: 11 additions & 0 deletions example/javalib/testing/5-test-stealing/foo/src/foo/Foo.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package foo;

public class Foo {
public static void main(String[] args) {
System.out.println(greet("World"));
}

public static String greet(String name) {
return "Hello " + name;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package foo;

import org.junit.Test;

public class RandomTestsA extends RandomTestsUtils {
@Test
public void test1() throws Exception {
testGreeting("Storm", 38);
}
// Removed other tests to simplify
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package foo;

import org.junit.Test;

public class RandomTestsB extends RandomTestsUtils {
@Test
public void test1() throws Exception {
testGreeting("Dakota", 18);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package foo;

import org.junit.Test;

public class RandomTestsC extends RandomTestsUtils {
@Test
public void test1() throws Exception {
testGreeting("Jordan", 95);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package foo;

import org.junit.Test;

public class RandomTestsD extends RandomTestsUtils {
@Test
public void test1() throws Exception {
testGreeting("Kai", 14);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package foo;

import org.junit.Test;

public class RandomTestsE extends RandomTestsUtils {
@Test
public void test1() throws Exception {
testGreeting("Sage", 28);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package foo;

import org.junit.Test;

public class RandomTestsF extends RandomTestsUtils {
@Test
public void test1() throws Exception {
testGreeting("Winter", 12);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package foo;

import org.junit.Test;

public class RandomTestsG extends RandomTestsUtils {
@Test
public void test1() throws Exception {
testGreeting("Finn", 45);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package foo;

import org.junit.Test;

public class RandomTestsH extends RandomTestsUtils {
@Test
public void test1() throws Exception {
testGreeting("Haven", 22);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package foo;

import org.junit.Test;

public class RandomTestsI extends RandomTestsUtils {
@Test
public void test1() throws Exception {
testGreeting("Mars", 16);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package foo;

import org.junit.Test;

public class RandomTestsJ extends RandomTestsUtils {
@Test
public void test1() throws Exception {
testGreeting("Storm", 38);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package foo;

import static org.junit.Assert.assertEquals;

public class RandomTestsUtils {
protected void testGreeting(String name, int sleepTime) throws Exception {
String greeted = Foo.greet(name);
Thread.sleep(sleepTime);
assertEquals("Hello " + name, greeted);
}
}
19 changes: 19 additions & 0 deletions example/javalib/testing/6-test-group-stealing/build.mill
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//// SNIPPET:BUILD1
package build
import mill._, javalib._

object foo extends JavaModule {
object test extends JavaTests {
def testFramework = "com.novocode.junit.JUnitFramework"
def ivyDeps = Agg(
ivy"com.novocode:junit-interface:0.11",
ivy"org.mockito:mockito-core:4.6.1"
)
def testForkGrouping =
discoveredTestClasses().groupMapReduce(_.contains("GroupX"))(Seq(_))(_ ++ _).toSeq.sortBy(
data => !data._1
).map(_._2)
def testEnableWorkStealing = true
}
}
//// SNIPPET:END
11 changes: 11 additions & 0 deletions example/javalib/testing/6-test-group-stealing/foo/src/foo/Foo.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package foo;

public class Foo {
public static void main(String[] args) {
System.out.println(greet("World"));
}

public static String greet(String name) {
return "Hello " + name;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package foo;

import org.junit.Test;

public class GroupX1 extends RandomTestsUtils {
@Test
public void test1() throws Exception {
testGreeting("Aether", 55);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package foo;

import org.junit.Test;

public class GroupX10 extends RandomTestsUtils {
@Test
public void test1() throws Exception {
testGreeting("Echo", 52);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package foo;

import org.junit.Test;

public class GroupX2 extends RandomTestsUtils {
@Test
public void test1() throws Exception {
testGreeting("Chronos", 35);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package foo;

import org.junit.Test;

public class GroupX3 extends RandomTestsUtils {
@Test
public void test1() throws Exception {
testGreeting("Fortuna", 25);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package foo;

import org.junit.Test;

public class GroupX4 extends RandomTestsUtils {
@Test
public void test1() throws Exception {
testGreeting("Janus", 21);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package foo;

import org.junit.Test;

public class GroupX5 extends RandomTestsUtils {
@Test
public void test1() throws Exception {
testGreeting("Orion", 95);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package foo;

import org.junit.Test;

public class GroupX6 extends RandomTestsUtils {
@Test
public void test1() throws Exception {
testGreeting("Perseus", 34);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package foo;

import org.junit.Test;

public class GroupX7 extends RandomTestsUtils {
@Test
public void test1() throws Exception {
testGreeting("Selene", 52);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package foo;

import org.junit.Test;

public class GroupX8 extends RandomTestsUtils {
@Test
public void test1() throws Exception {
testGreeting("Uranus", 25);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package foo;

import org.junit.Test;

public class GroupX9 extends RandomTestsUtils {
@Test
public void test1() throws Exception {
testGreeting("Ymir", 17);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package foo;

import org.junit.Test;

public class GroupY1 extends RandomTestsUtils {
@Test
public void test1() throws Exception {
testGreeting("Hades", 15);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package foo;

import org.junit.Test;

public class GroupY10 extends RandomTestsUtils {
@Test
public void test1() throws Exception {
testGreeting("Rama", 25);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package foo;

import org.junit.Test;

public class GroupY2 extends RandomTestsUtils {
@Test
public void test1() throws Exception {
testGreeting("Odin", 34);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package foo;

import org.junit.Test;

public class GroupY3 extends RandomTestsUtils {
@Test
public void test1() throws Exception {
testGreeting("Ra", 21);
}
}
Loading

0 comments on commit 3bc4294

Please sign in to comment.