diff options
author | 2021-03-24 12:28:50 -0700 | |
---|---|---|
committer | 2021-03-25 11:11:36 -0700 | |
commit | 6aa5c40393d03ca697d41f15d2051f03a37ee6cb (patch) | |
tree | c3a38ed90aa39ffb28a51114b5673986eb9fe949 /java/droidstubs_test.go | |
parent | cb77f75aaec754644ee6cb8c5ff8befbda30f56b (diff) |
Strengthen metalava sandbox support using sbox
Run sandbox metalava rules inside sbox, which copies only the expected
inputs into a separate directory tree. This ensures it can't read any
extra inputs.
Test: m hwbinder.stubs
Test: TestDroidstubs
Test: TestDroidstubsSandboxed
Change-Id: I71a83e3af6a385cc23f895397c2c883a2ac5fa22
Diffstat (limited to 'java/droidstubs_test.go')
-rw-r--r-- | java/droidstubs_test.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/java/droidstubs_test.go b/java/droidstubs_test.go index d450c1a80..c6db97901 100644 --- a/java/droidstubs_test.go +++ b/java/droidstubs_test.go @@ -15,6 +15,7 @@ package java import ( + "reflect" "strings" "testing" @@ -78,6 +79,25 @@ func TestDroidstubs(t *testing.T) { } } +func TestDroidstubsSandbox(t *testing.T) { + ctx, _ := testJavaWithFS(t, ` + droidstubs { + name: "bar-stubs", + srcs: ["bar-doc/a.java"], + sandbox: true, + } + `, + map[string][]byte{ + "bar-doc/a.java": nil, + }) + + m := ctx.ModuleForTests("bar-stubs", "android_common") + metalava := m.Rule("metalava") + if g, w := metalava.Inputs.Strings(), []string{"bar-doc/a.java"}; !reflect.DeepEqual(w, g) { + t.Errorf("Expected inputs %q, got %q", w, g) + } +} + func TestDroidstubsWithSystemModules(t *testing.T) { ctx, _ := testJava(t, ` droidstubs { |