mirror of
https://github.com/golang/go
synced 2024-09-15 22:20:06 +00:00
cmd/go: fix 'go test foo_test.go'
Fixes race build. TBR=iant CC=golang-codereviews https://golang.org/cl/100410044
This commit is contained in:
parent
26ad5d4ff0
commit
41e5c398d9
|
@ -783,6 +783,12 @@ fi
|
|||
rm -f testdata/err.out
|
||||
unset GOPATH
|
||||
|
||||
TEST 'go test foo_test.go works'
|
||||
if ! ./testgo test testdata/standalone_test.go; then
|
||||
echo "go test testdata/standalone_test.go failed"
|
||||
ok=false
|
||||
fi
|
||||
|
||||
# clean up
|
||||
if $started; then stop; fi
|
||||
rm -rf testdata/bin testdata/bin1
|
||||
|
|
|
@ -661,11 +661,14 @@ func (b *builder) test(p *Package) (buildAction, runAction, printAction *action,
|
|||
build: &build.Package{
|
||||
ImportPos: p.build.XTestImportPos,
|
||||
},
|
||||
imports: append(ximports, ptest),
|
||||
imports: ximports,
|
||||
pkgdir: testDir,
|
||||
fake: true,
|
||||
Stale: true,
|
||||
}
|
||||
if ptest != p {
|
||||
pxtest.imports = append(pxtest.imports, ptest)
|
||||
}
|
||||
}
|
||||
|
||||
// Action for building pkg.test.
|
||||
|
@ -675,13 +678,15 @@ func (b *builder) test(p *Package) (buildAction, runAction, printAction *action,
|
|||
GoFiles: []string{"_testmain.go"},
|
||||
ImportPath: "testmain",
|
||||
Root: p.Root,
|
||||
imports: []*Package{ptest},
|
||||
build: &build.Package{Name: "main"},
|
||||
pkgdir: testDir,
|
||||
fake: true,
|
||||
Stale: true,
|
||||
omitDWARF: !testC && !testNeedBinary,
|
||||
}
|
||||
if ptest != p {
|
||||
pmain.imports = append(pmain.imports, ptest)
|
||||
}
|
||||
if pxtest != nil {
|
||||
pmain.imports = append(pmain.imports, pxtest)
|
||||
}
|
||||
|
|
6
src/cmd/go/testdata/standalone_test.go
vendored
Normal file
6
src/cmd/go/testdata/standalone_test.go
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
package standalone_test
|
||||
|
||||
import "testing"
|
||||
|
||||
func Test(t *testing.T) {
|
||||
}
|
Loading…
Reference in a new issue