Commit f2f3e06f authored by Egor Pasko's avatar Egor Pasko Committed by Commit Bot

crazylinker: fix java tests and add a doc

I found that crazylinker tests are special enough not to be run during
regular testing. I fixed a small issue and added a document about a few
non-trivial-to-discover ways to test the crazylinker in Chromium
checkout.

After the fix all the off-CQ testing described in the doc passes on my
Nexus5X, with the exception of fuzzers - I did not run those.

Applying TBR for docs only.

TBR=rmcilroy@chromium.org

Bug: 981599
Change-Id: I7ead0ef59c6b402729393ba273798107afefed46
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1695309Reviewed-by: default avatarEgor Pasko <pasko@chromium.org>
Reviewed-by: default avatarAndrew Grieve <agrieve@chromium.org>
Reviewed-by: default avatarBenoit L <lizeb@chromium.org>
Commit-Queue: Egor Pasko <pasko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#676528}
parent d64bd80b
......@@ -269,7 +269,7 @@ public abstract class Linker {
assertLinkerTestsAreEnabled();
synchronized (sLock) {
sSingleton.mTestRunnerClassName = testRunnerClassName;
Linker.getInstance().mTestRunnerClassName = testRunnerClassName;
}
}
......
......@@ -27,11 +27,7 @@
Host-driven tests have also been tried, but since they're really
sub-classes of instrumentation tests, they didn't work well either.
To build and run the linker tests, do the following:
ninja -C out/Debug chromium_linker_test_apk
out/Debug/bin/run_chromium_linker_test_apk
To build and run, refer to android_linker_testing.md.
"""
# pylint: disable=R0201
......
......@@ -9,6 +9,9 @@ import("//testing/test.gni")
# NOTE: This file is included in Linux builds to build the
# crazy_linker_zip_fuzzer target (see below). However, the rest of the
# crazy linker doesn't build or work on Linux yet.
#
# NOTE: Instructions for testing the crazy linker are in
# android_linker_testing.md.
config("crazy_config") {
include_dirs = [ "src/include" ]
......
......@@ -100,4 +100,6 @@ Local Modifications:
- Improve FileDescriptor class.
- Safer zip parsing code (avoid integer overflows and add range checks).
\ No newline at end of file
- Safer zip parsing code (avoid integer overflows and add range checks).
- Add a document about testing the crazy linker in a Chromium checkout
......@@ -125,9 +125,6 @@ BUGS & TODOs:
Testing:
--------
If you modify this code, check your changes by running the test suite using:
cd $NDK
tests/run-tests.sh crazy_linker
See android_linker_testing.md
See DESIGN.TXT for an overview of the library's design.
# Testing the Android Crazy Linker
The crazy linker is a custom dynamic linker used by Chrome on older Android
versions where dynamic linking is not as advanced. It provides
`android_dlopen_ext` functionality, RELRO sharing, compressed relocations, etc.
For crazy reasons outlined in `linker/test_case.py` this linker cannot be tested
using GTest or instrumentation test, hence it also carries a custom testing
framework. The tests are not run as part of CQ, but it is still desirable to run
them before landing changes in code locations listed below.
Sorry.
These instructions assume
[Building Chromium for Android](android_build_instructions.md) as a
prerequisite.
## Code Locations
The tested functionality is spread across these locations:
```
third_party/android_crazy_linker
base/android/java/src/org/chromium/base/library_loader
```
The tests themselves are living mostly in these places:
```
build/android/pylib/linker/test_case.py
content/shell/android
```
## Running native tests
This will run both unittests and regression tests:
```
autoninja -C out/Release android_crazy_linker_tests
out/Release/bin/run_android_crazy_linker_tests --unit-tests
```
Verbosity of the output can be increased by setting `CRAZY_DEBUG` to 1 in
`crazy_linker_debug.h`.
## Running Java Tests
We recommend running these tests in Release mode, as there are known
complications in testing with the component build. Setting `Linker.DEBUG` to
`true` should also help increase verbosity of the output.
```
autoninja -C out/Release chromium_linker_test_apk
out/Release/bin/run_chromium_linker_test_apk
```
## Fuzzer Tests
There are also a few tests for fuzzing the ZIP parser. The instructions to run
them are at the bottom of `third_party/android_crazy_linker/BUILD.gn`.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment