jbudorick | 85ec08f | 2016-09-08 01:30:22 | [diff] [blame] | 1 | # How GTests work on Android |
| 2 | |
| 3 | gtests are [googletest](https://github.com/google/googletest)-based C++ tests. |
| 4 | On Android, they run on a device. In most cases, they're packaged as APKs, but |
| 5 | there are a few cases where they're run as raw executables. The latter is |
| 6 | necessary in a few cases, particularly when manipulating signal handlers, but |
| 7 | isn't possible when the suite needs to call back through the JNI into Java code. |
| 8 | |
| 9 | [TOC] |
| 10 | |
| 11 | ## APKs |
| 12 | |
| 13 | ### GN |
| 14 | |
| 15 | Gtest APKs are built by default by the |
| 16 | [test](https://codesearch.chromium.org/chromium/src/testing/test.gni?type=cs&q=file:%5Esrc%5C/testing%5C/test.gni$+template%5C("test"%5C)&sq=package:chromium) |
| 17 | template, e.g. |
| 18 | |
| 19 | ```python |
| 20 | test("sample_gtest") { |
| 21 | # ... |
| 22 | } |
| 23 | ``` |
| 24 | |
| 25 | This uses gn's native |
John Palmer | a8515fca | 2021-05-20 03:35:32 | [diff] [blame] | 26 | [shared_library](https://chromium.googlesource.com/chromium/src/+/main/tools/gn/docs/reference.md#shared_library_Declare-a-shared-library-target) |
jbudorick | 85ec08f | 2016-09-08 01:30:22 | [diff] [blame] | 27 | target type along with the |
|
|