for _, path := range p.TestImports {
deps[path] = true
}
+ for _, path := range p.XTestImports {
+ deps[path] = true
+ }
}
// translate C to runtime/cgo
m[k] = append(m[k], v...)
}
ptest.build.ImportPos = m
- computeStale(ptest)
- a := b.action(modeBuild, modeBuild, ptest)
- a.objdir = testDir + string(filepath.Separator)
- a.objpkg = ptestObj
- a.target = ptestObj
- a.link = false
} else {
ptest = p
}
Name: p.Name + "_test",
ImportPath: p.ImportPath + "_test",
localPrefix: p.localPrefix,
+ Root: p.Root,
Dir: p.Dir,
GoFiles: p.XTestGoFiles,
Imports: p.XTestImports,
fake: true,
Stale: true,
}
- computeStale(pxtest)
- a := b.action(modeBuild, modeBuild, pxtest)
- a.objdir = testDir + string(filepath.Separator)
- a.objpkg = buildToolchain.pkgpath(testDir, pxtest)
- a.target = a.objpkg
}
// Action for building pkg.test.
Dir: testDir,
GoFiles: []string{"_testmain.go"},
ImportPath: "testmain",
+ Root: p.Root,
imports: []*Package{ptest},
build: &build.Package{},
fake: true,
pmain.imports = append(pmain.imports, ptesting, pregexp)
computeStale(pmain)
+ if ptest != p {
+ a := b.action(modeBuild, modeBuild, ptest)
+ a.objdir = testDir + string(filepath.Separator)
+ a.objpkg = ptestObj
+ a.target = ptestObj
+ a.link = false
+ }
+
+ if pxtest != nil {
+ a := b.action(modeBuild, modeBuild, pxtest)
+ a.objdir = testDir + string(filepath.Separator)
+ a.objpkg = buildToolchain.pkgpath(testDir, pxtest)
+ a.target = a.objpkg
+ }
+
a := b.action(modeBuild, modeBuild, pmain)
a.objdir = testDir + string(filepath.Separator)
a.objpkg = filepath.Join(testDir, "main.a")