summaryrefslogtreecommitdiff
path: root/apex/apex_test.go
diff options
context:
space:
mode:
author Colin Cross <ccross@android.com> 2020-09-15 18:30:11 -0700
committer Colin Cross <ccross@android.com> 2020-10-06 13:39:57 -0700
commit56a8321c210bf73c7b9f177849ff4a6b6192d237 (patch)
tree493b42599afe8b2f4cc849107e5541f8307b7b10 /apex/apex_test.go
parenta8baa884240d22fb2b896e714e2bdf28e735f332 (diff)
Remove global state from apex modules
A global variant was used to store the global mapping between modules and APEXes. Replace it with storing pointers to APEX contents inside each module so that they can query the contents of any APEXes they belong to. Bug: 146393795 Test: all Soong tests Test: single line change to build.ninja host install dependency ordering Test: no Android-${TARGET_PRODUCT}.mk, make_vars-${TARGET_PRODUCT}.mk or late-${TARGET_PRODUCT}.mk Change-Id: Id2d7b73ea27f8c3b41d30820bdd86b65c539bfa4
Diffstat (limited to 'apex/apex_test.go')
-rw-r--r--apex/apex_test.go10
1 files changed, 3 insertions, 7 deletions
diff --git a/apex/apex_test.go b/apex/apex_test.go
index 71c4aa268..cf2c9533b 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -125,8 +125,6 @@ func withUnbundledBuild(_ map[string][]byte, config android.Config) {
}
func testApexContext(_ *testing.T, bp string, handlers ...testCustomizer) (*android.TestContext, android.Config) {
- android.ClearApexDependency()
-
bp = bp + `
filegroup {
name: "myapex-file_contexts",
@@ -1607,10 +1605,12 @@ func TestPlatformUsesLatestStubsFromApexes(t *testing.T) {
`)
expectLink := func(from, from_variant, to, to_variant string) {
+ t.Helper()
ldArgs := ctx.ModuleForTests(from, "android_arm64_armv8-a_"+from_variant).Rule("ld").Args["libFlags"]
ensureContains(t, ldArgs, "android_arm64_armv8-a_"+to_variant+"/"+to+".so")
}
expectNoLink := func(from, from_variant, to, to_variant string) {
+ t.Helper()
ldArgs := ctx.ModuleForTests(from, "android_arm64_armv8-a_"+from_variant).Rule("ld").Args["libFlags"]
ensureNotContains(t, ldArgs, "android_arm64_armv8-a_"+to_variant+"/"+to+".so")
}
@@ -3643,16 +3643,13 @@ func TestNonTestApex(t *testing.T) {
// Ensure that the platform variant ends with _shared
ensureListContains(t, ctx.ModuleVariantsForTests("mylib_common"), "android_arm64_armv8-a_shared")
- if !android.InAnyApex("mylib_common") {
+ if !ctx.ModuleForTests("mylib_common", "android_arm64_armv8-a_shared_apex10000").Module().(*cc.Module).InAnyApex() {
t.Log("Found mylib_common not in any apex!")
t.Fail()
}
}
func TestTestApex(t *testing.T) {
- if android.InAnyApex("mylib_common_test") {
- t.Fatal("mylib_common_test must not be used in any other tests since this checks that global state is not updated in an illegal way!")
- }
ctx, _ := testApex(t, `
apex_test {
name: "myapex",
@@ -5845,7 +5842,6 @@ func TestNoUpdatableJarsInBootImage(t *testing.T) {
func testApexPermittedPackagesRules(t *testing.T, errmsg, bp string, apexBootJars []string, rules []android.Rule) {
t.Helper()
- android.ClearApexDependency()
bp += `
apex_key {
name: "myapex.key",