The default of tests.jvms should not be capped (#35259)
Default to the number of physical cores across all sockets instead.
This commit is contained in:
parent
ae6a33237f
commit
fda59ff969
|
@ -150,8 +150,9 @@ Default value provided below in [brackets].
|
||||||
|
|
||||||
=== Load balancing and caches.
|
=== Load balancing and caches.
|
||||||
|
|
||||||
By default the tests run on up to 4 JVMs based on the number of cores. If you
|
By default the tests run on multiple processes using all the available cores on all
|
||||||
want to explicitly specify the number of JVMs you can do so on the command
|
available CPUs. Not including hyper-threading.
|
||||||
|
If you want to explicitly specify the number of JVMs you can do so on the command
|
||||||
line:
|
line:
|
||||||
|
|
||||||
----------------------------
|
----------------------------
|
||||||
|
|
|
@ -773,9 +773,32 @@ class BuildPlugin implements Plugin<Project> {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void applyCommonTestConfig(Project project) {
|
static void applyCommonTestConfig(Project project) {
|
||||||
|
String defaultParallel = 'auto'
|
||||||
|
// Count physical cores on any Linux distro ( don't count hyper-threading )
|
||||||
|
if (project.file("/proc/cpuinfo").exists()) {
|
||||||
|
Map<String, Integer> socketToCore = [:]
|
||||||
|
String currentID = ""
|
||||||
|
project.file("/proc/cpuinfo").readLines().forEach({ line ->
|
||||||
|
if (line.contains(":")) {
|
||||||
|
List<String> parts = line.split(":", 2).collect({it.trim()})
|
||||||
|
String name = parts[0], value = parts[1]
|
||||||
|
// the ID of the CPU socket
|
||||||
|
if (name == "physical id") {
|
||||||
|
currentID = value
|
||||||
|
}
|
||||||
|
// Number of cores not including hyper-threading
|
||||||
|
if (name == "cpu cores") {
|
||||||
|
assert currentID.isEmpty() == false
|
||||||
|
socketToCore[currentID] = Integer.valueOf(value)
|
||||||
|
currentID = ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
defaultParallel = socketToCore.values().sum().toString();
|
||||||
|
}
|
||||||
project.tasks.withType(RandomizedTestingTask) {
|
project.tasks.withType(RandomizedTestingTask) {
|
||||||
jvm "${project.runtimeJavaHome}/bin/java"
|
jvm "${project.runtimeJavaHome}/bin/java"
|
||||||
parallelism System.getProperty('tests.jvms', 'auto')
|
parallelism System.getProperty('tests.jvms', defaultParallel)
|
||||||
ifNoTests System.getProperty('tests.ifNoTests', 'fail')
|
ifNoTests System.getProperty('tests.ifNoTests', 'fail')
|
||||||
onNonEmptyWorkDirectory 'wipe'
|
onNonEmptyWorkDirectory 'wipe'
|
||||||
leaveTemporary true
|
leaveTemporary true
|
||||||
|
|
Loading…
Reference in New Issue