diff options
author | 2022-10-04 16:59:31 -0700 | |
---|---|---|
committer | 2022-10-07 18:30:45 +0000 | |
commit | aa981edcf068b21bef7a2ad1c03da5356bba4a53 (patch) | |
tree | ff10d5f30d97c5eddd4b0db923d8d2e19b6cc946 /bpf/bpf_test.go | |
parent | f1e6126cb0856451791741c7af4f3c28fadfebf3 (diff) |
Incorporate bpf into mixed builds
Bug: 240163393
Test: TestBpfWithBazel in bpf_test.go
Change-Id: I1d24a9c0d1d6911987c730bf1b5b7e02d6e73a5e
Diffstat (limited to 'bpf/bpf_test.go')
-rw-r--r-- | bpf/bpf_test.go | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/bpf/bpf_test.go b/bpf/bpf_test.go index 6e3909680..a2010ff2f 100644 --- a/bpf/bpf_test.go +++ b/bpf/bpf_test.go @@ -71,3 +71,26 @@ func TestBpfSourceName(t *testing.T) { `\QAndroid.bp:2:3: module "bpf_invalid_name.o" variant "android_common": invalid character '_' in source name\E`)). RunTestWithBp(t, bp) } + +func TestBpfWithBazel(t *testing.T) { + bp := ` + bpf { + name: "bpf.o", + srcs: ["bpf.c"], + bazel_module: { label: "//bpf" }, + } + ` + + result := android.GroupFixturePreparers( + prepareForBpfTest, android.FixtureModifyConfig(func(config android.Config) { + config.BazelContext = android.MockBazelContext{ + OutputBaseDir: "outputbase", + LabelToOutputFiles: map[string][]string{ + "//bpf": []string{"bpf.o"}}} + })).RunTestWithBp(t, bp) + + output := result.Module("bpf.o", "android_common").(*bpf) + + expectedOutputFiles := []string{"outputbase/execroot/__main__/bpf.o"} + android.AssertDeepEquals(t, "output files", expectedOutputFiles, output.objs.Strings()) +} |