Test with two threads at least #128

This commit is contained in:
Peter Palaga
2020-10-23 12:03:39 +02:00
committed by Guillaume Nodet
parent 8efcf615d8
commit 4392dd6b3d
5 changed files with 32 additions and 8 deletions

View File

@@ -68,6 +68,10 @@ public class NativeTestClient implements Client {
cmd.add("-s");
cmd.add(settings.toString());
}
if (args.stream().noneMatch(arg -> arg.startsWith("-T") || arg.equals("--threads"))) {
final int threads = Math.max(Runtime.getRuntime().availableProcessors() - 1, TestLayout.TEST_MIN_THREADS);
cmd.add("-T" + threads);
}
final ProcessBuilder builder = new ProcessBuilder(cmd.toArray(new String[0]))
.directory(layout.userDir().toFile()) //

View File

@@ -19,13 +19,14 @@ import java.nio.file.Path;
import org.jboss.fuse.mvnd.client.ClientLayout;
public class TestLayout extends ClientLayout {
static final int TEST_MIN_THREADS = 2;
private final Path testDir;
public TestLayout(Path testDir, Path mvndPropertiesPath, Path mavenHome, Path userDir, Path multiModuleProjectDirectory,
Path javaHome, Path localMavenRepository, Path settings, Path logbackConfigurationPath,
int idleTimeout, int keepAlive, int maxLostKeepAlive) {
super(mvndPropertiesPath, mavenHome, userDir, multiModuleProjectDirectory, javaHome, localMavenRepository,
settings, logbackConfigurationPath, idleTimeout, keepAlive, maxLostKeepAlive);
settings, logbackConfigurationPath, idleTimeout, keepAlive, maxLostKeepAlive, TEST_MIN_THREADS);
this.testDir = testDir;
}