Move NDK test modules into cc/testing.go
Move the NDK modules defined in app_test.go into cc/testing.go in
preparation for using sdk_version: "current" in more tests.
Test: all soong tests
Change-Id: I80bc31225fb4562fce42781219cefbbd6affae06
diff --git a/cc/testing.go b/cc/testing.go
index 60e5cf5..4aacc05 100644
--- a/cc/testing.go
+++ b/cc/testing.go
@@ -29,6 +29,8 @@
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 @@
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 @@
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 @@
"liba.so": nil,
}
+ GatherRequiredFilesForTest(mockFS)
+
for k, v := range fs {
mockFS[k] = v
}