From 6f445a9db55f65e55c5be29d3c506ecf3be37915 Mon Sep 17 00:00:00 2001 From: Michael Matloob Date: Wed, 21 Sep 2022 15:51:27 -0400 Subject: test: update test/run.go and some tests to use importcfg Using importcfg instead of depending on the existence of .a files for standard library packages will enable us to remove the .a files in a future cl. Change-Id: I6108384224508bc37d82fd990fc4a8649222502c Reviewed-on: https://go-review.googlesource.com/c/go/+/440222 Reviewed-by: Bryan Mills Reviewed-by: Michael Matloob Run-TryBot: Michael Matloob TryBot-Result: Gopher Robot --- test/fixedbugs/bug369.go | 13 +++++++++---- test/fixedbugs/issue21317.go | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) (limited to 'test/fixedbugs') diff --git a/test/fixedbugs/bug369.go b/test/fixedbugs/bug369.go index 5bababd63e..65dd9adc73 100644 --- a/test/fixedbugs/bug369.go +++ b/test/fixedbugs/bug369.go @@ -31,10 +31,15 @@ func main() { check(os.Mkdir(tmp("test"), 0777)) - run("go", "tool", "compile", "-p=test/slow", "-N", "-o", tmp("test/slow.o"), "pkg.go") - run("go", "tool", "compile", "-p=test/fast", "-o", tmp("test/fast.o"), "pkg.go") - run("go", "tool", "compile", "-p=main", "-D", "test", "-I", tmpDir, "-o", tmp("main.o"), "main.go") - run("go", "tool", "link", "-L", tmpDir, "-o", tmp("a.exe"), tmp("main.o")) + stdlibimportcfg, err := os.ReadFile(os.Getenv("STDLIB_IMPORTCFG")) + check(err) + importcfg := string(stdlibimportcfg) + "\npackagefile test/slow=" + tmp("test/slow.o") + "\npackagefile test/fast=" + tmp("test/fast.o") + os.WriteFile(tmp("importcfg"), []byte(importcfg), 0644) + + run("go", "tool", "compile", "-importcfg="+tmp("importcfg"), "-p=test/slow", "-N", "-o", tmp("test/slow.o"), "pkg.go") + run("go", "tool", "compile", "-importcfg="+tmp("importcfg"), "-p=test/fast", "-o", tmp("test/fast.o"), "pkg.go") + run("go", "tool", "compile", "-importcfg="+tmp("importcfg"), "-p=main", "-D", "test", "-o", tmp("main.o"), "main.go") + run("go", "tool", "link", "-importcfg="+tmp("importcfg"), "-o", tmp("a.exe"), tmp("main.o")) run(tmp("a.exe")) } diff --git a/test/fixedbugs/issue21317.go b/test/fixedbugs/issue21317.go index 80797f73ed..81379dcc33 100644 --- a/test/fixedbugs/issue21317.go +++ b/test/fixedbugs/issue21317.go @@ -38,7 +38,7 @@ func main() { defer os.RemoveAll(f.Name()) // compile and test output - cmd := exec.Command("go", "tool", "compile", "-p=main", f.Name()) + cmd := exec.Command("go", "tool", "compile", "-p=main", "-importcfg="+os.Getenv("STDLIB_IMPORTCFG"), f.Name()) out, err := cmd.CombinedOutput() if err == nil { log.Fatalf("expected cmd/compile to fail") -- cgit v1.3