diff options
author | 2019-12-13 20:41:13 -0800 | |
---|---|---|
committer | 2019-12-18 08:19:10 -0800 | |
commit | 98be1bb00f0fb10e195f26fd2a19952d701a1950 (patch) | |
tree | abc06a5a4184a6607755d32f927d886c1d099249 /rust/rust_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 'rust/rust_test.go')
-rw-r--r-- | rust/rust_test.go | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/rust/rust_test.go b/rust/rust_test.go index 01b89dbe2..3be9ee7b9 100644 --- a/rust/rust_test.go +++ b/rust/rust_test.go @@ -51,6 +51,19 @@ func TestMain(m *testing.M) { os.Exit(run()) } +func testConfig(bp string) android.Config { + bp = bp + GatherRequiredDepsForTest() + + fs := map[string][]byte{ + "foo.rs": nil, + "src/bar.rs": nil, + "liby.so": nil, + "libz.so": nil, + } + + return android.TestArchConfig(buildDir, nil, bp, fs) +} + func testRust(t *testing.T, bp string) *android.TestContext { // TODO (b/140435149) if runtime.GOOS != "linux" { @@ -58,11 +71,11 @@ func testRust(t *testing.T, bp string) *android.TestContext { } t.Helper() - config := android.TestArchConfig(buildDir, nil) + config := testConfig(bp) t.Helper() - ctx := CreateTestContext(bp) - ctx.Register() + ctx := CreateTestContext() + ctx.Register(config) _, errs := ctx.ParseFileList(".", []string{"Android.bp"}) android.FailIfErrored(t, errs) @@ -79,10 +92,10 @@ func testRustError(t *testing.T, pattern string, bp string) { } t.Helper() - config := android.TestArchConfig(buildDir, nil) + config := testConfig(bp) - ctx := CreateTestContext(bp) - ctx.Register() + ctx := CreateTestContext() + ctx.Register(config) _, errs := ctx.ParseFileList(".", []string{"Android.bp"}) if len(errs) > 0 { |