Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Introduced additonal parallelism to the test suite execution #204

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ before_script:
'

env:
- TEST_BED_M2_HOME=/home/travis/.arquillian/mvn/apache-maven-3.3.9
- TEST_BED_M2_HOME=/home/travis/.arquillian/mvn/apache-maven-3.3.9 MAVEN_OPTS="-Xms512m -Xmx1024m -XX:+TieredCompilation -XX:TieredStopAtLevel=1"

script:
- ./mvnw clean verify -P travis -DJAVA_OPTS="-XX:-UseLoopPredicate"
- ./mvnw clean verify -P travis -DJAVA_OPTS="-XX:-UseLoopPredicate" -T 100
- 'if [ $GENERATE_DOC -eq 0 ]; then
./.asciidoctor/generate.sh --keep;
fi'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@ public class BuildConfigurator {
private boolean ignoreBuildFailure = false;
private boolean skipTests = false;
private File workingDirectory;
private String mavenOpts = "-Xms512m -Xmx1024m";
private String mavenOpts = "-Xms512m -Xmx1024m -XX:+TieredCompilation -XX:TieredStopAtLevel=1";
private String mavenVersion;
private Using usingInstallation;
private boolean useThreads = true;

BuildConfigurator(ProjectBuilder projectBuilder) {
systemProperties.put("surefire.exitTimeout", "-1"); // see http://bit.ly/2vARQ5p
Expand Down Expand Up @@ -183,11 +184,16 @@ public BuildConfigurator excludeProjects(String... projects) {
return this;
}

public BuildConfigurator useMavenVersion(String mavenVersion){
public BuildConfigurator useMavenVersion(String mavenVersion) {
this.mavenVersion = mavenVersion;
return this;
}

public BuildConfigurator useThreads(boolean useThreads){
this.useThreads = useThreads;
return this;
}

void enableDebugOptions() {
if (isRemoteDebugEnabled()) {
final String debugOptions = String.format(MVN_DEBUG_AGENT, shouldSuspend(), getRemotePort());
Expand Down Expand Up @@ -268,6 +274,10 @@ String getMavenVersion() {
return mavenVersion;
}

boolean useThreads(){
return useThreads;
}

private int getAvailableLocalPort() {
ServerSocket socket = null;
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ private BuiltProject executeGoals(String... goals) {
final BuiltProject build = embeddedMaven
.setShowVersion(true)
.setGoals(goals)
.setThreads(buildConfigurator.useThreads() ? "50C" : null)
.setProjects(buildConfigurator.getModulesToBeBuilt())
.setDebug(buildConfigurator.isMavenDebugOutputEnabled())
.setQuiet(buildConfigurator.disableQuietWhenAnyDebugModeEnabled() && buildConfigurator.isQuietMode())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public void test_with_reuse_forks_false() {

@Test
public void test_with_fork_count_zero() {
verifyTestSuiteExecution("forkCount", "0");
verifyTestSuiteExecution(false, "forkCount", "0");
}

@Test
Expand All @@ -57,10 +57,14 @@ public void test_with_multiple_forks_not_reusing_forks() {

@Test
public void test_with_fork_count_zero_not_reusing_forks() {
verifyTestSuiteExecution("forkCount", "0", "reuseForks", "false");
verifyTestSuiteExecution(false, "forkCount", "0", "reuseForks", "false");
}

private void verifyTestSuiteExecution(String... systemPropertiesPairs) {
private void verifyTestSuiteExecution(String... systemPropertiesPairs){
verifyTestSuiteExecution(true, systemPropertiesPairs);
}

private void verifyTestSuiteExecution(boolean useThreads, String... systemPropertiesPairs) {
// given
final Project project = testBed.getProject();

Expand All @@ -80,6 +84,7 @@ private void verifyTestSuiteExecution(String... systemPropertiesPairs) {
.logBuildOutput(false)
.withSystemProperties(systemPropertiesPairs)
.withSystemProperties(SMART_TESTING_REPORT_ENABLE, "true")
.useThreads(useThreads)
.configure()
.run();

Expand Down