Skip to content

Commit

Permalink
runtime: fix TestVectoredHandlerExceptionInNonGoThread
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
qmuntal authored and dr2chase committed Oct 20, 2022
1 parent 72c58fb commit 160bb0e
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 59 deletions.
4 changes: 2 additions & 2 deletions src/runtime/signal_windows_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 0 additions & 4 deletions src/runtime/testdata/testwinlibthrow/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}
26 changes: 26 additions & 0 deletions src/runtime/testdata/testwinlibthrow/veh.c
Original file line number Diff line number Diff line change
@@ -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);
}
}
53 changes: 0 additions & 53 deletions src/runtime/testdata/testwinlibthrow/veh.cpp

This file was deleted.

0 comments on commit 160bb0e

Please sign in to comment.