misc/cgo/errors: fix tests in module mode

Updates #30228

Change-Id: I84bc705591bdb3da0106404b24353251939355b8
Reviewed-on: https://go-review.googlesource.com/c/163209
Reviewed-by: Jay Conrod <jayconrod@google.com>
This commit is contained in:
Bryan C. Mills 2019-02-21 09:06:09 -05:00
parent b35dacaac5
commit 8ea27e117f
25 changed files with 8 additions and 3 deletions

View File

@ -18,7 +18,7 @@ import (
)
func path(file string) string {
return filepath.Join("src", file)
return filepath.Join("testdata", file)
}
func check(t *testing.T, file string) {

View File

@ -444,8 +444,8 @@ func testOne(t *testing.T, pt ptrTest) {
}
defer os.RemoveAll(gopath)
src := filepath.Join(gopath, "src")
if err := os.Mkdir(src, 0777); err != nil {
src := filepath.Join(gopath, "src", "ptrtest")
if err := os.MkdirAll(src, 0777); err != nil {
t.Fatal(err)
}
@ -490,6 +490,11 @@ func testOne(t *testing.T, pt ptrTest) {
}
}
gomod := fmt.Sprintf("module %s\n", filepath.Base(src))
if err := ioutil.WriteFile(filepath.Join(src, "go.mod"), []byte(gomod), 0666); err != nil {
t.Fatalf("writing go.mod: %v", err)
}
args := func(cmd *exec.Cmd) string {
return strings.Join(cmd.Args, " ")
}