bpf modules can be included in filesystem modules
Bug: 322246536 Test: go test ./... Change-Id: I5f29258e45475b30cdb26014c2db147182ec52fa
This commit is contained in:
parent
f617e18741
commit
06c4cdcf87
3 changed files with 30 additions and 0 deletions
|
@ -203,6 +203,15 @@ func (bpf *bpf) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
installDir := android.PathForModuleInstall(ctx, "etc", "bpf")
|
||||||
|
if len(bpf.properties.Sub_dir) > 0 {
|
||||||
|
installDir = installDir.Join(ctx, bpf.properties.Sub_dir)
|
||||||
|
}
|
||||||
|
for _, obj := range bpf.objs {
|
||||||
|
ctx.PackageFile(installDir, obj.Base(), obj)
|
||||||
|
}
|
||||||
|
|
||||||
android.SetProvider(ctx, blueprint.SrcsFileProviderKey, blueprint.SrcsFileProviderData{SrcPaths: srcs.Strings()})
|
android.SetProvider(ctx, blueprint.SrcsFileProviderKey, blueprint.SrcsFileProviderData{SrcPaths: srcs.Strings()})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ bootstrap_go_package {
|
||||||
"blueprint",
|
"blueprint",
|
||||||
"soong",
|
"soong",
|
||||||
"soong-android",
|
"soong-android",
|
||||||
|
"soong-bpf", // for testing
|
||||||
"soong-linkerconfig",
|
"soong-linkerconfig",
|
||||||
],
|
],
|
||||||
srcs: [
|
srcs: [
|
||||||
|
|
|
@ -19,6 +19,7 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"android/soong/android"
|
"android/soong/android"
|
||||||
|
"android/soong/bpf"
|
||||||
"android/soong/cc"
|
"android/soong/cc"
|
||||||
"android/soong/etc"
|
"android/soong/etc"
|
||||||
|
|
||||||
|
@ -31,6 +32,7 @@ func TestMain(m *testing.M) {
|
||||||
|
|
||||||
var fixture = android.GroupFixturePreparers(
|
var fixture = android.GroupFixturePreparers(
|
||||||
android.PrepareForIntegrationTestWithAndroid,
|
android.PrepareForIntegrationTestWithAndroid,
|
||||||
|
bpf.PrepareForTestWithBpf,
|
||||||
etc.PrepareForTestWithPrebuiltEtc,
|
etc.PrepareForTestWithPrebuiltEtc,
|
||||||
cc.PrepareForIntegrationTestWithCc,
|
cc.PrepareForIntegrationTestWithCc,
|
||||||
PrepareForTestWithFilesystemBuildComponents,
|
PrepareForTestWithFilesystemBuildComponents,
|
||||||
|
@ -40,11 +42,29 @@ func TestFileSystemDeps(t *testing.T) {
|
||||||
result := fixture.RunTestWithBp(t, `
|
result := fixture.RunTestWithBp(t, `
|
||||||
android_filesystem {
|
android_filesystem {
|
||||||
name: "myfilesystem",
|
name: "myfilesystem",
|
||||||
|
multilib: {
|
||||||
|
common: {
|
||||||
|
deps: [
|
||||||
|
"bpf.o",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
bpf {
|
||||||
|
name: "bpf.o",
|
||||||
|
srcs: ["bpf.c"],
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
// produces "myfilesystem.img"
|
// produces "myfilesystem.img"
|
||||||
result.ModuleForTests("myfilesystem", "android_common").Output("myfilesystem.img")
|
result.ModuleForTests("myfilesystem", "android_common").Output("myfilesystem.img")
|
||||||
|
|
||||||
|
fs := result.ModuleForTests("myfilesystem", "android_common").Module().(*filesystem)
|
||||||
|
expected := []string{"etc/bpf/bpf.o"}
|
||||||
|
for _, e := range expected {
|
||||||
|
android.AssertStringListContains(t, "missing entry", fs.entries, e)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestFileSystemFillsLinkerConfigWithStubLibs(t *testing.T) {
|
func TestFileSystemFillsLinkerConfigWithStubLibs(t *testing.T) {
|
||||||
|
|
Loading…
Reference in a new issue