cmd/cgo: merge overlayDir into one package

There are many copies of overlaydir_test.go between the cgo tests
from when these couldn't share code. Now that they can, merge these
copies into a cmd/cgo/internal/cgotest package.

Change-Id: I203217f5d08e6306cb049a13718652cf7c447b80
Reviewed-on: https://go-review.googlesource.com/c/go/+/497078
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
Austin Clements 2023-05-22 10:32:31 -04:00
parent 96a773d61b
commit a1f3dc33dc
14 changed files with 18 additions and 482 deletions

View file

@ -12,6 +12,7 @@ package carchive_test
import (
"bufio"
"bytes"
"cmd/cgo/internal/cgotest"
"debug/elf"
"flag"
"fmt"
@ -82,7 +83,7 @@ func testMain(m *testing.M) int {
// Copy testdata into GOPATH/src/testarchive, along with a go.mod file
// declaring the same path.
modRoot := filepath.Join(GOPATH, "src", "testcarchive")
if err := overlayDir(modRoot, "testdata"); err != nil {
if err := cgotest.OverlayDir(modRoot, "testdata"); err != nil {
log.Panic(err)
}
if err := os.Chdir(modRoot); err != nil {