RFR: 8364664: gtest death tests failing on Windows

Saint Wesonga duke at openjdk.org
Wed Aug 6 19:34:36 UTC 2025


https://github.com/openjdk/jdk/commit/0054bbed7fce5b8566655d6910b09b10c952e609 (from https://bugs.openjdk.org/browse/JDK-8343756) caused the gtest death tests to fail on Windows with the error message "Caught std::exception-derived exception escaping the death test statement. Exception message: unknown file: error: SEH exception with code 0xc0000005 thrown in the test body." The error message is from the catch block in https://github.com/google/googletest/blob/v1.14.0/googletest/include/gtest/internal/gtest-death-test-internal.h#L198-L212

In the failing death tests, the gtests start another process and expect the child process to be terminated by JVM error handling code. However, the structured exception handling code in the googletest code ends up getting executed instead. The death tests expect execution to continue after the instruction that triggered the exception by writing to the poissoned page. This change proposes build Windows gtests without structured exception handling to avoid changing the flow of exceptions in OpenJDK test code. The effect of this change is to stop using the  [SEH path in the HandleSehExceptionsInMethodIfSupported method](https://github.com/google/googletest/blob/v1.14.0/googletest/src/gtest.cc#L2603) and [directly start the test](https://github.com/google/googletest/blob/v1.14.0/googletest/src/gtest.cc#L2612).

All the Windows gtests now pass with this change.

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

Commit messages:
 - Disable structured exception handling in gtests on Windows

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

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


More information about the build-dev mailing list