Load libbacktrace_test.so explicitly.
This guarantees that the shared library is loaded separately. It allows
this test to be run without depending on the shared library being
somewhere in the system path since the library is now treated as a file
to be dlopen'd.
This also fixes some bugs in the deleted shared library test code. The
previous test was passing when it was really failing. This new test
no longer passes incorrectly. Specifically, the original testlib library
only had a debug_frame on 32 bit host, which is not mapped into memory.
Adding the exceptions option causes a full eh_frame to be generated.
Due to the new dlopen code, also, switching to the new isolated test runner.
Also, changing the memory leak checker to use mallinfo since the new
unwinder allocates everything using the normal allocator. The use
of the isolated runner causes the PSS checker to fail because processes
come and go which changes the PSS distribution to the process doing
the PSS check.
Bug: 109876814
Test: All unit tests pass.
Change-Id: I1b77a783979a8beaae0c0b12823267f363e07977
diff --git a/libbacktrace/Android.bp b/libbacktrace/Android.bp
index c42ae49..43bcd98 100644
--- a/libbacktrace/Android.bp
+++ b/libbacktrace/Android.bp
@@ -27,15 +27,6 @@
enabled: false,
},
},
-
- multilib: {
- lib32: {
- suffix: "32",
- },
- lib64: {
- suffix: "64",
- },
- },
}
libbacktrace_sources = [
@@ -108,7 +99,7 @@
whole_static_libs: ["libdemangle"],
}
-cc_library_shared {
+cc_test_library {
name: "libbacktrace_test",
defaults: ["libbacktrace_common"],
host_supported: true,
@@ -121,6 +112,21 @@
shared_libs: [
"libunwindstack",
],
+ relative_install_path: "backtrace_test_libs",
+
+ target: {
+ linux_glibc: {
+ // The host uses rosegment, which isn't supported yet.
+ ldflags: [
+ "-Wl,--no-rosegment",
+ ],
+ // This forces the creation of eh_frame with unwind information
+ // for host.
+ cflags: [
+ "-fcxx-exceptions"
+ ],
+ },
+ },
}
//-------------------------------------------------------------------------
@@ -128,12 +134,12 @@
//-------------------------------------------------------------------------
cc_test {
name: "backtrace_test",
+ isolated: true,
defaults: ["libbacktrace_common"],
host_supported: true,
srcs: [
"backtrace_offline_test.cpp",
"backtrace_test.cpp",
- "GetPss.cpp",
],
cflags: [
@@ -143,7 +149,6 @@
],
shared_libs: [
- "libbacktrace_test",
"libbacktrace",
"libbase",
"liblog",
@@ -152,17 +157,10 @@
group_static_libs: true,
- target: {
- android: {
- cflags: ["-DENABLE_PSS_TESTS"],
- shared_libs: [
- "libutils",
- ],
- },
- linux_glibc: {
- static_libs: ["libutils"],
- },
- },
+ // So that the dlopen can find the libbacktrace_test.so.
+ ldflags: [
+ "-Wl,--rpath,${ORIGIN}/../backtrace_test_libs",
+ ],
test_suites: ["device-tests"],
data: [