Commit 7dc3d9f8 authored by Ian Lance Taylor's avatar Ian Lance Taylor

misc/cgo/testplugin: let TestMain run deferred functions

Split TestMain into two functions so that we can defer cleanups.

Updates #30500

Change-Id: I4a5c7ddb8218a8bd056c8733c3cb9feb895e77a0
Reviewed-on: https://go-review.googlesource.com/c/164859
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarDaniel Martí <mvdan@mvdan.cc>
parent 4aff88de
......@@ -23,7 +23,10 @@ var gcflags string = os.Getenv("GO_GCFLAGS")
func TestMain(m *testing.M) {
log.SetFlags(log.Lshortfile)
os.Exit(testMain(m))
}
func testMain(m *testing.M) int {
// Copy testdata into GOPATH/src/testarchive, along with a go.mod file
// declaring the same path.
......@@ -77,7 +80,7 @@ func TestMain(m *testing.M) {
goCmd(nil, "build", "-buildmode=plugin", "-o=unnamed2.so", "./unnamed2/main.go")
goCmd(nil, "build", "-o", "host.exe", "./host")
os.Exit(m.Run())
return m.Run()
}
func goCmd(t *testing.T, op string, args ...string) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment