Update Android documentation and add -upload-only flag Default to 64-bit instead of 32-bit in the documentation. Also the NDK's minimum API level is 21 nowadays. Finally add some notes on how to run the resulting binaries. I was originally going to give adb instructions (what I usually use) but that doesn't work for tests with test data, so add a -upload-only flag to the script to help package everything. Change-Id: I6fa7113679506e6f53b953df9146e7cf26b82e24 Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/98449 Commit-Queue: David Benjamin <davidben@google.com> Reviewed-by: Adam Langley <agl@google.com>
diff --git a/BUILDING.md b/BUILDING.md index 284ab0e..fd123a7 100644 --- a/BUILDING.md +++ b/BUILDING.md
@@ -80,17 +80,22 @@ Unpack the Android NDK somewhere and export `ANDROID_NDK` to point to the directory. Then run CMake like this: - cmake -DANDROID_ABI=armeabi-v7a \ - -DANDROID_PLATFORM=android-19 \ + cmake -DANDROID_ABI=arm64-v8a \ + -DANDROID_PLATFORM=android-21 \ -DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK}/build/cmake/android.toolchain.cmake \ -GNinja -B build Once you've run that, Ninja should produce Android-compatible binaries. You -can replace `armeabi-v7a` in the above with `arm64-v8a` and use API level 21 or -higher to build aarch64 binaries. +can replace `arm64-v8a` with `armeabi-v7a` in the above to build aarch64 +binaries. For other options, see the documentation in the toolchain file. +To run tests, you can use the `util/run_android_tests.go` script. Individual +binaries can also be pushed to the device with `adb`, but note that some tests +require test data. The `-upload-only` flag to `run_android_tests.go` may be +useful. + To debug the resulting binaries on an Android device with `gdb`, run the commands below. Replace `ARCH` with the architecture of the target device, e.g. `arm` or `arm64`.
diff --git a/util/run_android_tests.go b/util/run_android_tests.go index 7fc1e7e..8373c23 100644 --- a/util/run_android_tests.go +++ b/util/run_android_tests.go
@@ -46,6 +46,7 @@ allTestsArgs = flag.String("all-tests-args", "", "Specifies space-separated arguments to pass to all_tests.go") runnerArgs = flag.String("runner-args", "", "Specifies space-separated arguments to pass to ssl/test/runner") jsonOutput = flag.String("json-output", "", "The file to output JSON results to.") + uploadOnly = flag.Bool("upload-only", false, "Skips running the tests and only uploads the data to /data/local/tmp/boringssl/tmp on the device.") ) func enableUnitTests() bool { @@ -410,6 +411,11 @@ os.Exit(1) } + if *uploadOnly { + fmt.Printf("Tests and data are now uploaded to /data/local/tmp/boringssl-tmp on the device.\n") + return + } + var unitTestExit int if enableUnitTests() { fmt.Printf("Running unit tests...\n")