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
diff --git a/cc/test_data_test.go b/cc/test_data_test.go
index 962ff26..ae59e2f 100644
--- a/cc/test_data_test.go
+++ b/cc/test_data_test.go
@@ -115,20 +115,17 @@
}
defer os.RemoveAll(buildDir)
- config := android.TestConfig(buildDir, nil)
-
for _, test := range testDataTests {
t.Run(test.name, func(t *testing.T) {
- ctx := android.NewTestContext()
- ctx.MockFileSystem(map[string][]byte{
- "Blueprints": []byte(`subdirs = ["dir"]`),
- "dir/Blueprints": []byte(test.modules),
+ config := android.TestConfig(buildDir, nil, "", map[string][]byte{
+ "dir/Android.bp": []byte(test.modules),
"dir/baz": nil,
"dir/bar/baz": nil,
})
+ ctx := android.NewTestContext()
ctx.RegisterModuleType("filegroup", android.FileGroupFactory)
ctx.RegisterModuleType("test", newTest)
- ctx.Register()
+ ctx.Register(config)
_, errs := ctx.ParseBlueprintsFiles("Blueprints")
android.FailIfErrored(t, errs)