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>
}
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)
\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
--- /dev/null
+//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
+++ /dev/null
-//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