soong: Add tests for depending on disabled module
This will check if direct deps of android.Module type is "Enabled()". Previously, this is checked only if a module calls VisitDeps*() functions in GenerateAndroidBuildActions(). Most modules call VisitDeps*() in GenerateAndroidBuildActions(), but some modules don't. For example, "apex" module calls WalkDepsBlueprint() or VisitDirectDepsBlueprint() since it exceptionally depends on non-android.Module modules. Therefore, when an apex module depends on disabled(enabled:false) module, build fails with panic, which is fixed by this change. Test: m # runs soong tests Change-Id: I81c5c148bbd51a253d2904690eb76ae7b6df1a0f
This commit is contained in:
@@ -2264,6 +2264,24 @@ func TestStaticDepsOrderWithStubs(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestErrorsIfAModuleDependsOnDisabled(t *testing.T) {
|
||||
testCcError(t, `module "libA" .* depends on disabled module "libB"`, `
|
||||
cc_library {
|
||||
name: "libA",
|
||||
srcs: ["foo.c"],
|
||||
shared_libs: ["libB"],
|
||||
stl: "none",
|
||||
}
|
||||
|
||||
cc_library {
|
||||
name: "libB",
|
||||
srcs: ["foo.c"],
|
||||
enabled: false,
|
||||
stl: "none",
|
||||
}
|
||||
`)
|
||||
}
|
||||
|
||||
// Simple smoke test for the cc_fuzz target that ensures the rule compiles
|
||||
// correctly.
|
||||
func TestFuzzTarget(t *testing.T) {
|
||||
|
Reference in New Issue
Block a user