diff options
author | 2020-06-01 09:55:10 +0000 | |
---|---|---|
committer | 2020-06-01 09:55:10 +0000 | |
commit | a6a224586b277aa96659a6f9f024fff2c91ac6a2 (patch) | |
tree | 28f2cb0bc7b16a0bd46fc4e488f272eeb6d34b1c /sdk/cc_sdk_test.go | |
parent | 16fdea928ba6dccbe8cf11bdad999eaec1c8ebec (diff) | |
parent | 7130fabd20530f4809320e38a994f1aba2d39ad7 (diff) |
Merge "Propagate flags necessary for a prebuilt of the Bionic linker."
Diffstat (limited to 'sdk/cc_sdk_test.go')
-rw-r--r-- | sdk/cc_sdk_test.go | 87 |
1 files changed, 86 insertions, 1 deletions
diff --git a/sdk/cc_sdk_test.go b/sdk/cc_sdk_test.go index dded15360..4a090814d 100644 --- a/sdk/cc_sdk_test.go +++ b/sdk/cc_sdk_test.go @@ -401,7 +401,6 @@ func TestSnapshotWithCcBinary(t *testing.T) { "Test.cpp", ], compile_multilib: "both", - stl: "none", } `) @@ -494,6 +493,7 @@ cc_prebuilt_binary { device_supported: false, host_supported: true, installable: false, + stl: "none", target: { linux_glibc: { compile_multilib: "both", @@ -518,6 +518,7 @@ cc_prebuilt_binary { prefer: false, device_supported: false, host_supported: true, + stl: "none", target: { linux_glibc: { compile_multilib: "both", @@ -557,6 +558,90 @@ module_exports_snapshot { ) } +// Test that we support the necessary flags for the linker binary, which is +// special in several ways. +func TestSnapshotWithCcStaticNocrtBinary(t *testing.T) { + // b/145598135 - Generating host snapshots for anything other than linux is not supported. + SkipIfNotLinux(t) + + result := testSdkWithCc(t, ` + module_exports { + name: "mymodule_exports", + host_supported: true, + device_supported: false, + native_binaries: ["linker"], + } + + cc_binary { + name: "linker", + host_supported: true, + static_executable: true, + nocrt: true, + stl: "none", + srcs: [ + "Test.cpp", + ], + compile_multilib: "both", + } + `) + + result.CheckSnapshot("mymodule_exports", "", + checkAndroidBpContents(` +// This is auto-generated. DO NOT EDIT. + +cc_prebuilt_binary { + name: "mymodule_exports_linker@current", + sdk_member_name: "linker", + device_supported: false, + host_supported: true, + installable: false, + stl: "none", + static_executable: true, + nocrt: true, + compile_multilib: "both", + arch: { + x86_64: { + srcs: ["x86_64/bin/linker"], + }, + x86: { + srcs: ["x86/bin/linker"], + }, + }, +} + +cc_prebuilt_binary { + name: "linker", + prefer: false, + device_supported: false, + host_supported: true, + stl: "none", + static_executable: true, + nocrt: true, + compile_multilib: "both", + arch: { + x86_64: { + srcs: ["x86_64/bin/linker"], + }, + x86: { + srcs: ["x86/bin/linker"], + }, + }, +} + +module_exports_snapshot { + name: "mymodule_exports@current", + device_supported: false, + host_supported: true, + native_binaries: ["mymodule_exports_linker@current"], +} +`), + checkAllCopyRules(` +.intermediates/linker/linux_glibc_x86_64/linker -> x86_64/bin/linker +.intermediates/linker/linux_glibc_x86/linker -> x86/bin/linker +`), + ) +} + func TestSnapshotWithCcSharedLibrary(t *testing.T) { result := testSdkWithCc(t, ` sdk { |