Support parallel execution of IDEA tests
This commit is contained in:
@@ -31,6 +31,11 @@ import java.lang.reflect.Modifier;
|
||||
* Works differently for Gradle and JPS. Default is Gradle for now.
|
||||
*/
|
||||
public class JUnit3RunnerWithInners extends Runner implements Filterable, Sortable {
|
||||
|
||||
static {
|
||||
KotlinTestUtils.setIdeaSystemPathProperties();
|
||||
}
|
||||
|
||||
private final Runner delegateRunner;
|
||||
|
||||
public JUnit3RunnerWithInners(Class<?> klass) {
|
||||
|
||||
@@ -90,6 +90,8 @@ import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import static com.intellij.openapi.application.PathManager.PROPERTY_CONFIG_PATH;
|
||||
import static com.intellij.openapi.application.PathManager.PROPERTY_SYSTEM_PATH;
|
||||
import static org.jetbrains.kotlin.test.InTextDirectivesUtils.*;
|
||||
|
||||
public class KotlinTestUtils {
|
||||
@@ -112,6 +114,19 @@ public class KotlinTestUtils {
|
||||
|
||||
private static final List<File> filesToDelete = new ArrayList<>();
|
||||
|
||||
// It's important that this is not created per test, but rather per process.
|
||||
public static final String IDEA_SYSTEM_PATH;
|
||||
|
||||
static {
|
||||
try {
|
||||
IDEA_SYSTEM_PATH = tmpDirForReusableLibrary("idea-system").getPath();
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Syntax:
|
||||
*
|
||||
@@ -1294,4 +1309,9 @@ public class KotlinTestUtils {
|
||||
// Several extension if name contains another dot
|
||||
return name.indexOf('.', firstDotIndex + 1) != -1;
|
||||
}
|
||||
|
||||
public static void setIdeaSystemPathProperties() {
|
||||
System.setProperty(PROPERTY_SYSTEM_PATH, IDEA_SYSTEM_PATH);
|
||||
System.setProperty(PROPERTY_CONFIG_PATH, IDEA_SYSTEM_PATH + "/config");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
tasks.withType<Test> {
|
||||
maxParallelForks = Math.max(Runtime.getRuntime().availableProcessors() / 2, 1)
|
||||
}
|
||||
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
id("jps-compatible")
|
||||
|
||||
Reference in New Issue
Block a user