Merge "Split TestApexAvailable into separate tests"

This commit is contained in:
Paul Duffin
2020-03-31 09:06:31 +00:00
committed by Gerrit Code Review

View File

@@ -3501,7 +3501,7 @@ func TestApexPropertiesShouldBeDefaultable(t *testing.T) {
}`) }`)
} }
func TestApexAvailable(t *testing.T) { func TestApexAvailable_DirectDep(t *testing.T) {
// libfoo is not available to myapex, but only to otherapex // libfoo is not available to myapex, but only to otherapex
testApexError(t, "requires \"libfoo\" that is not available for the APEX", ` testApexError(t, "requires \"libfoo\" that is not available for the APEX", `
apex { apex {
@@ -3534,7 +3534,9 @@ func TestApexAvailable(t *testing.T) {
system_shared_libs: [], system_shared_libs: [],
apex_available: ["otherapex"], apex_available: ["otherapex"],
}`) }`)
}
func TestApexAvailable_IndirectDep(t *testing.T) {
// libbbaz is an indirect dep // libbbaz is an indirect dep
testApexError(t, "requires \"libbaz\" that is not available for the APEX", ` testApexError(t, "requires \"libbaz\" that is not available for the APEX", `
apex { apex {
@@ -3570,7 +3572,9 @@ func TestApexAvailable(t *testing.T) {
stl: "none", stl: "none",
system_shared_libs: [], system_shared_libs: [],
}`) }`)
}
func TestApexAvailable_InvalidApexName(t *testing.T) {
testApexError(t, "\"otherapex\" is not a valid module name", ` testApexError(t, "\"otherapex\" is not a valid module name", `
apex { apex {
name: "myapex", name: "myapex",
@@ -3591,7 +3595,7 @@ func TestApexAvailable(t *testing.T) {
apex_available: ["otherapex"], apex_available: ["otherapex"],
}`) }`)
ctx, _ := testApex(t, ` testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@@ -3627,7 +3631,9 @@ func TestApexAvailable(t *testing.T) {
versions: ["10", "20", "30"], versions: ["10", "20", "30"],
}, },
}`) }`)
}
func TestApexAvailable_CreatedForPlatform(t *testing.T) {
// check that libfoo and libbar are created only for myapex, but not for the platform // check that libfoo and libbar are created only for myapex, but not for the platform
// TODO(jiyong) the checks for the platform variant are removed because we now create // TODO(jiyong) the checks for the platform variant are removed because we now create
// the platform variant regardless of the apex_availability. Instead, we will make sure that // the platform variant regardless of the apex_availability. Instead, we will make sure that
@@ -3639,7 +3645,7 @@ func TestApexAvailable(t *testing.T) {
// ensureListContains(t, ctx.ModuleVariantsForTests("libbar"), "android_arm64_armv8-a_shared_myapex") // ensureListContains(t, ctx.ModuleVariantsForTests("libbar"), "android_arm64_armv8-a_shared_myapex")
// ensureListNotContains(t, ctx.ModuleVariantsForTests("libbar"), "android_arm64_armv8-a_shared") // ensureListNotContains(t, ctx.ModuleVariantsForTests("libbar"), "android_arm64_armv8-a_shared")
ctx, _ = testApex(t, ` ctx, _ := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@@ -3661,8 +3667,10 @@ func TestApexAvailable(t *testing.T) {
// check that libfoo is created only for the platform // check that libfoo is created only for the platform
ensureListNotContains(t, ctx.ModuleVariantsForTests("libfoo"), "android_arm64_armv8-a_shared_myapex") ensureListNotContains(t, ctx.ModuleVariantsForTests("libfoo"), "android_arm64_armv8-a_shared_myapex")
ensureListContains(t, ctx.ModuleVariantsForTests("libfoo"), "android_arm64_armv8-a_shared") ensureListContains(t, ctx.ModuleVariantsForTests("libfoo"), "android_arm64_armv8-a_shared")
}
ctx, _ = testApex(t, ` func TestApexAvailable_CreatedForApex(t *testing.T) {
testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",