]> Cypherpunks repositories - gostls13.git/commitdiff
test: use cgo.Incomplete instead of go:notinheap for "run" tests
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Sun, 7 Aug 2022 17:14:43 +0000 (00:14 +0700)
committerCuong Manh Le <cuong.manhle.vn@gmail.com>
Thu, 1 Sep 2022 00:42:27 +0000 (00:42 +0000)
Same as CL 421880, but for test directory.

Updates #46731

Change-Id: If8d18df013a6833adcbd40acc1a721bbc23ca6b2
Reviewed-on: https://go-review.googlesource.com/c/go/+/421881
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

test/fixedbugs/bug514.go
test/fixedbugs/issue40954.go
test/fixedbugs/issue42032.go
test/fixedbugs/issue42076.go
test/fixedbugs/issue46903.go
test/fixedbugs/issue51733.go [moved from test/typeparam/issue51733.go with 89% similarity]

index 3fb7f32a3009cf662cae8c4c3b08bea83b978e67..9b2318533782588ed1cc9ea3b764615e2819c2b6 100644 (file)
@@ -4,14 +4,18 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build cgo
+
 package main
 
+import "runtime/cgo"
+
 type iface interface {
        Get() int
 }
 
-//go:notinheap
 type notInHeap struct {
+       _ cgo.Incomplete
        i int
 }
 
@@ -29,7 +33,7 @@ type embed struct {
 
 var val = 1234
 
-var valNotInHeap = notInHeap{val}
+var valNotInHeap = notInHeap{i: val}
 
 func main() {
        i := val
index 53e9ccf387e19c55555f67047964a5b79269c9c0..0beaabb7439755853d0f4d247e423b3b40bf11a1 100644 (file)
@@ -4,24 +4,29 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build cgo
+
 package main
 
 import (
+       "runtime/cgo"
        "unsafe"
 )
 
-//go:notinheap
-type S struct{ x int }
+type S struct {
+       _ cgo.Incomplete
+       x int
+}
 
 func main() {
        var i int
        p := (*S)(unsafe.Pointer(uintptr(unsafe.Pointer(&i))))
        v := uintptr(unsafe.Pointer(p))
-       // p is a pointer to a go:notinheap type. Like some C libraries,
+       // p is a pointer to a not-in-heap type. Like some C libraries,
        // we stored an integer in that pointer. That integer just happens
        // to be the address of i.
        // v is also the address of i.
-       // p has a base type which is marked go:notinheap, so it
+       // p has a base type which is marked not-in-heap, so it
        // should not be adjusted when the stack is copied.
        recurse(100, p, v)
 }
index c456b1db02cc16e4cc1b6d9cd9e6ad85aeb46d44..eb118591019e7322d7dc30e232c0fc0d35225afe 100644 (file)
@@ -4,10 +4,14 @@
 // source code is governed by a BSD-style license that can be found in
 // the LICENSE file.
 
+//go:build cgo
+
 package main
 
-//go:notinheap
+import "runtime/cgo"
+
 type NIH struct {
+       _ cgo.Incomplete
 }
 
 type T struct {
index 3e954813c9318112182bd24f5c9fee01a9e94a7b..ef8db2da30d68556ea8e38d1ed9344d130a61258 100644 (file)
@@ -4,12 +4,17 @@
 // source code is governed by a BSD-style license that can be found in
 // the LICENSE file.
 
+//go:build cgo
+
 package main
 
-import "reflect"
+import (
+       "reflect"
+       "runtime/cgo"
+)
 
-//go:notinheap
 type NIH struct {
+       _ cgo.Incomplete
 }
 
 var x, y NIH
index 3237a583d547361117b1b82aa6df2ca0a66a5508..d77564add2e9c52f7cb12b36fc34f64a09fb20bc 100644 (file)
@@ -1,6 +1,6 @@
 // run
-//go:build goexperiment.unified
-// +build goexperiment.unified
+//go:build goexperiment.unified && cgo
+// +build goexperiment.unified,cgo
 
 // TODO(mdempsky): Enable test unconditionally. This test should pass
 // for non-unified mode too.
 
 package main
 
-//go:notinheap
-type A struct{ B }
+import "runtime/cgo"
+
+type A struct {
+       B
+       _ cgo.Incomplete
+}
 type B struct{ x byte }
 type I interface{ M() *B }
 
similarity index 89%
rename from test/typeparam/issue51733.go
rename to test/fixedbugs/issue51733.go
index 03624f18655fcfb6eb63aa35dccf0e34b64d6a33..933c3e868c0545c81635ed438352ae571b359976 100644 (file)
@@ -4,15 +4,17 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build cgo
+
 package main
 
 import (
        "log"
+       "runtime/cgo"
        "unsafe"
 )
 
-//go:notinheap
-type S struct{}
+type S struct{ _ cgo.Incomplete }
 
 func main() {
        p := (*S)(unsafe.Pointer(uintptr(0x8000)))