On Thu, 11 Sep 2025 22:09:10 GMT, Andy Goryachev <[email protected]> wrote:
> This PR removes unrelated `stderr` output in the headless test logs by > redirecting it to an in-memory buffer. Exceptions found in the buffer can be > checked against the expected list. > > In the case when any mismatch is detected, whether the type or the number of > exceptions of particular type, the accumulated buffer gets dumped to `stderr` > and the test fails. > > ## How To > > To redirect stderr and later check the exceptions, surround your code with > > `OutputRedirect.suppressStderr()` and either `OutputRedirect.checkStderr()` > or `OutputRedirect.checkAndRestoreStderr()` (ideally, in the `finally` block). > > To simply undo redirection, without checking, call > `OutputRedirect.restoreStderr()`. > > To add the check to all the tests in the file, one can call the above > mentioned methods inside `@BeforeEach` and `@AfterEach`. > > ## Changes > > - added `OutputRedirect` facility > > ## Miscellaneous > > `ErrorLoggingUtiltity` name will be fixed in a followup > https://bugs.openjdk.org/browse/JDK-8367995 This pull request has now been integrated. Changeset: f4b3d552 Author: Andy Goryachev <[email protected]> URL: https://git.openjdk.org/jfx/commit/f4b3d55200d519c89f34f0c30f15e1da0323efc0 Stats: 494 lines in 18 files changed: 433 ins; 19 del; 42 mod 8336332: Rework tests to avoid unrelated stderr output Reviewed-by: kcr, arapte ------------- PR: https://git.openjdk.org/jfx/pull/1897
