aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/runtime-gdb_test.go
diff options
context:
space:
mode:
authorBryan C. Mills <bcmills@google.com>2022-03-09 17:19:23 -0500
committerBryan Mills <bcmills@google.com>2022-03-18 21:55:52 +0000
commit58631ba54f45506f2f178bb01d22273e7dfba674 (patch)
tree6833d66fdc88efd536d43d0a71f3e61aec77778e /src/runtime/runtime-gdb_test.go
parent9ac75d39514402d9b314e758524dcc28612b8937 (diff)
downloadgo-58631ba54f45506f2f178bb01d22273e7dfba674.tar.xz
internal/testenv: add GOROOT and use it to fix tests broken with -trimpath
This fixes many (but not all) of the tests that currently fail (due to a bogus path reported by runtime.GOROOT) when run with 'go test -trimpath std cmd'. Updates #51461 Change-Id: Ia2cc05705529c4859e7928f32eeceed647f2e986 Reviewed-on: https://go-review.googlesource.com/c/go/+/391806 Trust: Bryan Mills <bcmills@google.com> Run-TryBot: Bryan Mills <bcmills@google.com> Reviewed-by: Russ Cox <rsc@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'src/runtime/runtime-gdb_test.go')
-rw-r--r--src/runtime/runtime-gdb_test.go18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/runtime/runtime-gdb_test.go b/src/runtime/runtime-gdb_test.go
index ee8c6c210f..bb76116ee9 100644
--- a/src/runtime/runtime-gdb_test.go
+++ b/src/runtime/runtime-gdb_test.go
@@ -49,7 +49,7 @@ func checkGdbEnvironment(t *testing.T) {
case "plan9":
t.Skip("there is no gdb on Plan 9")
}
- if final := os.Getenv("GOROOT_FINAL"); final != "" && runtime.GOROOT() != final {
+ if final := os.Getenv("GOROOT_FINAL"); final != "" && testenv.GOROOT(t) != final {
t.Skip("gdb test can fail with GOROOT_FINAL pending")
}
}
@@ -204,7 +204,7 @@ func testGdbPython(t *testing.T, cgo bool) {
}
args := []string{"-nx", "-q", "--batch",
- "-iex", "add-auto-load-safe-path " + filepath.Join(runtime.GOROOT(), "src", "runtime"),
+ "-iex", "add-auto-load-safe-path " + filepath.Join(testenv.GOROOT(t), "src", "runtime"),
"-ex", "set startup-with-shell off",
"-ex", "set print thread-events off",
}
@@ -215,7 +215,7 @@ func testGdbPython(t *testing.T, cgo bool) {
// Until gold and gdb can work together, temporarily load the
// python script directly.
args = append(args,
- "-ex", "source "+filepath.Join(runtime.GOROOT(), "src", "runtime", "runtime-gdb.py"),
+ "-ex", "source "+filepath.Join(testenv.GOROOT(t), "src", "runtime", "runtime-gdb.py"),
)
} else {
args = append(args,
@@ -276,7 +276,7 @@ func testGdbPython(t *testing.T, cgo bool) {
cmd.Env = []string{}
out, err := cmd.CombinedOutput()
if err != nil && bytes.Contains(out, []byte("cannot find GOROOT")) {
- t.Skipf("skipping because GOROOT=%s does not exist", runtime.GOROOT())
+ t.Skipf("skipping because GOROOT=%s does not exist", testenv.GOROOT(t))
}
_, file, _, _ := runtime.Caller(1)
@@ -416,7 +416,7 @@ func TestGdbBacktrace(t *testing.T) {
// Execute gdb commands.
args := []string{"-nx", "-batch",
- "-iex", "add-auto-load-safe-path " + filepath.Join(runtime.GOROOT(), "src", "runtime"),
+ "-iex", "add-auto-load-safe-path " + filepath.Join(testenv.GOROOT(t), "src", "runtime"),
"-ex", "set startup-with-shell off",
"-ex", "break main.eee",
"-ex", "run",
@@ -498,7 +498,7 @@ func TestGdbAutotmpTypes(t *testing.T) {
// Execute gdb commands.
args := []string{"-nx", "-batch",
- "-iex", "add-auto-load-safe-path " + filepath.Join(runtime.GOROOT(), "src", "runtime"),
+ "-iex", "add-auto-load-safe-path " + filepath.Join(testenv.GOROOT(t), "src", "runtime"),
"-ex", "set startup-with-shell off",
"-ex", "break main.main",
"-ex", "run",
@@ -563,7 +563,7 @@ func TestGdbConst(t *testing.T) {
// Execute gdb commands.
args := []string{"-nx", "-batch",
- "-iex", "add-auto-load-safe-path " + filepath.Join(runtime.GOROOT(), "src", "runtime"),
+ "-iex", "add-auto-load-safe-path " + filepath.Join(testenv.GOROOT(t), "src", "runtime"),
"-ex", "set startup-with-shell off",
"-ex", "break main.main",
"-ex", "run",
@@ -626,7 +626,7 @@ func TestGdbPanic(t *testing.T) {
// Execute gdb commands.
args := []string{"-nx", "-batch",
- "-iex", "add-auto-load-safe-path " + filepath.Join(runtime.GOROOT(), "src", "runtime"),
+ "-iex", "add-auto-load-safe-path " + filepath.Join(testenv.GOROOT(t), "src", "runtime"),
"-ex", "set startup-with-shell off",
"-ex", "run",
"-ex", "backtrace",
@@ -701,7 +701,7 @@ func TestGdbInfCallstack(t *testing.T) {
// Execute gdb commands.
// 'setg_gcc' is the first point where we can reproduce the issue with just one 'run' command.
args := []string{"-nx", "-batch",
- "-iex", "add-auto-load-safe-path " + filepath.Join(runtime.GOROOT(), "src", "runtime"),
+ "-iex", "add-auto-load-safe-path " + filepath.Join(testenv.GOROOT(t), "src", "runtime"),
"-ex", "set startup-with-shell off",
"-ex", "break setg_gcc",
"-ex", "run",