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

David Holmes dholmes at openjdk.org
Tue Jan 31 04:37:57 UTC 2023


On Tue, 31 Jan 2023 01:13:48 GMT, Mikhailo Seledtsov <mseledtsov at openjdk.org> wrote:

>> 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.

Granted creating the file is much simpler than capturing the child process output directly, but can we not read the file back in and then include it in the main log? I'm assuming the output of container-ps is going to be quite small. We could also choose to include it only if there appears to have been an error.
Though we could always expand on this later if the current simple approach doesn't suffice.

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

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


More information about the hotspot-dev mailing list