diff options
| author | qmuntal <quimmuntal@gmail.com> | 2022-10-20 19:06:05 +0200 |
|---|---|---|
| committer | David Chase <drchase@google.com> | 2022-10-20 18:45:28 +0000 |
| commit | 160bb0e66b96e24120deba5fed927acc47b59b1a (patch) | |
| tree | 6b8c72858b786919f3a6c718bc48d259a68f0da8 /src/runtime/testdata/testwinlibthrow | |
| parent | 72c58fb77192f7d17d87663c943360a48aae11dc (diff) | |
| download | go-160bb0e66b96e24120deba5fed927acc47b59b1a.tar.xz | |
runtime: fix TestVectoredHandlerExceptionInNonGoThread
This test is failing on the windows-arm64-10 builder
https://build.golang.org/log/c161c86be1af83c349ee02c1b12eff5828818f50.
It is not failing on windows-arm64-11, so I guess it has something to
do with the compiler.
This CL simplifies the test so is easier to build.
Change-Id: I6e0e1cf237277628f8ebf892c70ab54cd0077680
Reviewed-on: https://go-review.googlesource.com/c/go/+/444438
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Run-TryBot: Quim Muntal <quimmuntal@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Diffstat (limited to 'src/runtime/testdata/testwinlibthrow')
| -rw-r--r-- | src/runtime/testdata/testwinlibthrow/main.go | 4 | ||||
| -rw-r--r-- | src/runtime/testdata/testwinlibthrow/veh.c | 26 | ||||
| -rw-r--r-- | src/runtime/testdata/testwinlibthrow/veh.cpp | 53 |
3 files changed, 26 insertions, 57 deletions
diff --git a/src/runtime/testdata/testwinlibthrow/main.go b/src/runtime/testdata/testwinlibthrow/main.go index 50c483f401..ce0c92f252 100644 --- a/src/runtime/testdata/testwinlibthrow/main.go +++ b/src/runtime/testdata/testwinlibthrow/main.go @@ -7,17 +7,13 @@ import ( func main() {
dll := syscall.MustLoadDLL("veh.dll")
- RaiseExcept := dll.MustFindProc("RaiseExcept")
RaiseNoExcept := dll.MustFindProc("RaiseNoExcept")
- ThreadRaiseExcept := dll.MustFindProc("ThreadRaiseExcept")
ThreadRaiseNoExcept := dll.MustFindProc("ThreadRaiseNoExcept")
thread := len(os.Args) > 1 && os.Args[1] == "thread"
if !thread {
- RaiseExcept.Call()
RaiseNoExcept.Call()
} else {
- ThreadRaiseExcept.Call()
ThreadRaiseNoExcept.Call()
}
}
diff --git a/src/runtime/testdata/testwinlibthrow/veh.c b/src/runtime/testdata/testwinlibthrow/veh.c new file mode 100644 index 0000000000..08c1f9edf0 --- /dev/null +++ b/src/runtime/testdata/testwinlibthrow/veh.c @@ -0,0 +1,26 @@ +//go:build ignore
+
+#include <windows.h>
+
+__declspec(dllexport)
+void RaiseNoExcept(void)
+{
+ RaiseException(42, 0, 0, 0);
+}
+
+static DWORD WINAPI ThreadRaiser(void* Context)
+{
+ RaiseNoExcept();
+ return 0;
+}
+
+__declspec(dllexport)
+void ThreadRaiseNoExcept(void)
+{
+ HANDLE thread = CreateThread(0, 0, ThreadRaiser, 0, 0, 0);
+ if (0 != thread)
+ {
+ WaitForSingleObject(thread, INFINITE);
+ CloseHandle(thread);
+ }
+}
diff --git a/src/runtime/testdata/testwinlibthrow/veh.cpp b/src/runtime/testdata/testwinlibthrow/veh.cpp deleted file mode 100644 index ed7015a064..0000000000 --- a/src/runtime/testdata/testwinlibthrow/veh.cpp +++ /dev/null @@ -1,53 +0,0 @@ -//go:build ignore
-
-#include <windows.h>
-
-extern "C" __declspec(dllexport)
-void RaiseExcept(void)
-{
- try
- {
- RaiseException(42, 0, 0, 0);
- }
- catch (...)
- {
- }
-}
-
-extern "C" __declspec(dllexport)
-void RaiseNoExcept(void)
-{
- RaiseException(42, 0, 0, 0);
-}
-
-static DWORD WINAPI ThreadRaiser(void* Context)
-{
- if (Context)
- RaiseExcept();
- else
- RaiseNoExcept();
- return 0;
-}
-
-static void ThreadRaiseXxx(int except)
-{
- static int dummy;
- HANDLE thread = CreateThread(0, 0, ThreadRaiser, except ? &dummy : 0, 0, 0);
- if (0 != thread)
- {
- WaitForSingleObject(thread, INFINITE);
- CloseHandle(thread);
- }
-}
-
-extern "C" __declspec(dllexport)
-void ThreadRaiseExcept(void)
-{
- ThreadRaiseXxx(1);
-}
-
-extern "C" __declspec(dllexport)
-void ThreadRaiseNoExcept(void)
-{
- ThreadRaiseXxx(0);
-}
|
