Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ public static void main(String[] argv) throws Exception {

int exitCode = 0;
boolean noBuffering = batchMode || parameters.noBuffering();
try (TerminalOutput output = new TerminalOutput(noBuffering, parameters.rollingWindowSize(), logFile)) {
try (TerminalOutput output = new TerminalOutput(
noBuffering, parameters.hideBannedProjectSkips(), parameters.rollingWindowSize(), logFile)) {
try {
// Color
// We need to defer this part until the terminal is created
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,10 @@ public boolean noBuffering() {
return property(Environment.MVND_NO_BUFERING).orFail().asBoolean();
}

public boolean hideBannedProjectSkips() {
return property(Environment.MVND_HIDE_BANNED_PROJECT_SKIPS).orFail().asBoolean();
}

public int rollingWindowSize() {
return property(Environment.MVND_ROLLING_WINDOW_SIZE).orFail().asInt();
}
Expand Down
15 changes: 15 additions & 0 deletions common/src/main/java/org/mvndaemon/mvnd/common/Environment.java
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,21 @@ public enum Environment {
*/
MVND_NO_MODEL_CACHE("mvnd.noModelCache", null, Boolean.FALSE, OptionType.BOOLEAN, Flags.OPTIONAL),

/**
* If <code>true</code> (default), mvnd shows live per-test progress on each project's worker line while
* Surefire/Failsafe run tests. Set to <code>false</code> to disable the feature entirely (nothing is injected
* into the surefire/failsafe configuration and no listener is registered).
*/
MVND_TEST_PROGRESS("mvnd.testProgress", null, Boolean.TRUE, OptionType.BOOLEAN, Flags.OPTIONAL),

/**
* If <code>true</code> (default), the client omits the per-project
* <code>Skipping X / This project has been banned from the build due to previous failures.</code> blocks that
* Maven logs after a reactor failure. Set to <code>false</code> to show them. The final reactor summary (including
* its <code>... SKIPPED</code> rows) is always kept.
*/
MVND_HIDE_BANNED_PROJECT_SKIPS("mvnd.hideBannedProjectSkips", null, Boolean.TRUE, OptionType.BOOLEAN, Flags.NONE),

/**
* If <code>true</code>, the daemon will be launched in debug mode with the following JVM argument:
* <code>-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8000</code>; otherwise the debug argument is
Expand Down
172 changes: 163 additions & 9 deletions common/src/main/java/org/mvndaemon/mvnd/common/Message.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.io.StringWriter;
import java.io.UTFDataFormatException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.LinkedHashMap;
import java.util.List;
Expand Down Expand Up @@ -66,9 +67,9 @@ public abstract class Message {
public static final int REQUEST_INPUT = 27;
public static final int INPUT_DATA = 28;
/**
* Live per-test progress for a project's line while surefire/failsafe run.
* TODO: the daemon-side feed that emits this message is not implemented on mvnd-1.x yet; until it
* lands in a follow-up commit, the client render stays dormant (no test-progress suffix is shown).
* Live per-test progress for a project's line while surefire/failsafe run. Emitted by the forked test JVM's
* listener bridge, relayed through the daemon, and rendered by the client as a test-progress suffix on the
* project's status line.
*/
public static final int PROJECT_TEST_PROGRESS = 29;

Expand Down Expand Up @@ -627,46 +628,87 @@ public void write(DataOutputStream output) throws IOException {

public static class ProjectTestProgressEvent extends Message {
final String projectId;
final int forkChannelId;
final String testClass;
final String testMethod;
final int completed;
final int failures;
final int errors;
final int skipped;
final int retrying;
final int flaky;
final List<String> flakyTests;
final List<String> failedTests;
final List<String> erroredTests;

public static ProjectTestProgressEvent read(DataInputStream input) throws IOException {
final String projectId = readUTF(input);
final int forkChannelId = input.readInt();
final String testClass = readUTF(input);
final String testMethod = readUTF(input);
final int completed = input.readInt();
final int failures = input.readInt();
final int errors = input.readInt();
final int skipped = input.readInt();
return new ProjectTestProgressEvent(projectId, testClass, testMethod, completed, failures, errors, skipped);
final int retrying = input.readInt();
final int flaky = input.readInt();
final List<String> flakyTests = readStringList(input);
final List<String> failedTests = readStringList(input);
final List<String> erroredTests = readStringList(input);
return new ProjectTestProgressEvent(
projectId,
forkChannelId,
testClass,
testMethod,
completed,
failures,
errors,
skipped,
retrying,
flaky,
flakyTests,
failedTests,
erroredTests);
}

public ProjectTestProgressEvent(
String projectId,
int forkChannelId,
String testClass,
String testMethod,
int completed,
int failures,
int errors,
int skipped) {
int skipped,
int retrying,
int flaky,
List<String> flakyTests,
List<String> failedTests,
List<String> erroredTests) {
super(PROJECT_TEST_PROGRESS);
this.projectId = Objects.requireNonNull(projectId, "projectId cannot be null");
this.forkChannelId = forkChannelId;
this.testClass = testClass;
this.testMethod = testMethod;
this.completed = completed;
this.failures = failures;
this.errors = errors;
this.skipped = skipped;
this.retrying = retrying;
this.flaky = flaky;
this.flakyTests = flakyTests == null ? new ArrayList<>() : new ArrayList<>(flakyTests);
this.failedTests = failedTests == null ? new ArrayList<>() : new ArrayList<>(failedTests);
this.erroredTests = erroredTests == null ? new ArrayList<>() : new ArrayList<>(erroredTests);
}

public String getProjectId() {
return projectId;
}

public int getForkChannelId() {
return forkChannelId;
}

public String getTestClass() {
return testClass;
}
Expand All @@ -691,26 +733,109 @@ public int getSkipped() {
return skipped;
}

public int getRetrying() {
return retrying;
}

public int getFlaky() {
return flaky;
}

public List<String> getFlakyTests() {
return Collections.unmodifiableList(flakyTests);
}

public List<String> getFailedTests() {
return Collections.unmodifiableList(failedTests);
}

public List<String> getErroredTests() {
return Collections.unmodifiableList(erroredTests);
}

@Override
public void write(DataOutputStream output) throws IOException {
super.write(output);
writeUTF(output, projectId);
output.writeInt(forkChannelId);
writeUTF(output, testClass);
writeUTF(output, testMethod);
output.writeInt(completed);
output.writeInt(failures);
output.writeInt(errors);
output.writeInt(skipped);
output.writeInt(retrying);
output.writeInt(flaky);
writeStringList(output, flakyTests);
writeStringList(output, failedTests);
writeStringList(output, erroredTests);
}

@Override
public String toString() {
return "ProjectTestProgress{projectId='" + projectId + "', testClass='" + testClass + "', testMethod='"
+ testMethod + "', completed=" + completed + ", failures=" + failures + ", errors=" + errors
+ ", skipped=" + skipped + "}";
return "ProjectTestProgress{projectId='" + projectId + "', forkChannelId=" + forkChannelId
+ ", testClass='" + testClass + "', testMethod='" + testMethod + "', completed=" + completed
+ ", failures=" + failures + ", errors=" + errors + ", skipped=" + skipped
+ ", retrying=" + retrying + ", flaky=" + flaky + ", flakyTests=" + flakyTests
+ ", failedTests=" + failedTests + ", erroredTests=" + erroredTests + "}";
}
}

public static ProjectTestProgressEvent projectTestProgress(
String projectId,
int forkChannelId,
String testClass,
String testMethod,
int completed,
int failures,
int errors,
int skipped) {
return projectTestProgress(
projectId,
forkChannelId,
testClass,
testMethod,
completed,
failures,
errors,
skipped,
0,
0,
null,
null,
null);
}

public static ProjectTestProgressEvent projectTestProgress(
String projectId,
int forkChannelId,
String testClass,
String testMethod,
int completed,
int failures,
int errors,
int skipped,
int retrying,
int flaky,
List<String> flakyTests,
List<String> failedTests,
List<String> erroredTests) {
return new ProjectTestProgressEvent(
projectId,
forkChannelId,
testClass,
testMethod,
completed,
failures,
errors,
skipped,
retrying,
flaky,
flakyTests,
failedTests,
erroredTests);
}

public static ProjectTestProgressEvent projectTestProgress(
String projectId,
String testClass,
Expand All @@ -719,7 +844,36 @@ public static ProjectTestProgressEvent projectTestProgress(
int failures,
int errors,
int skipped) {
return new ProjectTestProgressEvent(projectId, testClass, testMethod, completed, failures, errors, skipped);
return projectTestProgress(projectId, -1, testClass, testMethod, completed, failures, errors, skipped);
}

public static ProjectTestProgressEvent projectTestProgress(
String projectId,
String testClass,
String testMethod,
int completed,
int failures,
int errors,
int skipped,
int retrying,
int flaky,
List<String> flakyTests,
List<String> failedTests,
List<String> erroredTests) {
return projectTestProgress(
projectId,
-1,
testClass,
testMethod,
completed,
failures,
errors,
skipped,
retrying,
flaky,
flakyTests,
failedTests,
erroredTests);
}

public static class BuildStarted extends Message {
Expand Down
Loading
Loading