From 9068c6844dc0f0100bd810ad73dbf877bb92507b Mon Sep 17 00:00:00 2001 From: "Bryan C. Mills" Date: Thu, 16 Jun 2022 15:45:25 -0400 Subject: [PATCH] cmd/dist: add package . to 'go test' commands This suppresses verbose output if the test passes, eliminating some "hello from C" noise for the ../misc/cgo test. Change-Id: I6324bfb4b3633c20e0eb0ae03aa25d40fab9fcfb Reviewed-on: https://go-review.googlesource.com/c/go/+/412776 Reviewed-by: Ian Lance Taylor Run-TryBot: Bryan Mills Auto-Submit: Bryan Mills TryBot-Result: Gopher Robot --- src/cmd/dist/test.go | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/cmd/dist/test.go b/src/cmd/dist/test.go index 26d7fe0f737..846d0c0d85e 100644 --- a/src/cmd/dist/test.go +++ b/src/cmd/dist/test.go @@ -766,7 +766,7 @@ func (t *tester) registerTests() { name: "swig_stdio", heading: "../misc/swig/stdio", fn: func(dt *distTest) error { - t.addCmd(dt, "misc/swig/stdio", t.goTest()) + t.addCmd(dt, "misc/swig/stdio", t.goTest(), ".") return nil }, }) @@ -776,7 +776,7 @@ func (t *tester) registerTests() { name: "swig_callback", heading: "../misc/swig/callback", fn: func(dt *distTest) error { - t.addCmd(dt, "misc/swig/callback", t.goTest()) + t.addCmd(dt, "misc/swig/callback", t.goTest(), ".") return nil }, }, @@ -784,7 +784,7 @@ func (t *tester) registerTests() { name: "swig_callback_lto", heading: "../misc/swig/callback", fn: func(dt *distTest) error { - cmd := t.addCmd(dt, "misc/swig/callback", t.goTest()) + cmd := t.addCmd(dt, "misc/swig/callback", t.goTest(), ".") setEnv(cmd, "CGO_CFLAGS", "-flto -Wno-lto-type-mismatch -Wno-unknown-warning-option") setEnv(cmd, "CGO_CXXFLAGS", "-flto -Wno-lto-type-mismatch -Wno-unknown-warning-option") setEnv(cmd, "CGO_LDFLAGS", "-flto -Wno-lto-type-mismatch -Wno-unknown-warning-option") @@ -1185,11 +1185,11 @@ func (t *tester) runHostTest(dir, pkg string) error { } func (t *tester) cgoTest(dt *distTest) error { - cmd := t.addCmd(dt, "misc/cgo/test", t.goTest()) + cmd := t.addCmd(dt, "misc/cgo/test", t.goTest(), ".") setEnv(cmd, "GOFLAGS", "-ldflags=-linkmode=auto") if t.internalLink() { - cmd := t.addCmd(dt, "misc/cgo/test", t.goTest(), "-tags=internal") + cmd := t.addCmd(dt, "misc/cgo/test", t.goTest(), "-tags=internal", ".") setEnv(cmd, "GOFLAGS", "-ldflags=-linkmode=internal") } @@ -1201,15 +1201,15 @@ func (t *tester) cgoTest(dt *distTest) error { if !t.extLink() { break } - cmd := t.addCmd(dt, "misc/cgo/test", t.goTest()) + cmd := t.addCmd(dt, "misc/cgo/test", t.goTest(), ".") setEnv(cmd, "GOFLAGS", "-ldflags=-linkmode=external") - t.addCmd(dt, "misc/cgo/test", t.goTest(), "-ldflags", "-linkmode=external -s") + t.addCmd(dt, "misc/cgo/test", t.goTest(), "-ldflags", "-linkmode=external -s", ".") if t.supportedBuildmode("pie") { - t.addCmd(dt, "misc/cgo/test", t.goTest(), "-buildmode=pie") + t.addCmd(dt, "misc/cgo/test", t.goTest(), "-buildmode=pie", ".") if t.internalLink() && t.internalLinkPIE() { - t.addCmd(dt, "misc/cgo/test", t.goTest(), "-buildmode=pie", "-ldflags=-linkmode=internal", "-tags=internal,internal_pie") + t.addCmd(dt, "misc/cgo/test", t.goTest(), "-buildmode=pie", "-ldflags=-linkmode=internal", "-tags=internal,internal_pie", ".") } } @@ -1221,14 +1221,14 @@ func (t *tester) cgoTest(dt *distTest) error { "netbsd-386", "netbsd-amd64", "openbsd-386", "openbsd-amd64", "openbsd-arm", "openbsd-arm64", "openbsd-mips64": - cmd := t.addCmd(dt, "misc/cgo/test", t.goTest()) + cmd := t.addCmd(dt, "misc/cgo/test", t.goTest(), ".") setEnv(cmd, "GOFLAGS", "-ldflags=-linkmode=external") // cgo should be able to cope with both -g arguments and colored // diagnostics. setEnv(cmd, "CGO_CFLAGS", "-g0 -fdiagnostics-color") - t.addCmd(dt, "misc/cgo/testtls", t.goTest(), "-ldflags", "-linkmode=auto") - t.addCmd(dt, "misc/cgo/testtls", t.goTest(), "-ldflags", "-linkmode=external") + t.addCmd(dt, "misc/cgo/testtls", t.goTest(), "-ldflags", "-linkmode=auto", ".") + t.addCmd(dt, "misc/cgo/testtls", t.goTest(), "-ldflags", "-linkmode=external", ".") switch pair { case "aix-ppc64", "netbsd-386", "netbsd-amd64": @@ -1247,28 +1247,28 @@ func (t *tester) cgoTest(dt *distTest) error { fmt.Println("No support for static linking found (lacks libc.a?), skip cgo static linking test.") } else { if goos != "android" { - t.addCmd(dt, "misc/cgo/testtls", t.goTest(), "-ldflags", `-linkmode=external -extldflags "-static -pthread"`) + t.addCmd(dt, "misc/cgo/testtls", t.goTest(), "-ldflags", `-linkmode=external -extldflags "-static -pthread"`, ".") } - t.addCmd(dt, "misc/cgo/nocgo", t.goTest()) - t.addCmd(dt, "misc/cgo/nocgo", t.goTest(), "-ldflags", `-linkmode=external`) + t.addCmd(dt, "misc/cgo/nocgo", t.goTest(), ".") + t.addCmd(dt, "misc/cgo/nocgo", t.goTest(), "-ldflags", `-linkmode=external`, ".") if goos != "android" { - t.addCmd(dt, "misc/cgo/nocgo", t.goTest(), "-ldflags", `-linkmode=external -extldflags "-static -pthread"`) - t.addCmd(dt, "misc/cgo/test", t.goTest(), "-tags=static", "-ldflags", `-linkmode=external -extldflags "-static -pthread"`) + t.addCmd(dt, "misc/cgo/nocgo", t.goTest(), "-ldflags", `-linkmode=external -extldflags "-static -pthread"`, ".") + t.addCmd(dt, "misc/cgo/test", t.goTest(), "-tags=static", "-ldflags", `-linkmode=external -extldflags "-static -pthread"`, ".") // -static in CGO_LDFLAGS triggers a different code path // than -static in -extldflags, so test both. // See issue #16651. - cmd := t.addCmd(dt, "misc/cgo/test", t.goTest(), "-tags=static") + cmd := t.addCmd(dt, "misc/cgo/test", t.goTest(), "-tags=static", ".") setEnv(cmd, "CGO_LDFLAGS", "-static -pthread") } } if t.supportedBuildmode("pie") { - t.addCmd(dt, "misc/cgo/test", t.goTest(), "-buildmode=pie") + t.addCmd(dt, "misc/cgo/test", t.goTest(), "-buildmode=pie", ".") if t.internalLink() && t.internalLinkPIE() { - t.addCmd(dt, "misc/cgo/test", t.goTest(), "-buildmode=pie", "-ldflags=-linkmode=internal", "-tags=internal,internal_pie") + t.addCmd(dt, "misc/cgo/test", t.goTest(), "-buildmode=pie", "-ldflags=-linkmode=internal", "-tags=internal,internal_pie", ".") } - t.addCmd(dt, "misc/cgo/testtls", t.goTest(), "-buildmode=pie") - t.addCmd(dt, "misc/cgo/nocgo", t.goTest(), "-buildmode=pie") + t.addCmd(dt, "misc/cgo/testtls", t.goTest(), "-buildmode=pie", ".") + t.addCmd(dt, "misc/cgo/nocgo", t.goTest(), "-buildmode=pie", ".") } } }