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/android/sh_binary_test.go b/android/sh_binary_test.go
index 8488fe4..137e773 100644
--- a/android/sh_binary_test.go
+++ b/android/sh_binary_test.go
@@ -6,19 +6,18 @@
)
func testShBinary(t *testing.T, bp string) (*TestContext, Config) {
- config := TestArchConfig(buildDir, nil)
-
- ctx := NewTestArchContext()
- ctx.RegisterModuleType("sh_test", ShTestFactory)
- ctx.RegisterModuleType("sh_test_host", ShTestHostFactory)
- ctx.Register()
- mockFiles := map[string][]byte{
- "Android.bp": []byte(bp),
+ fs := map[string][]byte{
"test.sh": nil,
"testdata/data1": nil,
"testdata/sub/data2": nil,
}
- ctx.MockFileSystem(mockFiles)
+
+ config := TestArchConfig(buildDir, nil, bp, fs)
+
+ ctx := NewTestArchContext()
+ ctx.RegisterModuleType("sh_test", ShTestFactory)
+ ctx.RegisterModuleType("sh_test_host", ShTestHostFactory)
+ ctx.Register(config)
_, errs := ctx.ParseFileList(".", []string{"Android.bp"})
FailIfErrored(t, errs)
_, errs = ctx.PrepareBuildActions(config)