]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: fix TestVectoredHandlerExceptionInNonGoThread
authorqmuntal <quimmuntal@gmail.com>
Thu, 20 Oct 2022 17:06:05 +0000 (19:06 +0200)
committerDavid Chase <drchase@google.com>
Thu, 20 Oct 2022 18:45:28 +0000 (18:45 +0000)
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>
src/runtime/signal_windows_test.go
src/runtime/testdata/testwinlibthrow/main.go
src/runtime/testdata/testwinlibthrow/veh.c [new file with mode: 0644]
src/runtime/testdata/testwinlibthrow/veh.cpp [deleted file]

index fe74ad56bf99beeff6793636bd342df94e821476..02497e6fae24310c736f4ca866ce5bd18973627c 100644 (file)
@@ -23,14 +23,14 @@ func TestVectoredHandlerExceptionInNonGoThread(t *testing.T) {
        }
        testenv.MustHaveGoBuild(t)
        testenv.MustHaveCGO(t)
-       testenv.MustHaveExecPath(t, "g++")
+       testenv.MustHaveExecPath(t, "gcc")
        testprog.Lock()
        defer testprog.Unlock()
        dir := t.TempDir()
 
        // build c program
        dll := filepath.Join(dir, "veh.dll")
-       cmd := exec.Command("g++", "-shared", "-o", dll, "testdata/testwinlibthrow/veh.cpp", "-static", "-lstdc++")
+       cmd := exec.Command("gcc", "-shared", "-o", dll, "testdata/testwinlibthrow/veh.c")
        out, err := testenv.CleanCmdEnv(cmd).CombinedOutput()
        if err != nil {
                t.Fatalf("failed to build c exe: %s\n%s", err, out)
index 50c483f401edb3e0b1880c52996eb4d46e21e813..ce0c92f252ffefa49e58a0ca9008773bfcada341 100644 (file)
@@ -7,17 +7,13 @@ import (
 \r
 func main() {\r
        dll := syscall.MustLoadDLL("veh.dll")\r
-       RaiseExcept := dll.MustFindProc("RaiseExcept")\r
        RaiseNoExcept := dll.MustFindProc("RaiseNoExcept")\r
-       ThreadRaiseExcept := dll.MustFindProc("ThreadRaiseExcept")\r
        ThreadRaiseNoExcept := dll.MustFindProc("ThreadRaiseNoExcept")\r
 \r
        thread := len(os.Args) > 1 && os.Args[1] == "thread"\r
        if !thread {\r
-               RaiseExcept.Call()\r
                RaiseNoExcept.Call()\r
        } else {\r
-               ThreadRaiseExcept.Call()\r
                ThreadRaiseNoExcept.Call()\r
        }\r
 }\r
diff --git a/src/runtime/testdata/testwinlibthrow/veh.c b/src/runtime/testdata/testwinlibthrow/veh.c
new file mode 100644 (file)
index 0000000..08c1f9e
--- /dev/null
@@ -0,0 +1,26 @@
+//go:build ignore\r
+\r
+#include <windows.h>\r
+\r
+__declspec(dllexport)\r
+void RaiseNoExcept(void)\r
+{\r
+    RaiseException(42, 0, 0, 0);\r
+}\r
+\r
+static DWORD WINAPI ThreadRaiser(void* Context)\r
+{\r
+    RaiseNoExcept();\r
+    return 0;\r
+}\r
+\r
+__declspec(dllexport)\r
+void ThreadRaiseNoExcept(void)\r
+{\r
+    HANDLE thread = CreateThread(0, 0, ThreadRaiser,  0, 0, 0);\r
+    if (0 != thread)\r
+    {\r
+        WaitForSingleObject(thread, INFINITE);\r
+        CloseHandle(thread);\r
+    }\r
+}\r
diff --git a/src/runtime/testdata/testwinlibthrow/veh.cpp b/src/runtime/testdata/testwinlibthrow/veh.cpp
deleted file mode 100644 (file)
index ed7015a..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-//go:build ignore\r
-\r
-#include <windows.h>\r
-\r
-extern "C" __declspec(dllexport)\r
-void RaiseExcept(void)\r
-{\r
-    try\r
-    {\r
-        RaiseException(42, 0, 0, 0);\r
-    }\r
-    catch (...)\r
-    {\r
-    }\r
-}\r
-\r
-extern "C" __declspec(dllexport)\r
-void RaiseNoExcept(void)\r
-{\r
-    RaiseException(42, 0, 0, 0);\r
-}\r
-\r
-static DWORD WINAPI ThreadRaiser(void* Context)\r
-{\r
-    if (Context)\r
-        RaiseExcept();\r
-    else\r
-        RaiseNoExcept();\r
-    return 0;\r
-}\r
-\r
-static void ThreadRaiseXxx(int except)\r
-{\r
-    static int dummy;\r
-    HANDLE thread = CreateThread(0, 0, ThreadRaiser, except ? &dummy : 0, 0, 0);\r
-    if (0 != thread)\r
-    {\r
-        WaitForSingleObject(thread, INFINITE);\r
-        CloseHandle(thread);\r
-    }\r
-}\r
-\r
-extern "C" __declspec(dllexport)\r
-void ThreadRaiseExcept(void)\r
-{\r
-    ThreadRaiseXxx(1);\r
-}\r
-\r
-extern "C" __declspec(dllexport)\r
-void ThreadRaiseNoExcept(void)\r
-{\r
-    ThreadRaiseXxx(0);\r
-}\r