Make apex use cc.GatherRequiredDepsForTests

Remove the duplicated native modules from apex_test.go.

Test: all soong tests
Change-Id: Ib88af058d23cf37446d7a4bb571edfb1e0880854
This commit is contained in:
Colin Cross 2020-02-15 11:29:50 -08:00
parent f28329de73
commit f9aabd719a
5 changed files with 63 additions and 174 deletions

View file

@ -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")

View file

@ -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",

View file

@ -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"+

View file

@ -39,6 +39,7 @@ func GatherRequiredDepsForTest(os android.OsType) string {
name: "libatomic",
vendor_available: true,
recovery_available: true,
native_bridge_supported: true,
src: "",
}
@ -53,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: "",
}
@ -60,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: "",
}
@ -67,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: "",
}
@ -74,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: "",
}
@ -117,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: [""],
}
@ -141,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",
@ -153,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",
@ -165,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",
@ -203,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",
@ -228,6 +255,7 @@ func GatherRequiredDepsForTest(os android.OsType) string {
name: "crtbegin_so",
recovery_available: true,
vendor_available: true,
native_bridge_supported: true,
stl: "none",
}
@ -235,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",
}
@ -254,6 +287,8 @@ func GatherRequiredDepsForTest(os android.OsType) string {
name: "crtend_android",
recovery_available: true,
vendor_available: true,
native_bridge_supported: true,
stl: "none",
}
cc_library {

View file

@ -75,6 +75,7 @@ func TestBasicSdkWithCc(t *testing.T) {
cc_library_shared {
name: "sdkmember",
system_shared_libs: [],
}
sdk_snapshot {