aboutsummaryrefslogtreecommitdiffstats
path: root/bpf
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2019-12-13 20:41:13 -0800
committerColin Cross <ccross@android.com>2019-12-18 08:19:10 -0800
commit98be1bb00f0fb10e195f26fd2a19952d701a1950 (patch)
treeabc06a5a4184a6607755d32f927d886c1d099249 /bpf
parent572aeed6a4211d7433cd59fe9c83f34b2fee4f99 (diff)
downloadbuild_soong-98be1bb00f0fb10e195f26fd2a19952d701a1950.tar.gz
build_soong-98be1bb00f0fb10e195f26fd2a19952d701a1950.tar.bz2
build_soong-98be1bb00f0fb10e195f26fd2a19952d701a1950.zip
Move filesystem into Config
The filesystem object was available through ModuleContext.Fs(), but gives too much access to the filesystem without enforicing correct dependencies. In order to support sandboxing the soong_build process move the filesystem into the Config. The next change will make it private. Bug: 146437378 Test: all Soong tests Change-Id: I5d3ae9108f120fd335b21efd612aefa078378813
Diffstat (limited to 'bpf')
-rw-r--r--bpf/bpf_test.go15
1 files changed, 10 insertions, 5 deletions
diff --git a/bpf/bpf_test.go b/bpf/bpf_test.go
index 73b90ba0..eeca0577 100644
--- a/bpf/bpf_test.go
+++ b/bpf/bpf_test.go
@@ -48,21 +48,24 @@ func TestMain(m *testing.M) {
os.Exit(run())
}
-func testContext(bp string) *android.TestContext {
+func testConfig(buildDir string, env map[string]string, bp string) android.Config {
mockFS := map[string][]byte{
"bpf.c": nil,
"BpfTest.cpp": nil,
}
- ctx := cc.CreateTestContext(bp, mockFS, android.Android)
+ return cc.TestConfig(buildDir, android.Android, env, bp, mockFS)
+}
+
+func testContext(config android.Config) *android.TestContext {
+ ctx := cc.CreateTestContext()
ctx.RegisterModuleType("bpf", bpfFactory)
- ctx.Register()
+ ctx.Register(config)
return ctx
}
func TestBpfDataDependency(t *testing.T) {
- config := android.TestArchConfig(buildDir, nil)
bp := `
bpf {
name: "bpf.o",
@@ -77,7 +80,9 @@ func TestBpfDataDependency(t *testing.T) {
}
`
- ctx := testContext(bp)
+ config := testConfig(buildDir, nil, bp)
+ ctx := testContext(config)
+
_, errs := ctx.ParseFileList(".", []string{"Android.bp"})
if errs == nil {
_, errs = ctx.PrepareBuildActions(config)