mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
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>
47 lines
864 B
Go
47 lines
864 B
Go
// Copyright 2015 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.
|
|
|
|
package main
|
|
|
|
import "C"
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"runtime"
|
|
)
|
|
|
|
// RunGoroutines starts some goroutines that don't do anything.
|
|
// The idea is to get some threads going, so that a signal will be delivered
|
|
// to a thread started by Go.
|
|
//
|
|
//export RunGoroutines
|
|
func RunGoroutines() {
|
|
for i := 0; i < 4; i++ {
|
|
go func() {
|
|
runtime.LockOSThread()
|
|
select {}
|
|
}()
|
|
}
|
|
}
|
|
|
|
var P *byte
|
|
|
|
// TestSEGV makes sure that an invalid address turns into a run-time Go panic.
|
|
//
|
|
//export TestSEGV
|
|
func TestSEGV() {
|
|
defer func() {
|
|
if recover() == nil {
|
|
fmt.Fprintln(os.Stderr, "no panic from segv")
|
|
os.Exit(1)
|
|
}
|
|
}()
|
|
*P = 0
|
|
fmt.Fprintln(os.Stderr, "continued after segv")
|
|
os.Exit(1)
|
|
}
|
|
|
|
func main() {
|
|
}
|