Merge "Improve cc tests by adding sanitizer mutators"
This commit is contained in:
@@ -288,7 +288,6 @@ func testApexContext(t *testing.T, bp string, handlers ...testCustomizer) (*andr
|
|||||||
|
|
||||||
ctx.RegisterModuleType("cc_library_shared", cc.LibrarySharedFactory)
|
ctx.RegisterModuleType("cc_library_shared", cc.LibrarySharedFactory)
|
||||||
ctx.RegisterModuleType("cc_library_headers", cc.LibraryHeaderFactory)
|
ctx.RegisterModuleType("cc_library_headers", cc.LibraryHeaderFactory)
|
||||||
cc.RegisterPrebuiltBuildComponents(ctx)
|
|
||||||
cc.RegisterRequiredBuildComponentsForTest(ctx)
|
cc.RegisterRequiredBuildComponentsForTest(ctx)
|
||||||
ctx.RegisterModuleType("cc_binary", cc.BinaryFactory)
|
ctx.RegisterModuleType("cc_binary", cc.BinaryFactory)
|
||||||
ctx.RegisterModuleType("cc_defaults", func() android.Module {
|
ctx.RegisterModuleType("cc_defaults", func() android.Module {
|
||||||
@@ -305,7 +304,6 @@ func testApexContext(t *testing.T, bp string, handlers ...testCustomizer) (*andr
|
|||||||
java.RegisterAppBuildComponents(ctx)
|
java.RegisterAppBuildComponents(ctx)
|
||||||
|
|
||||||
ctx.PreArchMutators(android.RegisterDefaultsPreArchMutators)
|
ctx.PreArchMutators(android.RegisterDefaultsPreArchMutators)
|
||||||
android.RegisterPrebuiltMutators(ctx)
|
|
||||||
ctx.PreDepsMutators(RegisterPreDepsMutators)
|
ctx.PreDepsMutators(RegisterPreDepsMutators)
|
||||||
ctx.PostDepsMutators(android.RegisterOverridePostDepsMutators)
|
ctx.PostDepsMutators(android.RegisterOverridePostDepsMutators)
|
||||||
ctx.PostDepsMutators(RegisterPostDepsMutators)
|
ctx.PostDepsMutators(RegisterPostDepsMutators)
|
||||||
|
@@ -72,10 +72,6 @@ func TestPrebuilt(t *testing.T) {
|
|||||||
|
|
||||||
ctx := CreateTestContext()
|
ctx := CreateTestContext()
|
||||||
|
|
||||||
RegisterPrebuiltBuildComponents(ctx)
|
|
||||||
|
|
||||||
android.RegisterPrebuiltMutators(ctx)
|
|
||||||
|
|
||||||
ctx.Register(config)
|
ctx.Register(config)
|
||||||
|
|
||||||
_, errs := ctx.ParseFileList(".", []string{"Android.bp"})
|
_, errs := ctx.ParseFileList(".", []string{"Android.bp"})
|
||||||
|
@@ -19,11 +19,13 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func RegisterRequiredBuildComponentsForTest(ctx android.RegistrationContext) {
|
func RegisterRequiredBuildComponentsForTest(ctx android.RegistrationContext) {
|
||||||
|
RegisterPrebuiltBuildComponents(ctx)
|
||||||
ctx.RegisterModuleType("toolchain_library", ToolchainLibraryFactory)
|
ctx.RegisterModuleType("toolchain_library", ToolchainLibraryFactory)
|
||||||
ctx.RegisterModuleType("cc_library", LibraryFactory)
|
ctx.RegisterModuleType("cc_library", LibraryFactory)
|
||||||
ctx.RegisterModuleType("llndk_library", LlndkLibraryFactory)
|
ctx.RegisterModuleType("llndk_library", LlndkLibraryFactory)
|
||||||
ctx.RegisterModuleType("cc_object", ObjectFactory)
|
ctx.RegisterModuleType("cc_object", ObjectFactory)
|
||||||
|
|
||||||
|
android.RegisterPrebuiltMutators(ctx)
|
||||||
ctx.PreDepsMutators(func(ctx android.RegisterMutatorsContext) {
|
ctx.PreDepsMutators(func(ctx android.RegisterMutatorsContext) {
|
||||||
ctx.BottomUp("vndk", VndkMutator).Parallel()
|
ctx.BottomUp("vndk", VndkMutator).Parallel()
|
||||||
ctx.BottomUp("link", LinkageMutator).Parallel()
|
ctx.BottomUp("link", LinkageMutator).Parallel()
|
||||||
@@ -33,6 +35,10 @@ func RegisterRequiredBuildComponentsForTest(ctx android.RegistrationContext) {
|
|||||||
ctx.BottomUp("begin", BeginMutator).Parallel()
|
ctx.BottomUp("begin", BeginMutator).Parallel()
|
||||||
ctx.BottomUp("sysprop_cc", SyspropMutator).Parallel()
|
ctx.BottomUp("sysprop_cc", SyspropMutator).Parallel()
|
||||||
})
|
})
|
||||||
|
ctx.PostDepsMutators(func(ctx android.RegisterMutatorsContext) {
|
||||||
|
ctx.TopDown("sanitize_runtime_deps", sanitizerRuntimeDepsMutator).Parallel()
|
||||||
|
ctx.BottomUp("sanitize_runtime", sanitizerRuntimeMutator).Parallel()
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func GatherRequiredDepsForTest(os android.OsType) string {
|
func GatherRequiredDepsForTest(os android.OsType) string {
|
||||||
@@ -114,6 +120,14 @@ func GatherRequiredDepsForTest(os android.OsType) string {
|
|||||||
src: "",
|
src: "",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Needed for sanitizer
|
||||||
|
cc_prebuilt_library_shared {
|
||||||
|
name: "libclang_rt.ubsan_standalone-aarch64-android",
|
||||||
|
vendor_available: true,
|
||||||
|
recovery_available: true,
|
||||||
|
srcs: [""],
|
||||||
|
}
|
||||||
|
|
||||||
toolchain_library {
|
toolchain_library {
|
||||||
name: "libgcc",
|
name: "libgcc",
|
||||||
vendor_available: true,
|
vendor_available: true,
|
||||||
|
@@ -74,7 +74,6 @@ func testContext() *android.TestContext {
|
|||||||
RegisterDocsBuildComponents(ctx)
|
RegisterDocsBuildComponents(ctx)
|
||||||
RegisterStubsBuildComponents(ctx)
|
RegisterStubsBuildComponents(ctx)
|
||||||
RegisterSdkLibraryBuildComponents(ctx)
|
RegisterSdkLibraryBuildComponents(ctx)
|
||||||
android.RegisterPrebuiltMutators(ctx)
|
|
||||||
ctx.PreArchMutators(android.RegisterDefaultsPreArchMutators)
|
ctx.PreArchMutators(android.RegisterDefaultsPreArchMutators)
|
||||||
|
|
||||||
RegisterPrebuiltApisBuildComponents(ctx)
|
RegisterPrebuiltApisBuildComponents(ctx)
|
||||||
|
@@ -68,7 +68,6 @@ func testSdkContext(bp string, fs map[string][]byte) (*android.TestContext, andr
|
|||||||
ctx.PreArchMutators(android.RegisterVisibilityRuleGatherer)
|
ctx.PreArchMutators(android.RegisterVisibilityRuleGatherer)
|
||||||
ctx.PostDepsMutators(android.RegisterVisibilityRuleEnforcer)
|
ctx.PostDepsMutators(android.RegisterVisibilityRuleEnforcer)
|
||||||
|
|
||||||
android.RegisterPrebuiltMutators(ctx)
|
|
||||||
ctx.RegisterModuleType("package", android.PackageFactory)
|
ctx.RegisterModuleType("package", android.PackageFactory)
|
||||||
|
|
||||||
// from java package
|
// from java package
|
||||||
@@ -80,7 +79,6 @@ func testSdkContext(bp string, fs map[string][]byte) (*android.TestContext, andr
|
|||||||
cc.RegisterRequiredBuildComponentsForTest(ctx)
|
cc.RegisterRequiredBuildComponentsForTest(ctx)
|
||||||
ctx.RegisterModuleType("cc_library_shared", cc.LibrarySharedFactory)
|
ctx.RegisterModuleType("cc_library_shared", cc.LibrarySharedFactory)
|
||||||
ctx.RegisterModuleType("cc_library_static", cc.LibraryStaticFactory)
|
ctx.RegisterModuleType("cc_library_static", cc.LibraryStaticFactory)
|
||||||
cc.RegisterPrebuiltBuildComponents(ctx)
|
|
||||||
|
|
||||||
// from apex package
|
// from apex package
|
||||||
ctx.RegisterModuleType("apex", apex.BundleFactory)
|
ctx.RegisterModuleType("apex", apex.BundleFactory)
|
||||||
|
@@ -60,7 +60,6 @@ func testContext(config android.Config) *android.TestContext {
|
|||||||
java.RegisterAppBuildComponents(ctx)
|
java.RegisterAppBuildComponents(ctx)
|
||||||
java.RegisterSystemModulesBuildComponents(ctx)
|
java.RegisterSystemModulesBuildComponents(ctx)
|
||||||
|
|
||||||
android.RegisterPrebuiltMutators(ctx)
|
|
||||||
ctx.PreArchMutators(android.RegisterDefaultsPreArchMutators)
|
ctx.PreArchMutators(android.RegisterDefaultsPreArchMutators)
|
||||||
ctx.PreArchMutators(func(ctx android.RegisterMutatorsContext) {
|
ctx.PreArchMutators(func(ctx android.RegisterMutatorsContext) {
|
||||||
ctx.BottomUp("sysprop_deps", syspropDepsMutator).Parallel()
|
ctx.BottomUp("sysprop_deps", syspropDepsMutator).Parallel()
|
||||||
|
Reference in New Issue
Block a user