RFR: 8303133: Update ProcessTools.startProcess(...) to exit early if process exit before linePredicate is printed.

Roger Riggs rriggs at openjdk.org
Fri Feb 24 22:45:05 UTC 2023


On Fri, 24 Feb 2023 22:15:18 GMT, Leonid Mesnik <lmesnik at openjdk.org> wrote:

> The solution proposed by Stefan K
> 
> The startProcess() might wait forever for the expected line if the process exits (failed to start). It makes sense to just fail earlier in such cases.
> 
> The fix also move
> 'output = new OutputAnalyzer(this.process);'
> in method xrun() to be able to try to print them in waitFor is failed/interrupted.

test/lib/jdk/test/lib/process/ProcessTools.java line 224:

> 222:                             //Fail if process finished before printed expected string
> 223:                             latch.countDown();
> 224:                             throw new RuntimeException("Started process is not alive.");

Please add the name to the exception; it will be easier to determine what failed.

test/lib/jdk/test/lib/process/ProcessTools.java line 228:

> 226:                     }
> 227:                 } else {
> 228:                     if (!latch.await(Utils.adjustTimeout(timeout), unit)) {

Checking for liveness in both timeout ==0 and > 0 would be useful.

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

PR: https://git.openjdk.org/jdk/pull/12751


More information about the core-libs-dev mailing list