Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions tests/GosCompatTests/GosCompatMemoryTests/Android.bp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
cc_binary {
name: "goscompat_smaps_native_runner",
srcs: [
"native/simple_smaps_parser.cpp",
"native/smaps_parser_native_runner.cpp",
],
local_include_dirs: [
"native",
],
cflags: [
"-std=c++17",
"-Wall",
"-Wextra",
"-Werror",
"-fexceptions",
],
stl: "c++_static",
}

java_test_host {
name: "GosCompatMemoryTests",
srcs: [
"host/src/**/*.java",
":libtombstone_proto-src",
],
libs: [
"tradefed",
],
device_first_data: [
":goscompat_smaps_native_runner",
],
test_config: "NativeAndroidTest.xml",
test_suites: ["general-tests"],
}
11 changes: 11 additions & 0 deletions tests/GosCompatTests/GosCompatMemoryTests/NativeAndroidTest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration description="Runs GosCompatMemoryTests">
<target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
<option name="cleanup" value="true" />
<option name="push" value="goscompat_smaps_native_runner->/data/local/tmp/goscompat_smaps_native_runner" />
</target_preparer>

<test class="com.android.tradefed.testtype.HostTest">
<option name="jar" value="GosCompatMemoryTests.jar" />
</test>
</configuration>
12 changes: 12 additions & 0 deletions tests/GosCompatTests/GosCompatMemoryTests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# GosCompatMemoryTests

`GosCompatMemoryTests` is a compatibility test for memory allocator usage in apps.

## SmapsNativeHostTest

This tests streams `/proc/self/smaps` (a live walk of the process VMA tree) while allocating
retained parser objects, and hardened_malloc turns that allocation pattern into many allocator VMAs.
Because the live `/proc/self/smaps` walk can see those newly-created VMAs, the parser can start
parsing mappings created by its own parsing work, leading to a loop of allocations and eventually an
out-of-memory error. The tests will fail when a very high limit on number of VMA records parsed is
reached.
Loading