On Fri, 13 Mar 2026 12:46:13 GMT, Frederic Thevenet <[email protected]> 
wrote:

> When an `OutputAnalyzer` instance uses a `LazyOutputBuffer` impl to capture a 
> process' standard output, it unconditionally writes progress logs to stdout. 
> This can easily flood the output in tests that spawn a great number of 
> processes, each with an OutputAnalyzer attached, as part of their operations.
> 
> This change introduce an optional "quiet mode" which allows suppressing the 
> diagnostic messages emitted by the analyzer.
> 
> (Notes on implementation)
> * Introducing a "verbose mode" instead would likely have been more idiomatic, 
> but would have implied a lot of existing tests opting into this new mode to 
> retain their current printing behavior.
> * It is implemented as an extra parameter in new constructor overloads for 
> `OutputAnalyzer`, which really is the only way since `LazyOutputBuffer` 
> starts logging in its constructor.

I'd prefer the state be the usual `verbose` with a default of true.
That flows through all the changes and is more typical.
Existing callers would not change and new callers would supply verbose = false, 
to get the desired effect.

test/lib/jdk/test/lib/process/OutputAnalyzer.java line 59:

> 57:      */
> 58:     public OutputAnalyzer(Process process, Charset cs) throws IOException 
> {
> 59:       this(process, cs, false);

Java code uses 4 character indentation.  (2-spaces is hotspot).

test/lib/jdk/test/lib/process/OutputAnalyzer.java line 63:

> 61: 
> 62:     /**
> 63:      * Create an OutputAnalyzer, a utility class for verifying output and 
> exit

Mention the quiet mode argument in the 1-line comment. 
(And add a period (.) at the end of the sentence.

test/lib/jdk/test/lib/process/OutputAnalyzer.java line 84:

> 82:      */
> 83:     public OutputAnalyzer(Process process) throws IOException {
> 84:       this(process, false);

Ditto, 4 char indent.

test/lib/jdk/test/lib/process/OutputAnalyzer.java line 89:

> 87:     /**
> 88:      * Create an OutputAnalyzer, a utility class for verifying output and 
> exit
> 89:      * value from a Process

And mention the quiet mode here too.

test/lib/jdk/test/lib/process/OutputBuffer.java line 148:

> 146: 
> 147:     private final void logProgress(String state) {
> 148:       if (!quiet) {

4-space indent.

-------------

Changes requested by rriggs (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/30238#pullrequestreview-3944662800
PR Review Comment: https://git.openjdk.org/jdk/pull/30238#discussion_r2931766502
PR Review Comment: https://git.openjdk.org/jdk/pull/30238#discussion_r2931774224
PR Review Comment: https://git.openjdk.org/jdk/pull/30238#discussion_r2931777318
PR Review Comment: https://git.openjdk.org/jdk/pull/30238#discussion_r2931779090
PR Review Comment: https://git.openjdk.org/jdk/pull/30238#discussion_r2931787031

Reply via email to