diff options
author | Jooyung Han <jooyung@google.com> | 2020-03-20 04:29:24 +0900 |
---|---|---|
committer | Jooyung Han <jooyung@google.com> | 2020-03-27 02:58:20 +0900 |
commit | 7406660685a9a085c433ba7081cc6984f66fa732 (patch) | |
tree | 54b46c9089609fd4d15f9b723ddc19f0c2d6ce34 /apex/apex_test.go | |
parent | c3e9263d7efe8ca7638a21ebbeb4f724033409f7 (diff) | |
download | build_soong-7406660685a9a085c433ba7081cc6984f66fa732.tar.gz build_soong-7406660685a9a085c433ba7081cc6984f66fa732.tar.bz2 build_soong-7406660685a9a085c433ba7081cc6984f66fa732.zip |
Enforce apex.min_sdk_version for bundled builds
Previously, when Q-targeting apexes are bundled-built, they are built
against the latest stubs.
It was because unwinder is linked dynamically in R and APIs are provided
by libc while Q apexes should run on Q where libc doesn't provide those
APIs. To make Q apexes run on Q device, libc++ should be linked with
static unwinder. But, because libc++ with static unwinder may cause problem
on HWASAN build, Q apexes were built against the latest stubs for bundled
build.
However, Q apexes should be built against Q stubs.
Now, only for HWASAN builds, Q apexes are built against the latest stubs
(and native modules are not linked with static unwinder).
Bug: 151912436
Test: TARGET_SANITIZE=hwaddress m
=> Q apexes(media, resolv, ..) are linked with the latest stubs
m
=> Q apexes are linked with Q stubs,
and Q apexes' libc++ is linked with static unwinder
Change-Id: If32f1b547e6d93e3955c7521eec8aef5851f908c
Diffstat (limited to 'apex/apex_test.go')
-rw-r--r-- | apex/apex_test.go | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/apex/apex_test.go b/apex/apex_test.go index 704bad69..ba7d9163 100644 --- a/apex/apex_test.go +++ b/apex/apex_test.go @@ -856,7 +856,7 @@ func TestApexDependsOnLLNDKTransitively(t *testing.T) { shouldNotLink []string }{ { - name: "should link to test latest", + name: "should link to the latest", minSdkVersion: "current", shouldLink: "30", shouldNotLink: []string{"29"}, @@ -1196,7 +1196,7 @@ func TestPlatformUsesLatestStubsFromApexes(t *testing.T) { expectNoLink("libz", "shared", "libz", "shared") } -func TestQApexesUseLatestStubsInBundledBuilds(t *testing.T) { +func TestQApexesUseLatestStubsInBundledBuildsAndHWASAN(t *testing.T) { ctx, _ := testApex(t, ` apex { name: "myapex", @@ -1223,16 +1223,18 @@ func TestQApexesUseLatestStubsInBundledBuilds(t *testing.T) { versions: ["29", "30"], }, } - `) + `, func(fs map[string][]byte, config android.Config) { + config.TestProductVariables.SanitizeDevice = []string{"hwaddress"} + }) expectLink := func(from, from_variant, to, to_variant string) { ld := ctx.ModuleForTests(from, "android_arm64_armv8-a_"+from_variant).Rule("ld") libFlags := ld.Args["libFlags"] ensureContains(t, libFlags, "android_arm64_armv8-a_"+to_variant+"/"+to+".so") } - expectLink("libx", "shared_myapex", "libbar", "shared_30") + expectLink("libx", "shared_hwasan_myapex", "libbar", "shared_30") } -func TestQTargetApexUseStaticUnwinder(t *testing.T) { +func TestQTargetApexUsesStaticUnwinder(t *testing.T) { ctx, _ := testApex(t, ` apex { name: "myapex", @@ -1251,8 +1253,7 @@ func TestQTargetApexUseStaticUnwinder(t *testing.T) { name: "libx", apex_available: [ "myapex" ], } - - `, withUnbundledBuild) + `) // ensure apex variant of c++ is linked with static unwinder cm := ctx.ModuleForTests("libc++", "android_arm64_armv8-a_shared_myapex").Module().(*cc.Module) @@ -1263,7 +1264,7 @@ func TestQTargetApexUseStaticUnwinder(t *testing.T) { } func TestInvalidMinSdkVersion(t *testing.T) { - testApexError(t, `"libz" .*: min_sdk_version is set 29.*`, ` + testApexError(t, `"libz" .*: not found a version\(<=29\)`, ` apex { name: "myapex", key: "myapex.key", @@ -1293,9 +1294,9 @@ func TestInvalidMinSdkVersion(t *testing.T) { versions: ["30"], }, } - `, withUnbundledBuild) + `) - testApexError(t, `"myapex" .*: min_sdk_version: should be .*`, ` + testApexError(t, `"myapex" .*: min_sdk_version: should be "current" or <number>`, ` apex { name: "myapex", key: "myapex.key", @@ -1758,7 +1759,7 @@ func TestMacro(t *testing.T) { // non-APEX variant does not have __ANDROID_APEX__ defined mylibCFlags := ctx.ModuleForTests("mylib", "android_arm64_armv8-a_static").Rule("cc").Args["cFlags"] ensureNotContains(t, mylibCFlags, "-D__ANDROID_APEX__") - ensureNotContains(t, mylibCFlags, "-D__ANDROID_SDK_VERSION__=10000") + ensureNotContains(t, mylibCFlags, "-D__ANDROID_SDK_VERSION__") // APEX variant has __ANDROID_APEX__ and __ANDROID_APEX_SDK__ defined mylibCFlags = ctx.ModuleForTests("mylib", "android_arm64_armv8-a_static_myapex").Rule("cc").Args["cFlags"] |