From: qmuntal Date: Mon, 31 Jul 2023 14:56:01 +0000 (+0200) Subject: cmd/cgo/internal/testerrors: unskip TestPointerChecks on Windows X-Git-Tag: go1.22rc1~1428 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=d50272a8c17920d0eac2d765194d4cd0355a1d34;p=gostls13.git cmd/cgo/internal/testerrors: unskip TestPointerChecks on Windows All TestPointerChecks cases can be executed on Windows with some minor tweaks. It seems that the skip has been cargo-culted from when cgo error tests were first added in https://codereview.appspot.com/13498046. Change-Id: I39cd05f4c90965b669d2b403f7fcd9dd9c69016c Reviewed-on: https://go-review.googlesource.com/c/go/+/514296 Reviewed-by: David Chase Reviewed-by: Ian Lance Taylor Run-TryBot: Quim Muntal TryBot-Result: Gopher Robot --- diff --git a/src/cmd/cgo/internal/testerrors/ptr_test.go b/src/cmd/cgo/internal/testerrors/ptr_test.go index 7f56501c58..8fff7615d3 100644 --- a/src/cmd/cgo/internal/testerrors/ptr_test.go +++ b/src/cmd/cgo/internal/testerrors/ptr_test.go @@ -14,7 +14,6 @@ import ( "os" "os/exec" "path/filepath" - "runtime" "slices" "strings" "sync/atomic" @@ -253,7 +252,10 @@ var ptrTests = []ptrTest{ { // Exported functions may not return Go pointers. name: "export1", - c: `extern unsigned char *GoFn21();`, + c: `#ifdef _WIN32 + __declspec(dllexport) + #endif + extern unsigned char *GoFn21();`, support: `//export GoFn21 func GoFn21() *byte { return new(byte) }`, body: `C.GoFn21()`, @@ -263,6 +265,9 @@ var ptrTests = []ptrTest{ // Returning a C pointer is fine. name: "exportok", c: `#include + #ifdef _WIN32 + __declspec(dllexport) + #endif extern unsigned char *GoFn22();`, support: `//export GoFn22 func GoFn22() *byte { return (*byte)(C.malloc(1)) }`, @@ -472,10 +477,6 @@ var ptrTests = []ptrTest{ func TestPointerChecks(t *testing.T) { testenv.MustHaveGoBuild(t) testenv.MustHaveCGO(t) - if runtime.GOOS == "windows" { - // TODO: Skip just the cases that fail? - t.Skipf("some tests fail to build on %s", runtime.GOOS) - } var gopath string var dir string