diff options
author | 2020-07-09 21:58:57 +0000 | |
---|---|---|
committer | 2020-07-09 21:58:57 +0000 | |
commit | d295daa19a90862d5bac5044b356a9c43074bb4a (patch) | |
tree | 743ef882f7d8316958ad14987bc380857d55821b /java/testing.go | |
parent | 0f472e62f9d679bd4553c06bce2a99bb4d122db9 (diff) | |
parent | e371a18acc20ca53b55bf9784c28608d7ea8bdac (diff) |
Ensure that sdk/module_exports depends on source members am: cee7e66b07 am: e371a18acc
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1359444
Change-Id: If241aea3d4997adfa1edea5e17c35b02f6bc0eb6
Diffstat (limited to 'java/testing.go')
-rw-r--r-- | java/testing.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/java/testing.go b/java/testing.go index 26f12c8ee..4f3f9f160 100644 --- a/java/testing.go +++ b/java/testing.go @@ -16,9 +16,13 @@ package java import ( "fmt" + "reflect" + "sort" + "testing" "android/soong/android" "android/soong/cc" + "github.com/google/blueprint" ) func TestConfig(buildDir string, env map[string]string, bp string, fs map[string][]byte) android.Config { @@ -215,3 +219,17 @@ func GatherRequiredDepsForTest() string { return bp } + +func CheckModuleDependencies(t *testing.T, ctx *android.TestContext, name, variant string, expected []string) { + t.Helper() + module := ctx.ModuleForTests(name, variant).Module() + deps := []string{} + ctx.VisitDirectDeps(module, func(m blueprint.Module) { + deps = append(deps, m.Name()) + }) + sort.Strings(deps) + + if actual := deps; !reflect.DeepEqual(expected, actual) { + t.Errorf("expected %#q, found %#q", expected, actual) + } +} |