diff options
author | 2020-09-04 00:49:44 +0100 | |
---|---|---|
committer | 2020-09-07 14:59:33 +0000 | |
commit | b309240781b17ee994d088648d5fc76814dde436 (patch) | |
tree | a62c1d3a10063d1b0b4b11b5f128a5f03398fa59 /build/art.go | |
parent | fa37ba22d1e996ad785f94819be286abfae2aae5 (diff) |
Fix libnativeloader unit tests being skipped.
ART_TARGET_ANDROID was only defined in art_defaults, which wasn't
imported into libnativeloader_test. However doing that imports a lot of
stuff, including compiler pickiness that doesn't work with cxxabi.h
included via gtest.h. We instead make ART_TARGET_(ANDROID|LINUX)
implicitly defined in all art_cc_* module types.
These tests have probably not run since https://r.android.com/1295365.
Also fixed the accumulated bitrot.
Test: atest libnativeloader_test, check that 25 tests pass.
Test: Plant a test failure in native_loader_test.cpp, check that
presubmit fails.
Bug: 154074847
Bug: 137356719
Change-Id: I4e9d4dc8d78c91a7b750b8de0ab7db2114b154ac
Diffstat (limited to 'build/art.go')
-rw-r--r-- | build/art.go | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/build/art.go b/build/art.go index 6e9e9fda6e..4d491dcb75 100644 --- a/build/art.go +++ b/build/art.go @@ -132,11 +132,6 @@ func deviceFlags(ctx android.LoadHookContext) []string { ) cflags = append(cflags, "-DART_BASE_ADDRESS="+ctx.Config().LibartImgDeviceBaseAddress()) - if ctx.Config().IsEnvTrue("ART_TARGET_LINUX") { - cflags = append(cflags, "-DART_TARGET_LINUX") - } else { - cflags = append(cflags, "-DART_TARGET_ANDROID") - } minDelta := ctx.Config().GetenvWithDefault("LIBART_IMG_TARGET_MIN_BASE_ADDRESS_DELTA", "-0x1000000") maxDelta := ctx.Config().GetenvWithDefault("LIBART_IMG_TARGET_MAX_BASE_ADDRESS_DELTA", "0x1000000") cflags = append(cflags, "-DART_BASE_ADDRESS_MIN_DELTA="+minDelta) @@ -207,6 +202,26 @@ func globalDefaults(ctx android.LoadHookContext) { ctx.AppendProperties(p) } +// Hook that adds flags that are implicit for all cc_art_* modules. +func addImplicitFlags(ctx android.LoadHookContext) { + type props struct { + Target struct { + Android struct { + Cflags []string + } + } + } + + p := &props{} + if ctx.Config().IsEnvTrue("ART_TARGET_LINUX") { + p.Target.Android.Cflags = []string{"-DART_TARGET", "-DART_TARGET_LINUX"} + } else { + p.Target.Android.Cflags = []string{"-DART_TARGET", "-DART_TARGET_ANDROID"} + } + + ctx.AppendProperties(p) +} + func debugDefaults(ctx android.LoadHookContext) { type props struct { Cflags []string @@ -381,6 +396,7 @@ func artHostTestApexBundleFactory() android.Module { func artGlobalDefaultsFactory() android.Module { module := artDefaultsFactory() + android.AddLoadHook(module, addImplicitFlags) android.AddLoadHook(module, globalDefaults) return module @@ -422,6 +438,7 @@ func artLibrary() android.Module { installCodegenCustomizer(module, staticAndSharedLibrary) + android.AddLoadHook(module, addImplicitFlags) android.AddInstallHook(module, addTestcasesFile) return module } @@ -431,12 +448,14 @@ func artStaticLibrary() android.Module { installCodegenCustomizer(module, staticLibrary) + android.AddLoadHook(module, addImplicitFlags) return module } func artBinary() android.Module { module := cc.BinaryFactory() + android.AddLoadHook(module, addImplicitFlags) android.AddLoadHook(module, customLinker) android.AddLoadHook(module, prefer32Bit) android.AddInstallHook(module, addTestcasesFile) @@ -448,6 +467,7 @@ func artTest() android.Module { installCodegenCustomizer(module, binary) + android.AddLoadHook(module, addImplicitFlags) android.AddLoadHook(module, customLinker) android.AddLoadHook(module, prefer32Bit) android.AddInstallHook(module, testInstall) @@ -459,6 +479,7 @@ func artTestLibrary() android.Module { installCodegenCustomizer(module, staticAndSharedLibrary) + android.AddLoadHook(module, addImplicitFlags) android.AddLoadHook(module, prefer32Bit) android.AddInstallHook(module, testInstall) return module |