Move NDK test modules into cc/testing.go am: f28329de73

Change-Id: I5500dc262f1ee5cf96762b3b0161688666083531
This commit is contained in:
Automerger Merge Worker 2020-02-20 21:01:23 +00:00
commit 8a9806b3b1
7 changed files with 69 additions and 45 deletions

View File

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

View File

@ -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 {
@ -257,7 +259,50 @@ func GatherRequiredDepsForTest(os android.OsType) string {
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 +318,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 +350,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
}

View File

@ -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 {

View File

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

View File

@ -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
}

View File

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

View File

@ -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
}