Skip to content

Commit 66b1b74

Browse files
qmuntalpull[bot]
authored andcommitted
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 <[email protected]> Reviewed-by: Michael Pratt <[email protected]> Run-TryBot: Quim Muntal <[email protected]> Reviewed-by: Bryan Mills <[email protected]>
1 parent 509ef20 commit 66b1b74

File tree

4 files changed

+28
-59
lines changed

4 files changed

+28
-59
lines changed

src/runtime/signal_windows_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ func TestVectoredHandlerExceptionInNonGoThread(t *testing.T) {
2323
}
2424
testenv.MustHaveGoBuild(t)
2525
testenv.MustHaveCGO(t)
26-
testenv.MustHaveExecPath(t, "g++")
26+
testenv.MustHaveExecPath(t, "gcc")
2727
testprog.Lock()
2828
defer testprog.Unlock()
2929
dir := t.TempDir()
3030

3131
// build c program
3232
dll := filepath.Join(dir, "veh.dll")
33-
cmd := exec.Command("g++", "-shared", "-o", dll, "testdata/testwinlibthrow/veh.cpp", "-static", "-lstdc++")
33+
cmd := exec.Command("gcc", "-shared", "-o", dll, "testdata/testwinlibthrow/veh.c")
3434
out, err := testenv.CleanCmdEnv(cmd).CombinedOutput()
3535
if err != nil {
3636
t.Fatalf("failed to build c exe: %s\n%s", err, out)

src/runtime/testdata/testwinlibthrow/main.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,13 @@ import (
77

88
func main() {
99
dll := syscall.MustLoadDLL("veh.dll")
10-
RaiseExcept := dll.MustFindProc("RaiseExcept")
1110
RaiseNoExcept := dll.MustFindProc("RaiseNoExcept")
12-
ThreadRaiseExcept := dll.MustFindProc("ThreadRaiseExcept")
1311
ThreadRaiseNoExcept := dll.MustFindProc("ThreadRaiseNoExcept")
1412

1513
thread := len(os.Args) > 1 && os.Args[1] == "thread"
1614
if !thread {
17-
RaiseExcept.Call()
1815
RaiseNoExcept.Call()
1916
} else {
20-
ThreadRaiseExcept.Call()
2117
ThreadRaiseNoExcept.Call()
2218
}
2319
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
//go:build ignore
2+
3+
#include <windows.h>
4+
5+
__declspec(dllexport)
6+
void RaiseNoExcept(void)
7+
{
8+
RaiseException(42, 0, 0, 0);
9+
}
10+
11+
static DWORD WINAPI ThreadRaiser(void* Context)
12+
{
13+
RaiseNoExcept();
14+
return 0;
15+
}
16+
17+
__declspec(dllexport)
18+
void ThreadRaiseNoExcept(void)
19+
{
20+
HANDLE thread = CreateThread(0, 0, ThreadRaiser, 0, 0, 0);
21+
if (0 != thread)
22+
{
23+
WaitForSingleObject(thread, INFINITE);
24+
CloseHandle(thread);
25+
}
26+
}

src/runtime/testdata/testwinlibthrow/veh.cpp

Lines changed: 0 additions & 53 deletions
This file was deleted.

0 commit comments

Comments
 (0)