Move NDK test modules into cc/testing.go am: f28329de73
am: 8a9806b3b1
Change-Id: I68825d36d7bf849b7c10d43ce5e12b94d87a7a5c
This commit is contained in:
commit
09bb178aea
7 changed files with 69 additions and 45 deletions
|
@ -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, "", ""},
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue