Add support for test_suites to cc_test_library

Some cc_test_library modules will need to be installed for
compatibility test. This CL adds the capacity to use the
test_suites property to enable this behavior.

Fixes: 226402757
Test: Wrote unit tests, confirmed installation to proper dirs,
      and verified conversion that necessitated this change
Change-Id: I7313d4927d28aacad9e444962fd2a7efc6c3bc1f
This commit is contained in:
Trevor Radcliffe
2022-03-24 21:06:14 +00:00
parent 76ff96f885
commit f389cb4e35
4 changed files with 116 additions and 23 deletions

View File

@@ -779,6 +779,68 @@ func TestDataLibsRelativeInstallPath(t *testing.T) {
}
}
func TestTestBinaryTestSuites(t *testing.T) {
bp := `
cc_test {
name: "main_test",
srcs: ["main_test.cpp"],
test_suites: [
"suite_1",
"suite_2",
],
gtest: false,
}
`
ctx := prepareForCcTest.RunTestWithBp(t, bp).TestContext
module := ctx.ModuleForTests("main_test", "android_arm_armv7-a-neon").Module()
entries := android.AndroidMkEntriesForTest(t, ctx, module)[0]
compatEntries := entries.EntryMap["LOCAL_COMPATIBILITY_SUITE"]
if len(compatEntries) != 2 {
t.Errorf("expected two elements in LOCAL_COMPATIBILITY_SUITE. got %d", len(compatEntries))
}
if compatEntries[0] != "suite_1" {
t.Errorf("expected LOCAL_COMPATIBILITY_SUITE to be`suite_1`,"+
" but was '%s'", compatEntries[0])
}
if compatEntries[1] != "suite_2" {
t.Errorf("expected LOCAL_COMPATIBILITY_SUITE to be`suite_2`,"+
" but was '%s'", compatEntries[1])
}
}
func TestTestLibraryTestSuites(t *testing.T) {
bp := `
cc_test_library {
name: "main_test_lib",
srcs: ["main_test_lib.cpp"],
test_suites: [
"suite_1",
"suite_2",
],
gtest: false,
}
`
ctx := prepareForCcTest.RunTestWithBp(t, bp).TestContext
module := ctx.ModuleForTests("main_test_lib", "android_arm_armv7-a-neon_shared").Module()
entries := android.AndroidMkEntriesForTest(t, ctx, module)[0]
compatEntries := entries.EntryMap["LOCAL_COMPATIBILITY_SUITE"]
if len(compatEntries) != 2 {
t.Errorf("expected two elements in LOCAL_COMPATIBILITY_SUITE. got %d", len(compatEntries))
}
if compatEntries[0] != "suite_1" {
t.Errorf("expected LOCAL_COMPATIBILITY_SUITE to be`suite_1`,"+
" but was '%s'", compatEntries[0])
}
if compatEntries[1] != "suite_2" {
t.Errorf("expected LOCAL_COMPATIBILITY_SUITE to be`suite_2`,"+
" but was '%s'", compatEntries[1])
}
}
func TestVndkWhenVndkVersionIsNotSet(t *testing.T) {
ctx := testCcNoVndk(t, `
cc_library {