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")
}
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)