diff options
author | Cherry Mui <cherryyz@google.com> | 2022-12-21 23:31:48 -0500 |
---|---|---|
committer | Cherry Mui <cherryyz@google.com> | 2022-12-22 15:23:56 +0000 |
commit | 6d3139b203912835b19e32fcb9bb709f89f0bc11 (patch) | |
tree | 6aeb05ebde089f86ce45cc957a4b81fd6e6b69b6 | |
parent | de6abd78893e91f26337eb399644b7a6bc3ea583 (diff) | |
download | go-git-6d3139b203912835b19e32fcb9bb709f89f0bc11.tar.gz |
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 <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Tim Scharfenort <timscharfenort89@googlemail.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
-rw-r--r-- | misc/cgo/testshared/shared_test.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/misc/cgo/testshared/shared_test.go b/misc/cgo/testshared/shared_test.go index cd8a144d73..b14fb1cb3a 100644 --- a/misc/cgo/testshared/shared_test.go +++ b/misc/cgo/testshared/shared_test.go @@ -1105,3 +1105,15 @@ func TestIssue47873(t *testing.T) { goCmd(t, "install", "-buildmode=shared", "-linkshared", "./issue47837/a") goCmd(t, "run", "-linkshared", "./issue47837/main") } + +// Test that we can build std in shared mode. +func TestStd(t *testing.T) { + if testing.Short() { + t.Skip("skip in short mode") + } + t.Parallel() + // Use a temporary pkgdir to not interfere with other tests, and not write to GOROOT. + // Cannot use goCmd as it runs with cloned GOROOT which is incomplete. + runWithEnv(t, "building std", []string{"GOROOT=" + oldGOROOT}, + filepath.Join(oldGOROOT, "bin", "go"), "install", "-buildmode=shared", "-pkgdir="+t.TempDir(), "std") +} |