Add missing dependencies when linking tests
Linking tests needs the same dependencies that linking binaries got in https://github.com/google/blueprint/pull/222. Test: m checkbuild Change-Id: I33330f3184b8c0fd2bc20b48736c20d6edeaea68
This commit is contained in:
parent
3f13f07565
commit
0e58dc0176
1 changed files with 6 additions and 3 deletions
|
@ -561,11 +561,13 @@ func buildGoTest(ctx blueprint.ModuleContext, testRoot, testPkgArchive,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
var linkDeps []string
|
||||||
libDirFlags := []string{"-L " + testRoot}
|
libDirFlags := []string{"-L " + testRoot}
|
||||||
testDeps := []string{}
|
testDeps := []string{}
|
||||||
ctx.VisitDepsDepthFirstIf(isGoPackageProducer,
|
ctx.VisitDepsDepthFirstIf(isGoPackageProducer,
|
||||||
func(module blueprint.Module) {
|
func(module blueprint.Module) {
|
||||||
dep := module.(goPackageProducer)
|
dep := module.(goPackageProducer)
|
||||||
|
linkDeps = append(linkDeps, dep.GoPackageTarget())
|
||||||
libDir := dep.GoPkgRoot()
|
libDir := dep.GoPkgRoot()
|
||||||
libDirFlags = append(libDirFlags, "-L "+libDir)
|
libDirFlags = append(libDirFlags, "-L "+libDir)
|
||||||
testDeps = append(testDeps, dep.GoTestTargets()...)
|
testDeps = append(testDeps, dep.GoTestTargets()...)
|
||||||
|
@ -584,9 +586,10 @@ func buildGoTest(ctx blueprint.ModuleContext, testRoot, testPkgArchive,
|
||||||
})
|
})
|
||||||
|
|
||||||
ctx.Build(pctx, blueprint.BuildParams{
|
ctx.Build(pctx, blueprint.BuildParams{
|
||||||
Rule: link,
|
Rule: link,
|
||||||
Outputs: []string{testFile},
|
Outputs: []string{testFile},
|
||||||
Inputs: []string{testArchive},
|
Inputs: []string{testArchive},
|
||||||
|
Implicits: linkDeps,
|
||||||
Args: map[string]string{
|
Args: map[string]string{
|
||||||
"libDirFlags": strings.Join(libDirFlags, " "),
|
"libDirFlags": strings.Join(libDirFlags, " "),
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue