diff options
author | 2024-11-20 15:07:58 -0800 | |
---|---|---|
committer | 2024-12-12 14:55:28 -0800 | |
commit | af4c8562a29e152cd473f64e938638b44d57078b (patch) | |
tree | 590129592e5da4dc09a68cf3d5e448ebb79f020c /apex/apex_test.go | |
parent | 8acea3e421fff22567fbbe21f0b91ca85857cf1c (diff) |
Remove TestApexes from ApexInfo
TestApexes is used to enforce the "Stub libraries should have a single
apex_available" check, but requires propagating information from
multiple apexes in order to filter out the test apexes. Instead,
all test apexes used by stub libraries will set apex_available_name
to masquerade as their non-test counterpart for apex_available
checks.
Bug: 383592644
Test: TestStubLibrariesMultipleApexViolation
Change-Id: I57dcf1e6fabbe70f40d702490b93fc7f28d6eba2
Diffstat (limited to 'apex/apex_test.go')
-rw-r--r-- | apex/apex_test.go | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/apex/apex_test.go b/apex/apex_test.go index ced3c46d5..a03bb4492 100644 --- a/apex/apex_test.go +++ b/apex/apex_test.go @@ -10165,9 +10165,9 @@ func TestStubLibrariesMultipleApexViolation(t *testing.T) { expectedError: "Stub libraries should have a single apex_available.*myapex.*otherapex", }, { - desc: "stub library can be available to a core apex and a test apex", + desc: "stub library can be available to a core apex and a test apex using apex_available_name", hasStubs: true, - apexAvailable: `["myapex", "test_myapex"]`, + apexAvailable: `["myapex"]`, }, } bpTemplate := ` @@ -10192,25 +10192,28 @@ func TestStubLibrariesMultipleApexViolation(t *testing.T) { key: "apex.key", updatable: false, native_shared_libs: ["libfoo"], + apex_available_name: "myapex", } apex_key { name: "apex.key", } ` for _, tc := range testCases { - stubs := "" - if tc.hasStubs { - stubs = `stubs: {symbol_file: "libfoo.map.txt"},` - } - bp := fmt.Sprintf(bpTemplate, stubs, tc.apexAvailable) - mockFsFixturePreparer := android.FixtureModifyMockFS(func(fs android.MockFS) { - fs["system/sepolicy/apex/test_myapex-file_contexts"] = nil + t.Run(tc.desc, func(t *testing.T) { + stubs := "" + if tc.hasStubs { + stubs = `stubs: {symbol_file: "libfoo.map.txt"},` + } + bp := fmt.Sprintf(bpTemplate, stubs, tc.apexAvailable) + mockFsFixturePreparer := android.FixtureModifyMockFS(func(fs android.MockFS) { + fs["system/sepolicy/apex/test_myapex-file_contexts"] = nil + }) + if tc.expectedError == "" { + testApex(t, bp, mockFsFixturePreparer) + } else { + testApexError(t, tc.expectedError, bp, mockFsFixturePreparer) + } }) - if tc.expectedError == "" { - testApex(t, bp, mockFsFixturePreparer) - } else { - testApexError(t, tc.expectedError, bp, mockFsFixturePreparer) - } } } |