]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/cgo/internal/testerrors: unskip TestPointerChecks on Windows
authorqmuntal <quimmuntal@gmail.com>
Mon, 31 Jul 2023 14:56:01 +0000 (16:56 +0200)
committerQuim Muntal <quimmuntal@gmail.com>
Thu, 3 Aug 2023 16:07:49 +0000 (16:07 +0000)
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 <drchase@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Quim Muntal <quimmuntal@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

src/cmd/cgo/internal/testerrors/ptr_test.go

index 7f56501c589ca471774be264b55d48d41dbe02ca..8fff7615d3560c78e0d8ec7ed7c75ccb6f68c6b8 100644 (file)
@@ -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 <stdlib.h>
+                   #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