mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
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:
parent
96a773d61b
commit
a1f3dc33dc
14 changed files with 18 additions and 482 deletions
|
|
@ -7,6 +7,7 @@ package shared_test
|
|||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"cmd/cgo/internal/cgotest"
|
||||
"debug/elf"
|
||||
"encoding/binary"
|
||||
"flag"
|
||||
|
|
@ -203,7 +204,7 @@ func TestMain(m *testing.M) {
|
|||
// It returns the directory within gopath at which the module root is located.
|
||||
func cloneTestdataModule(gopath string) (string, error) {
|
||||
modRoot := filepath.Join(gopath, "src", "testshared")
|
||||
if err := overlayDir(modRoot, "testdata"); err != nil {
|
||||
if err := cgotest.OverlayDir(modRoot, "testdata"); err != nil {
|
||||
return "", err
|
||||
}
|
||||
if err := os.WriteFile(filepath.Join(modRoot, "go.mod"), []byte("module testshared\n"), 0644); err != nil {
|
||||
|
|
@ -255,7 +256,7 @@ func cloneGOROOTDeps(goroot string) error {
|
|||
if testing.Verbose() {
|
||||
fmt.Fprintf(os.Stderr, "+ cp -r %s %s\n", filepath.Join(oldGOROOT, dir), filepath.Join(goroot, dir))
|
||||
}
|
||||
if err := overlayDir(filepath.Join(goroot, dir), filepath.Join(oldGOROOT, dir)); err != nil {
|
||||
if err := cgotest.OverlayDir(filepath.Join(goroot, dir), filepath.Join(oldGOROOT, dir)); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue