# HG changeset patch # User stuefe # Date 1620706814 -7200 # Tue May 11 06:20:14 2021 +0200 # Node ID 3d8db5dc1f30af39888dab2d02a559a7b4979ce3 # Parent 5a0f3dc35a983a7aba07e90cfc4a067d8e28a579 [mq]: 8185734-Windows-Structured-Exception-Catcher-missing-around-gtest-execution.diff diff -r 5a0f3dc35a98 -r 3d8db5dc1f30 make/RunTests.gmk --- a/make/RunTests.gmk Tue May 11 06:00:32 2021 +0200 +++ b/make/RunTests.gmk Tue May 11 06:20:14 2021 +0200 @@ -532,6 +532,7 @@ $$(FIXPATH) $$(TEST_IMAGE_DIR)/hotspot/gtest/$$($1_VARIANT)/gtestLauncher \ -jdk $(JDK_IMAGE_DIR) $$($1_GTEST_FILTER) \ --gtest_output=xml:$$($1_TEST_RESULTS_DIR)/gtest.xml \ + --gtest_catch_exceptions=0 \ $$($1_GTEST_REPEAT) $$(GTEST_OPTIONS) $$(GTEST_VM_OPTIONS) \ $$(GTEST_JAVA_OPTIONS) $$($1_AOT_OPTIONS) \ > >($(TEE) $$($1_TEST_RESULTS_DIR)/gtest.txt) \ diff -r 5a0f3dc35a98 -r 3d8db5dc1f30 src/hotspot/os/windows/os_windows.cpp --- a/src/hotspot/os/windows/os_windows.cpp Tue May 11 06:00:32 2021 +0200 +++ b/src/hotspot/os/windows/os_windows.cpp Tue May 11 06:20:14 2021 +0200 @@ -417,6 +417,7 @@ return NULL; } +JNIEXPORT LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo); // Thread start routine for all newly created threads @@ -2355,6 +2356,7 @@ } //----------------------------------------------------------------------------- +JNIEXPORT LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo) { if (InterceptOSException) return EXCEPTION_CONTINUE_SEARCH; DWORD exception_code = exceptionInfo->ExceptionRecord->ExceptionCode; diff -r 5a0f3dc35a98 -r 3d8db5dc1f30 src/hotspot/os_cpu/windows_x86/os_windows_x86.cpp --- a/src/hotspot/os_cpu/windows_x86/os_windows_x86.cpp Tue May 11 06:00:32 2021 +0200 +++ b/src/hotspot/os_cpu/windows_x86/os_windows_x86.cpp Tue May 11 06:20:14 2021 +0200 @@ -69,6 +69,7 @@ #define REG_PC Eip #endif // AMD64 +JNIEXPORT extern LONG WINAPI topLevelExceptionFilter(_EXCEPTION_POINTERS* ); // Install a win32 structured exception handler around thread. diff -r 5a0f3dc35a98 -r 3d8db5dc1f30 test/hotspot/gtest/gtestLauncher.cpp --- a/test/hotspot/gtest/gtestLauncher.cpp Tue May 11 06:00:32 2021 +0200 +++ b/test/hotspot/gtest/gtestLauncher.cpp Tue May 11 06:20:14 2021 +0200 @@ -23,11 +23,23 @@ #include "jni.h" +#ifdef _WIN32 +#include +#include +extern LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo); +#endif + extern "C" { JNIIMPORT void JNICALL runUnitTests(int argv, char** argc); } int main(int argc, char** argv) { +#ifdef _WIN32 + __try { +#endif runUnitTests(argc, argv); +#ifdef _WIN32 + } __except(topLevelExceptionFilter(GetExceptionInformation())) {} +#endif return 0; } diff -r 5a0f3dc35a98 -r 3d8db5dc1f30 test/hotspot/jtreg/gtest/GTestWrapper.java --- a/test/hotspot/jtreg/gtest/GTestWrapper.java Tue May 11 06:00:32 2021 +0200 +++ b/test/hotspot/jtreg/gtest/GTestWrapper.java Tue May 11 06:20:14 2021 +0200 @@ -82,7 +82,8 @@ pb.command(new String[] { execPath.toString(), "-jdk", - System.getProperty("test.jdk") + System.getProperty("test.jdk"), + "--gtest_catch_exceptions=0" }); ProcessTools.executeCommand(pb).shouldHaveExitValue(0); }