mirror of https://github.com/golang/go.git
cmd/link, go/internal/gccgoimporter: get ar from env by default in tests
Change-Id: Ib64b1f641fcf795a51aaf31639d37927dab519e5 Reviewed-on: https://go-review.googlesource.com/c/go/+/622237 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
This commit is contained in:
parent
c5d424bfca
commit
c77ca70f44
|
|
@ -121,10 +121,14 @@ func testDWARF(t *testing.T, buildmode string, expectDWARF bool, env ...string)
|
|||
|
||||
if buildmode == "c-archive" {
|
||||
// Extract the archive and use the go.o object within.
|
||||
cmd := testenv.Command(t, "ar", "-x", exe)
|
||||
ar := os.Getenv("AR")
|
||||
if ar == "" {
|
||||
ar = "ar"
|
||||
}
|
||||
cmd := testenv.Command(t, ar, "-x", exe)
|
||||
cmd.Dir = tmpDir
|
||||
if out, err := cmd.CombinedOutput(); err != nil {
|
||||
t.Fatalf("ar -x %s: %v\n%s", exe, err, out)
|
||||
t.Fatalf("%s -x %s: %v\n%s", ar, exe, err, out)
|
||||
}
|
||||
exe = filepath.Join(tmpDir, "go.o")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -180,11 +180,15 @@ func TestObjImporter(t *testing.T) {
|
|||
|
||||
runImporterTest(t, imp, initmap, &test)
|
||||
|
||||
cmd = testenv.Command(t, "ar", "cr", afile, ofile)
|
||||
ar := os.Getenv("AR")
|
||||
if ar == "" {
|
||||
ar = "ar"
|
||||
}
|
||||
cmd = testenv.Command(t, ar, "cr", afile, ofile)
|
||||
out, err = cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
t.Logf("%s", out)
|
||||
t.Fatalf("ar cr %s %s failed: %s", afile, ofile, err)
|
||||
t.Fatalf("%s cr %s %s failed: %s", ar, afile, ofile, err)
|
||||
}
|
||||
|
||||
runImporterTest(t, arimp, arinitmap, &test)
|
||||
|
|
|
|||
Loading…
Reference in New Issue