Prohibit static executable in APEX

If a library is statically included in a static executable, it's
behavior is different from the case where the same library is statically
(or dynamically) linked to a non-static executable. To reduce the number
of test configs that we need to consider, it is required to prohibit
static executables in APEXes.

Bug: 185971244
Test: m
Change-Id: I0cd8fca669d55088e2329fef1f859eeb297502dd
This commit is contained in:
Jiyong Park
2021-07-27 22:42:23 +09:00
parent 6e4950a061
commit 3a8130c797
2 changed files with 57 additions and 3 deletions

View File

@@ -374,7 +374,6 @@ func TestBasicApex(t *testing.T) {
symlinks: ["foo_link_"],
symlink_preferred_arch: true,
system_shared_libs: [],
static_executable: true,
stl: "none",
apex_available: [ "myapex", "com.android.gki.*" ],
}
@@ -2494,7 +2493,6 @@ func TestFilesInSubDir(t *testing.T) {
srcs: ["mylib.cpp"],
relative_install_path: "foo/bar",
system_shared_libs: [],
static_executable: true,
stl: "none",
apex_available: [ "myapex" ],
}
@@ -2554,7 +2552,6 @@ func TestFilesInSubDirWhenNativeBridgeEnabled(t *testing.T) {
name: "mybin",
relative_install_path: "foo/bar",
system_shared_libs: [],
static_executable: true,
stl: "none",
apex_available: [ "myapex" ],
native_bridge_supported: true,
@@ -8188,6 +8185,33 @@ func TestApexJavaCoverage(t *testing.T) {
}
}
func TestProhibitStaticExecutable(t *testing.T) {
testApexError(t, `executable mybin is static`, `
apex {
name: "myapex",
key: "myapex.key",
binaries: ["mybin"],
min_sdk_version: "29",
}
apex_key {
name: "myapex.key",
public_key: "testkey.avbpubkey",
private_key: "testkey.pem",
}
cc_binary {
name: "mybin",
srcs: ["mylib.cpp"],
relative_install_path: "foo/bar",
static_executable: true,
system_shared_libs: [],
stl: "none",
apex_available: [ "myapex" ],
}
`)
}
func TestMain(m *testing.M) {
os.Exit(m.Run())
}