aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/link
diff options
context:
space:
mode:
authorKir Kolyshkin <kolyshkin@gmail.com>2024-09-03 19:46:46 -0700
committerGopher Robot <gobot@golang.org>2024-09-04 20:44:15 +0000
commit9ba8ac253ef366c708b06c66c8e20cbb1572de2f (patch)
tree11fc66261962ec3457b69d9fed1a7bca82b94dbc /src/cmd/link
parentde0aafa3c7f669df0a93dd62cc336ebda52815f2 (diff)
downloadgo-9ba8ac253ef366c708b06c66c8e20cbb1572de2f.tar.xz
cmd/link/internal/ld: rm os.Getwd from dwarf_test
Calls to os.Getwd were needed to set the cwd for go build to an absolute path. Since CL 401340 os/exec takes care of setting PWD to a filepath.Abs(cmd.Dir), so it looks like an absolute path is not really required. Change-Id: Ib3abffc9087a3329d8f40f81eb65f1b2c1a03a9c Reviewed-on: https://go-review.googlesource.com/c/go/+/610038 Auto-Submit: Ian Lance Taylor <iant@golang.org> Commit-Queue: Ian Lance Taylor <iant@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src/cmd/link')
-rw-r--r--src/cmd/link/internal/ld/dwarf_test.go50
1 files changed, 7 insertions, 43 deletions
diff --git a/src/cmd/link/internal/ld/dwarf_test.go b/src/cmd/link/internal/ld/dwarf_test.go
index e14e2edc8f..adb5c2607c 100644
--- a/src/cmd/link/internal/ld/dwarf_test.go
+++ b/src/cmd/link/internal/ld/dwarf_test.go
@@ -838,13 +838,7 @@ func TestAbstractOriginSanity(t *testing.T) {
}
mustHaveDWARF(t)
-
- if wd, err := os.Getwd(); err == nil {
- gopathdir := filepath.Join(wd, "testdata", "httptest")
- abstractOriginSanity(t, gopathdir, OptAllInl4)
- } else {
- t.Fatalf("os.Getwd() failed %v", err)
- }
+ abstractOriginSanity(t, "testdata/httptest", OptAllInl4)
}
func TestAbstractOriginSanityIssue25459(t *testing.T) {
@@ -855,24 +849,14 @@ func TestAbstractOriginSanityIssue25459(t *testing.T) {
t.Skip("skipping on not-amd64 not-386; location lists not supported")
}
- if wd, err := os.Getwd(); err == nil {
- gopathdir := filepath.Join(wd, "testdata", "issue25459")
- abstractOriginSanity(t, gopathdir, DefaultOpt)
- } else {
- t.Fatalf("os.Getwd() failed %v", err)
- }
+ abstractOriginSanity(t, "testdata/issue25459", DefaultOpt)
}
func TestAbstractOriginSanityIssue26237(t *testing.T) {
testenv.MustHaveGoBuild(t)
mustHaveDWARF(t)
- if wd, err := os.Getwd(); err == nil {
- gopathdir := filepath.Join(wd, "testdata", "issue26237")
- abstractOriginSanity(t, gopathdir, DefaultOpt)
- } else {
- t.Fatalf("os.Getwd() failed %v", err)
- }
+ abstractOriginSanity(t, "testdata/issue26237", DefaultOpt)
}
func TestRuntimeTypeAttrInternal(t *testing.T) {
@@ -1229,12 +1213,7 @@ func TestMachoIssue32233(t *testing.T) {
t.Skip("skipping; test only interesting on darwin")
}
- wd, err := os.Getwd()
- if err != nil {
- t.Fatalf("where am I? %v", err)
- }
- pdir := filepath.Join(wd, "testdata", "issue32233", "main")
- f := gobuildTestdata(t, pdir, DefaultOpt)
+ f := gobuildTestdata(t, "testdata/issue32233/main", DefaultOpt)
f.Close()
}
@@ -1309,12 +1288,7 @@ func TestIssue38192(t *testing.T) {
// Build a test program that contains a translation unit whose
// text (from am assembly source) contains only a single instruction.
- wd, err := os.Getwd()
- if err != nil {
- t.Fatalf("where am I? %v", err)
- }
- pdir := filepath.Join(wd, "testdata", "issue38192")
- f := gobuildTestdata(t, pdir, DefaultOpt)
+ f := gobuildTestdata(t, "testdata/issue38192", DefaultOpt)
defer f.Close()
// Open the resulting binary and examine the DWARF it contains.
@@ -1426,12 +1400,7 @@ func TestIssue39757(t *testing.T) {
// compiler/runtime in ways that aren't happening now, so this
// might be something to check for if it does start failing.
- wd, err := os.Getwd()
- if err != nil {
- t.Fatalf("where am I? %v", err)
- }
- pdir := filepath.Join(wd, "testdata", "issue39757")
- f := gobuildTestdata(t, pdir, DefaultOpt)
+ f := gobuildTestdata(t, "testdata/issue39757", DefaultOpt)
defer f.Close()
syms, err := f.Symbols()
@@ -1522,12 +1491,7 @@ func TestIssue42484(t *testing.T) {
t.Parallel()
- wd, err := os.Getwd()
- if err != nil {
- t.Fatalf("where am I? %v", err)
- }
- pdir := filepath.Join(wd, "testdata", "issue42484")
- f := gobuildTestdata(t, pdir, NoOpt)
+ f := gobuildTestdata(t, "testdata/issue42484", NoOpt)
var lastAddr uint64
var lastFile string