blob: 40b78a51011a1ef17606c1a69878995cddd0ed11 [file] [log] [blame] [view]
jbudorick85ec08f2016-09-08 01:30:221# How GTests work on Android
2
3gtests are [googletest](https://github.com/google/googletest)-based C++ tests.
4On Android, they run on a device. In most cases, they're packaged as APKs, but
5there are a few cases where they're run as raw executables. The latter is
6necessary in a few cases, particularly when manipulating signal handlers, but
7isn'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
15Gtest 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)
17template, e.g.
18
19```python
20test("sample_gtest") {
21 # ...
22}
23```
24
25This uses gn's native
John Palmera8515fca2021-05-20 03:35:3226[shared_library](https://chromium.googlesource.com/chromium/src/+/main/tools/gn/docs/reference.md#shared_library_Declare-a-shared-library-target)
jbudorick85ec08f2016-09-08 01:30:2227target type along with the