RFR: 8297302: gtest/AsyncLogGtest.java fails AsyncLogTest.stdoutOutput_vm

Xin Liu xliu at openjdk.org
Wed Apr 19 06:40:49 UTC 2023


This patch tries to resolve the intermittent failures. gtest uses mktemp and dup/dup2 to implement CapturedStream.
The mechanism may fail in temp file or the current process happens to run out of file descriptor. It's possible that
GetCapturedStream() returns an empty string and it confuses write_to_file().

This patch strengthens write_to_file() in the following 2 ways. The test skips content check if write_to_file()
returtn false. 
1. at least see a non-empty string from stdout/stderr. we write a string "header" to stdout/stderr.
2. flush all streams before calling GetCapturedStream()

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

Commit messages:
 - 8297302: gtest/AsyncLogGtest.java fails AsyncLogTest.stdoutOutput_vm

Changes: https://git.openjdk.org/jdk/pull/13524/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=13524&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8297302
  Stats: 24 lines in 1 file changed: 8 ins; 2 del; 14 mod
  Patch: https://git.openjdk.org/jdk/pull/13524.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/13524/head:pull/13524

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


More information about the hotspot-runtime-dev mailing list