Skip to content

Commit 6d3139b

Browse files
committed
misc/cgo/testshared: test build std in shared mode
Test that "go install -buildmode=shared std" works. For #57334. Change-Id: I465a07cf2e9035995916ef9940b4c1eeba998099 Reviewed-on: https://go-review.googlesource.com/c/go/+/459056 Reviewed-by: Than McIntosh <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Tim Scharfenort <[email protected]> Run-TryBot: Cherry Mui <[email protected]>
1 parent de6abd7 commit 6d3139b

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

misc/cgo/testshared/shared_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,3 +1105,15 @@ func TestIssue47873(t *testing.T) {
11051105
goCmd(t, "install", "-buildmode=shared", "-linkshared", "./issue47837/a")
11061106
goCmd(t, "run", "-linkshared", "./issue47837/main")
11071107
}
1108+
1109+
// Test that we can build std in shared mode.
1110+
func TestStd(t *testing.T) {
1111+
if testing.Short() {
1112+
t.Skip("skip in short mode")
1113+
}
1114+
t.Parallel()
1115+
// Use a temporary pkgdir to not interfere with other tests, and not write to GOROOT.
1116+
// Cannot use goCmd as it runs with cloned GOROOT which is incomplete.
1117+
runWithEnv(t, "building std", []string{"GOROOT=" + oldGOROOT},
1118+
filepath.Join(oldGOROOT, "bin", "go"), "install", "-buildmode=shared", "-pkgdir="+t.TempDir(), "std")
1119+
}

0 commit comments

Comments
 (0)