RFR: 8294402: Add diagnostic logging to VMProps.checkDockerSupport [v2]

Mikhailo Seledtsov mseledtsov at openjdk.org
Tue Jan 31 01:16:59 UTC 2023


On Tue, 31 Jan 2023 00:08:20 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> Mikhailo Seledtsov has updated the pull request incrementally with two additional commits since the last revision:
>> 
>>  - Comment about logging to stdout
>>  - Conditionally enable VMProps logging
>
> test/jtreg-ext/requires/VMProps.java line 531:
> 
>> 529:         log("checkDockerSupport(): entering");
>> 530:         ProcessBuilder pb = new ProcessBuilder(Container.ENGINE_COMMAND, "ps");
>> 531:         redirectOutputToLogFile("checkDockerSupport(): <container> ps", pb, "container-ps");
> 
> I was thinking it would be better to see this output in the main log, rather than have to go and find the file later. Where would the file even be found?

Files containing redirected stdout and stderr will be in the jtreg working directory, usually JTwork/scratch/.
I tried to keep the code as simple as possible, and found that redirecting the output of a child process to a file is the simplest option. Capturing child process output might involve quite a bit of code, pumping/draining the output to a buffer then printing the buffer out to the main logging method. E.g. see OutputAnalyzer.

Also note that we can not simply use test utils library such as output analyzer. Every depended non-core library has to be declared in TEST.ROOT as:
requires.extraPropDefns.libs = \
    ../../lib/jdk/test/lib/Platform.java \
    ../../lib/jdk/test/lib/Container.java

I tried to add OutputAnalyzer here, but it does require lot's of dependencies and the list grew large.

Let me know if I should do this anyway even if it adds more code to vmprops.

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

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


More information about the hotspot-dev mailing list