diff options
author | 2019-12-13 20:41:13 -0800 | |
---|---|---|
committer | 2019-12-18 08:19:10 -0800 | |
commit | 98be1bb00f0fb10e195f26fd2a19952d701a1950 (patch) | |
tree | abc06a5a4184a6607755d32f927d886c1d099249 /android/mutator_test.go | |
parent | 572aeed6a4211d7433cd59fe9c83f34b2fee4f99 (diff) |
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 'android/mutator_test.go')
-rw-r--r-- | android/mutator_test.go | 36 |
1 files changed, 12 insertions, 24 deletions
diff --git a/android/mutator_test.go b/android/mutator_test.go index 2350fdb0a..d179f9d4b 100644 --- a/android/mutator_test.go +++ b/android/mutator_test.go @@ -56,17 +56,6 @@ func addMissingDependenciesMutator(ctx TopDownMutatorContext) { } func TestMutatorAddMissingDependencies(t *testing.T) { - config := TestConfig(buildDir, nil) - config.TestProductVariables.Allow_missing_dependencies = proptools.BoolPtr(true) - - ctx := NewTestContext() - ctx.SetAllowMissingDependencies(true) - - ctx.RegisterModuleType("test", mutatorTestModuleFactory) - ctx.PreDepsMutators(func(ctx RegisterMutatorsContext) { - ctx.TopDown("add_missing_dependencies", addMissingDependenciesMutator) - }) - bp := ` test { name: "foo", @@ -75,13 +64,18 @@ func TestMutatorAddMissingDependencies(t *testing.T) { } ` - mockFS := map[string][]byte{ - "Android.bp": []byte(bp), - } + config := TestConfig(buildDir, nil, bp, nil) + config.TestProductVariables.Allow_missing_dependencies = proptools.BoolPtr(true) - ctx.MockFileSystem(mockFS) + ctx := NewTestContext() + ctx.SetAllowMissingDependencies(true) - ctx.Register() + ctx.RegisterModuleType("test", mutatorTestModuleFactory) + ctx.PreDepsMutators(func(ctx RegisterMutatorsContext) { + ctx.TopDown("add_missing_dependencies", addMissingDependenciesMutator) + }) + + ctx.Register(config) _, errs := ctx.ParseFileList(".", []string{"Android.bp"}) FailIfErrored(t, errs) _, errs = ctx.PrepareBuildActions(config) @@ -139,15 +133,9 @@ func TestModuleString(t *testing.T) { } ` - mockFS := map[string][]byte{ - "Android.bp": []byte(bp), - } - - ctx.MockFileSystem(mockFS) - - ctx.Register() + config := TestConfig(buildDir, nil, bp, nil) - config := TestConfig(buildDir, nil) + ctx.Register(config) _, errs := ctx.ParseFileList(".", []string{"Android.bp"}) FailIfErrored(t, errs) |