Add test for static lib that specifies san

Test: golang tests
Change-Id: Ifd54f3e36f7091e16efbc2fc147b6a3a116ab01c
This commit is contained in:
Liz Kammer
2022-10-28 16:27:13 -04:00
parent 66fc74509f
commit ecc659cc14

View File

@@ -41,6 +41,7 @@ func TestAsan(t *testing.T) {
static_libs: [ static_libs: [
"libstatic", "libstatic",
"libnoasan", "libnoasan",
"libstatic_asan",
], ],
sanitize: { sanitize: {
address: true, address: true,
@@ -57,6 +58,7 @@ func TestAsan(t *testing.T) {
static_libs: [ static_libs: [
"libstatic", "libstatic",
"libnoasan", "libnoasan",
"libstatic_asan",
], ],
} }
@@ -92,6 +94,15 @@ func TestAsan(t *testing.T) {
address: false, address: false,
} }
} }
cc_library_static {
name: "libstatic_asan",
host_supported: true,
sanitize: {
address: true,
}
}
` `
result := android.GroupFixturePreparers( result := android.GroupFixturePreparers(
@@ -125,6 +136,10 @@ func TestAsan(t *testing.T) {
// Static library that never uses asan. // Static library that never uses asan.
libNoAsan := result.ModuleForTests("libnoasan", staticVariant) libNoAsan := result.ModuleForTests("libnoasan", staticVariant)
// Static library that specifies asan
libStaticAsan := result.ModuleForTests("libstatic_asan", staticAsanVariant)
libStaticAsanNoAsanVariant := result.ModuleForTests("libstatic_asan", staticVariant)
// expectSharedLinkDep verifies that the from module links against the to module as a // expectSharedLinkDep verifies that the from module links against the to module as a
// shared library. // shared library.
expectSharedLinkDep := func(from, to android.TestingModule) { expectSharedLinkDep := func(from, to android.TestingModule) {
@@ -176,6 +191,7 @@ func TestAsan(t *testing.T) {
expectStaticLinkDep(binWithAsan, libStaticAsanVariant) expectStaticLinkDep(binWithAsan, libStaticAsanVariant)
expectStaticLinkDep(binWithAsan, libNoAsan) expectStaticLinkDep(binWithAsan, libNoAsan)
expectStaticLinkDep(binWithAsan, libStaticAsan)
expectInstallDep(binWithAsan, libShared) expectInstallDep(binWithAsan, libShared)
expectInstallDep(binWithAsan, libAsan) expectInstallDep(binWithAsan, libAsan)
@@ -190,6 +206,7 @@ func TestAsan(t *testing.T) {
expectStaticLinkDep(binNoAsan, libStaticNoAsanVariant) expectStaticLinkDep(binNoAsan, libStaticNoAsanVariant)
expectStaticLinkDep(binNoAsan, libNoAsan) expectStaticLinkDep(binNoAsan, libNoAsan)
expectStaticLinkDep(binNoAsan, libStaticAsanNoAsanVariant)
expectInstallDep(binNoAsan, libShared) expectInstallDep(binNoAsan, libShared)
expectInstallDep(binNoAsan, libAsan) expectInstallDep(binNoAsan, libAsan)