summaryrefslogtreecommitdiff
path: root/java/droidstubs_test.go
diff options
context:
space:
mode:
author Colin Cross <ccross@android.com> 2021-03-24 12:28:50 -0700
committer Colin Cross <ccross@android.com> 2021-03-25 11:11:36 -0700
commit6aa5c40393d03ca697d41f15d2051f03a37ee6cb (patch)
treec3a38ed90aa39ffb28a51114b5673986eb9fe949 /java/droidstubs_test.go
parentcb77f75aaec754644ee6cb8c5ff8befbda30f56b (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.go20
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 {