aboutsummaryrefslogtreecommitdiff
path: root/misc/cgo/errors/testdata/malloc.go
diff options
context:
space:
mode:
authorAustin Clements <austin@google.com>2023-05-04 12:13:27 -0400
committerAustin Clements <austin@google.com>2023-05-12 11:59:56 +0000
commitbf6c55a8b313752667b51194485fa206110d71f9 (patch)
tree8dd81bdb6e48bc77d7923ba985a91b6b7daa341e /misc/cgo/errors/testdata/malloc.go
parenta25688d406f2a4296d39b22a2b10aea7178eddc6 (diff)
downloadgo-bf6c55a8b313752667b51194485fa206110d71f9.tar.xz
misc/cgo: move easy tests to cmd/cgo/internal
This moves most misc/cgo tests to cmd/cgo/internal. This is mostly a trivial rename and updating dist/test.go for the new paths, plus excluding these packages from regular dist test registration. A few tests were sensitive to what path they ran in, so we update those. This will let these tests access facilities in internal/testenv. For #37486. Change-Id: I3ed417c7c22d9b667f2767c0cb1f59118fcd4af6 Reviewed-on: https://go-review.googlesource.com/c/go/+/492720 Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'misc/cgo/errors/testdata/malloc.go')
-rw-r--r--misc/cgo/errors/testdata/malloc.go34
1 files changed, 0 insertions, 34 deletions
diff --git a/misc/cgo/errors/testdata/malloc.go b/misc/cgo/errors/testdata/malloc.go
deleted file mode 100644
index 65da0208b9..0000000000
--- a/misc/cgo/errors/testdata/malloc.go
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Test that C.malloc does not return nil.
-
-package main
-
-// #include <stdlib.h>
-import "C"
-
-import (
- "fmt"
- "runtime"
-)
-
-func main() {
- var size C.size_t
- size--
-
- // The Dragonfly libc succeeds when asked to allocate
- // 0xffffffffffffffff bytes, so pass a different value that
- // causes it to fail.
- if runtime.GOOS == "dragonfly" {
- size = C.size_t(0x7fffffff << (32 * (^uintptr(0) >> 63)))
- }
-
- p := C.malloc(size)
- if p == nil {
- fmt.Println("malloc: C.malloc returned nil")
- // Just exit normally--the test script expects this
- // program to crash, so exiting normally indicates failure.
- }
-}