diff --git a/android/config.go b/android/config.go index 1fe6f058b..32e32ae99 100644 --- a/android/config.go +++ b/android/config.go @@ -265,7 +265,7 @@ func TestArchConfigFuchsia(buildDir string, env map[string]string, bp string, fs config.Targets = map[OsType][]Target{ Fuchsia: []Target{ - {Fuchsia, Arch{ArchType: Arm64, ArchVariant: ""}, NativeBridgeDisabled, "", ""}, + {Fuchsia, Arch{ArchType: Arm64, ArchVariant: "", Abi: []string{"arm64-v8a"}}, NativeBridgeDisabled, "", ""}, }, BuildOs: []Target{ {BuildOs, Arch{ArchType: X86_64}, NativeBridgeDisabled, "", ""}, diff --git a/apex/apex_test.go b/apex/apex_test.go index e5847ab89..7361fc6d3 100644 --- a/apex/apex_test.go +++ b/apex/apex_test.go @@ -99,112 +99,6 @@ func testApexContext(t *testing.T, bp string, handlers ...testCustomizer) (*andr android.ClearApexDependency() bp = bp + ` - toolchain_library { - name: "libcompiler_rt-extras", - src: "", - vendor_available: true, - recovery_available: true, - } - - toolchain_library { - name: "libatomic", - src: "", - vendor_available: true, - recovery_available: true, - native_bridge_supported: true, - } - - toolchain_library { - name: "libgcc", - src: "", - vendor_available: true, - recovery_available: true, - } - - toolchain_library { - name: "libgcc_stripped", - src: "", - vendor_available: true, - recovery_available: true, - native_bridge_supported: true, - } - - toolchain_library { - name: "libclang_rt.builtins-aarch64-android", - src: "", - vendor_available: true, - recovery_available: true, - native_bridge_supported: true, - } - - toolchain_library { - name: "libclang_rt.builtins-arm-android", - src: "", - vendor_available: true, - recovery_available: true, - native_bridge_supported: true, - } - - toolchain_library { - name: "libclang_rt.builtins-x86_64-android", - src: "", - vendor_available: true, - recovery_available: true, - native_bridge_supported: true, - } - - toolchain_library { - name: "libclang_rt.builtins-i686-android", - src: "", - vendor_available: true, - recovery_available: true, - native_bridge_supported: true, - } - - cc_object { - name: "crtbegin_so", - stl: "none", - vendor_available: true, - recovery_available: true, - native_bridge_supported: true, - } - - cc_object { - name: "crtend_so", - stl: "none", - vendor_available: true, - recovery_available: true, - native_bridge_supported: true, - } - - cc_object { - name: "crtbegin_static", - stl: "none", - } - - cc_object { - name: "crtend_android", - stl: "none", - } - - llndk_library { - name: "libc", - symbol_file: "", - native_bridge_supported: true, - } - - llndk_library { - name: "libm", - symbol_file: "", - native_bridge_supported: true, - } - - llndk_library { - name: "libdl", - symbol_file: "", - native_bridge_supported: true, - } - filegroup { name: "myapex-file_contexts", srcs: [ @@ -213,6 +107,8 @@ func testApexContext(t *testing.T, bp string, handlers ...testCustomizer) (*andr } ` + bp = bp + cc.GatherRequiredDepsForTest(android.Android) + bp = bp + java.GatherRequiredDepsForTest() fs := map[string][]byte{ @@ -259,6 +155,8 @@ func testApexContext(t *testing.T, bp string, handlers ...testCustomizer) (*andr "dummy.txt": nil, } + cc.GatherRequiredFilesForTest(fs) + for _, handler := range handlers { // The fs now needs to be populated before creating the config, call handlers twice // for now, once to get any fs changes, and later after the config was created to @@ -1013,47 +911,6 @@ func TestApexWithSystemLibsStubs(t *testing.T) { apex_available: [ "myapex" ], } - cc_library { - name: "libc", - no_libcrt: true, - nocrt: true, - system_shared_libs: [], - stl: "none", - stubs: { - versions: ["27", "28", "29"], - }, - } - - cc_library { - name: "libm", - no_libcrt: true, - nocrt: true, - system_shared_libs: [], - stl: "none", - stubs: { - versions: ["27", "28", "29"], - }, - apex_available: [ - "//apex_available:platform", - "myapex" - ], - } - - cc_library { - name: "libdl", - no_libcrt: true, - nocrt: true, - system_shared_libs: [], - stl: "none", - stubs: { - versions: ["27", "28", "29"], - }, - apex_available: [ - "//apex_available:platform", - "myapex" - ], - } - cc_library { name: "libBootstrap", srcs: ["mylib.cpp"], @@ -3455,28 +3312,6 @@ func TestLegacyAndroid10Support(t *testing.T) { system_shared_libs: [], apex_available: [ "myapex" ], } - - cc_library { - name: "libc++", - srcs: ["mylib.cpp"], - stl: "none", - system_shared_libs: [], - apex_available: [ "myapex" ], - } - - cc_library_static { - name: "libc++demangle", - srcs: ["mylib.cpp"], - stl: "none", - system_shared_libs: [], - } - - cc_library_static { - name: "libunwind_llvm", - srcs: ["mylib.cpp"], - stl: "none", - system_shared_libs: [], - } `, withUnbundledBuild) module := ctx.ModuleForTests("myapex", "android_common_myapex_image") diff --git a/apex/vndk_test.go b/apex/vndk_test.go index dd08f0342..a9e26adc8 100644 --- a/apex/vndk_test.go +++ b/apex/vndk_test.go @@ -68,6 +68,7 @@ func TestVndkApexUsesVendorVariant(t *testing.T) { cc_library { name: "libprofile-extras", vendor_available: true, + recovery_available: true, native_coverage: false, system_shared_libs: [], stl: "none", @@ -76,6 +77,23 @@ func TestVndkApexUsesVendorVariant(t *testing.T) { cc_library { name: "libprofile-clang-extras", vendor_available: true, + recovery_available: true, + native_coverage: false, + system_shared_libs: [], + stl: "none", + notice: "custom_notice", + } + cc_library { + name: "libprofile-extras_ndk", + vendor_available: true, + native_coverage: false, + system_shared_libs: [], + stl: "none", + notice: "custom_notice", + } + cc_library { + name: "libprofile-clang-extras_ndk", + vendor_available: true, native_coverage: false, system_shared_libs: [], stl: "none", diff --git a/cc/cc_test.go b/cc/cc_test.go index b78f1f366..30ba733f5 100644 --- a/cc/cc_test.go +++ b/cc/cc_test.go @@ -2674,20 +2674,20 @@ func TestStaticDepsOrderWithStubs(t *testing.T) { cc_binary { name: "mybin", srcs: ["foo.c"], - static_libs: ["libB"], + static_libs: ["libfooB"], static_executable: true, stl: "none", } cc_library { - name: "libB", + name: "libfooB", srcs: ["foo.c"], - shared_libs: ["libC"], + shared_libs: ["libfooC"], stl: "none", } cc_library { - name: "libC", + name: "libfooC", srcs: ["foo.c"], stl: "none", stubs: { @@ -2697,7 +2697,7 @@ func TestStaticDepsOrderWithStubs(t *testing.T) { mybin := ctx.ModuleForTests("mybin", "android_arm64_armv8-a").Module().(*Module) actual := mybin.depsInLinkOrder - expected := getOutputPaths(ctx, "android_arm64_armv8-a_static", []string{"libB", "libC"}) + expected := getOutputPaths(ctx, "android_arm64_armv8-a_static", []string{"libfooB", "libfooC"}) if !reflect.DeepEqual(actual, expected) { t.Errorf("staticDeps orderings were not propagated correctly"+ diff --git a/cc/testing.go b/cc/testing.go index 60e5cf596..7b0305f64 100644 --- a/cc/testing.go +++ b/cc/testing.go @@ -29,6 +29,8 @@ func RegisterRequiredBuildComponentsForTest(ctx android.RegistrationContext) { ctx.RegisterModuleType("toolchain_library", ToolchainLibraryFactory) ctx.RegisterModuleType("llndk_library", LlndkLibraryFactory) ctx.RegisterModuleType("cc_object", ObjectFactory) + ctx.RegisterModuleType("ndk_prebuilt_shared_stl", NdkPrebuiltSharedStlFactory) + ctx.RegisterModuleType("ndk_prebuilt_object", NdkPrebuiltObjectFactory) } func GatherRequiredDepsForTest(os android.OsType) string { @@ -37,6 +39,7 @@ func GatherRequiredDepsForTest(os android.OsType) string { name: "libatomic", vendor_available: true, recovery_available: true, + native_bridge_supported: true, src: "", } @@ -51,6 +54,7 @@ func GatherRequiredDepsForTest(os android.OsType) string { name: "libclang_rt.builtins-arm-android", vendor_available: true, recovery_available: true, + native_bridge_supported: true, src: "", } @@ -58,6 +62,7 @@ func GatherRequiredDepsForTest(os android.OsType) string { name: "libclang_rt.builtins-aarch64-android", vendor_available: true, recovery_available: true, + native_bridge_supported: true, src: "", } @@ -65,6 +70,7 @@ func GatherRequiredDepsForTest(os android.OsType) string { name: "libclang_rt.builtins-i686-android", vendor_available: true, recovery_available: true, + native_bridge_supported: true, src: "", } @@ -72,6 +78,7 @@ func GatherRequiredDepsForTest(os android.OsType) string { name: "libclang_rt.builtins-x86_64-android", vendor_available: true, recovery_available: true, + native_bridge_supported: true, src: "", } @@ -115,6 +122,7 @@ func GatherRequiredDepsForTest(os android.OsType) string { name: "libclang_rt.ubsan_standalone-aarch64-android", vendor_available: true, recovery_available: true, + system_shared_libs: [], srcs: [""], } @@ -139,6 +147,9 @@ func GatherRequiredDepsForTest(os android.OsType) string { stl: "none", system_shared_libs: [], recovery_available: true, + stubs: { + versions: ["27", "28", "29"], + }, } llndk_library { name: "libc", @@ -151,6 +162,13 @@ func GatherRequiredDepsForTest(os android.OsType) string { stl: "none", system_shared_libs: [], recovery_available: true, + stubs: { + versions: ["27", "28", "29"], + }, + apex_available: [ + "//apex_available:platform", + "myapex" + ], } llndk_library { name: "libm", @@ -163,6 +181,13 @@ func GatherRequiredDepsForTest(os android.OsType) string { stl: "none", system_shared_libs: [], recovery_available: true, + stubs: { + versions: ["27", "28", "29"], + }, + apex_available: [ + "//apex_available:platform", + "myapex" + ], } llndk_library { name: "libdl", @@ -201,6 +226,10 @@ func GatherRequiredDepsForTest(os android.OsType) string { enabled: true, support_system_process: true, }, + apex_available: [ + "//apex_available:platform", + "myapex" + ], } cc_library { name: "libc++demangle", @@ -226,6 +255,7 @@ func GatherRequiredDepsForTest(os android.OsType) string { name: "crtbegin_so", recovery_available: true, vendor_available: true, + native_bridge_supported: true, stl: "none", } @@ -233,18 +263,23 @@ func GatherRequiredDepsForTest(os android.OsType) string { name: "crtbegin_dynamic", recovery_available: true, vendor_available: true, + native_bridge_supported: true, + stl: "none", } cc_object { name: "crtbegin_static", recovery_available: true, vendor_available: true, + native_bridge_supported: true, + stl: "none", } cc_object { name: "crtend_so", recovery_available: true, vendor_available: true, + native_bridge_supported: true, stl: "none", } @@ -252,12 +287,57 @@ func GatherRequiredDepsForTest(os android.OsType) string { name: "crtend_android", recovery_available: true, vendor_available: true, + native_bridge_supported: true, + stl: "none", } cc_library { name: "libprotobuf-cpp-lite", } - ` + + cc_library { + name: "ndk_libunwind", + sdk_version: "current", + stl: "none", + system_shared_libs: [], + } + + cc_library { + name: "libc.ndk.current", + sdk_version: "current", + stl: "none", + system_shared_libs: [], + } + + cc_library { + name: "libm.ndk.current", + sdk_version: "current", + stl: "none", + system_shared_libs: [], + } + + cc_library { + name: "libdl.ndk.current", + sdk_version: "current", + stl: "none", + system_shared_libs: [], + } + + ndk_prebuilt_object { + name: "ndk_crtbegin_so.27", + sdk_version: "27", + } + + ndk_prebuilt_object { + name: "ndk_crtend_so.27", + sdk_version: "27", + } + + ndk_prebuilt_shared_stl { + name: "ndk_libc++_shared", + } + ` + if os == android.Fuchsia { ret += ` cc_library { @@ -273,6 +353,18 @@ func GatherRequiredDepsForTest(os android.OsType) string { return ret } +func GatherRequiredFilesForTest(fs map[string][]byte) { + fs["prebuilts/ndk/current/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++_shared.so"] = nil + fs["prebuilts/ndk/current/platforms/android-27/arch-arm/usr/lib/crtbegin_so.o"] = nil + fs["prebuilts/ndk/current/platforms/android-27/arch-arm/usr/lib/crtend_so.o"] = nil + fs["prebuilts/ndk/current/platforms/android-27/arch-arm64/usr/lib/crtbegin_so.o"] = nil + fs["prebuilts/ndk/current/platforms/android-27/arch-arm64/usr/lib/crtend_so.o"] = nil + fs["prebuilts/ndk/current/platforms/android-27/arch-x86/usr/lib/crtbegin_so.o"] = nil + fs["prebuilts/ndk/current/platforms/android-27/arch-x86/usr/lib/crtend_so.o"] = nil + fs["prebuilts/ndk/current/platforms/android-27/arch-x86_64/usr/lib64/crtbegin_so.o"] = nil + fs["prebuilts/ndk/current/platforms/android-27/arch-x86_64/usr/lib64/crtend_so.o"] = nil +} + func TestConfig(buildDir string, os android.OsType, env map[string]string, bp string, fs map[string][]byte) android.Config { @@ -293,6 +385,8 @@ func TestConfig(buildDir string, os android.OsType, env map[string]string, "liba.so": nil, } + GatherRequiredFilesForTest(mockFS) + for k, v := range fs { mockFS[k] = v } diff --git a/java/app_test.go b/java/app_test.go index 6d94160fa..dfd85711b 100644 --- a/java/app_test.go +++ b/java/app_test.go @@ -1858,42 +1858,6 @@ func TestAndroidTestImport_NoJinUncompressForPresigned(t *testing.T) { func TestStl(t *testing.T) { ctx, _ := testJava(t, cc.GatherRequiredDepsForTest(android.Android)+` - cc_library { - name: "ndk_libunwind", - sdk_version: "current", - stl: "none", - system_shared_libs: [], - } - - cc_library { - name: "libc.ndk.current", - sdk_version: "current", - stl: "none", - system_shared_libs: [], - } - - cc_library { - name: "libm.ndk.current", - sdk_version: "current", - stl: "none", - system_shared_libs: [], - } - - cc_library { - name: "libdl.ndk.current", - sdk_version: "current", - stl: "none", - system_shared_libs: [], - } - - cc_object { - name: "ndk_crtbegin_so.27", - } - - cc_object { - name: "ndk_crtend_so.27", - } - cc_library { name: "libjni", sdk_version: "current", @@ -1914,10 +1878,6 @@ func TestStl(t *testing.T) { compile_multilib: "both", sdk_version: "current", } - - ndk_prebuilt_shared_stl { - name: "ndk_libc++_shared", - } `) testCases := []struct { diff --git a/java/java_test.go b/java/java_test.go index 7c066998d..6d972bebd 100644 --- a/java/java_test.go +++ b/java/java_test.go @@ -92,7 +92,6 @@ func testContext() *android.TestContext { // Register module types and mutators from cc needed for JNI testing cc.RegisterRequiredBuildComponentsForTest(ctx) - ctx.RegisterModuleType("ndk_prebuilt_shared_stl", cc.NdkPrebuiltSharedStlFactory) dexpreopt.RegisterToolModulesForTest(ctx) diff --git a/java/testing.go b/java/testing.go index 3111109a5..5b6a39b2a 100644 --- a/java/testing.go +++ b/java/testing.go @@ -18,6 +18,7 @@ import ( "fmt" "android/soong/android" + "android/soong/cc" ) func TestConfig(buildDir string, env map[string]string, bp string, fs map[string][]byte) android.Config { @@ -52,8 +53,6 @@ func TestConfig(buildDir string, env map[string]string, bp string, fs map[string "assets_a/a": nil, "assets_b/b": nil, - "prebuilts/ndk/current/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++_shared.so": nil, - "prebuilts/sdk/14/public/android.jar": nil, "prebuilts/sdk/14/public/framework.aidl": nil, "prebuilts/sdk/14/system/android.jar": nil, @@ -122,6 +121,8 @@ func TestConfig(buildDir string, env map[string]string, bp string, fs map[string "stubs/sources/foo/Foo.java": nil, } + cc.GatherRequiredFilesForTest(mockFS) + for k, v := range fs { mockFS[k] = v } diff --git a/rust/rust_test.go b/rust/rust_test.go index afe530abf..020581dfc 100644 --- a/rust/rust_test.go +++ b/rust/rust_test.go @@ -22,6 +22,7 @@ import ( "testing" "android/soong/android" + "android/soong/cc" ) var ( @@ -61,6 +62,8 @@ func testConfig(bp string) android.Config { "libz.so": nil, } + cc.GatherRequiredFilesForTest(fs) + return android.TestArchConfig(buildDir, nil, bp, fs) } diff --git a/sdk/cc_sdk_test.go b/sdk/cc_sdk_test.go index 8c32d8cad..9c8e29206 100644 --- a/sdk/cc_sdk_test.go +++ b/sdk/cc_sdk_test.go @@ -75,6 +75,7 @@ func TestBasicSdkWithCc(t *testing.T) { cc_library_shared { name: "sdkmember", + system_shared_libs: [], } sdk_snapshot { diff --git a/sdk/testing.go b/sdk/testing.go index 610244194..ae0620d83 100644 --- a/sdk/testing.go +++ b/sdk/testing.go @@ -53,6 +53,8 @@ func testSdkContext(bp string, fs map[string][]byte) (*android.TestContext, andr "myapex.pk8": nil, } + cc.GatherRequiredFilesForTest(mockFS) + for k, v := range fs { mockFS[k] = v }