xref: /aosp_15_r20/external/perfetto/test/cts/README.md (revision 6dbdd20afdafa5e3ca9b8809fa73465d530080dc)
1*6dbdd20aSAndroid Build Coastguard WorkerThis directory contains the CTS tests for the Perfetto library.
2*6dbdd20aSAndroid Build Coastguard Worker
3*6dbdd20aSAndroid Build Coastguard Worker# Background
4*6dbdd20aSAndroid Build Coastguard WorkerFor information about what CTS is, please go to
5*6dbdd20aSAndroid Build Coastguard Workerhttps://source.android.com/compatibility/cts/ where you will find information
6*6dbdd20aSAndroid Build Coastguard Workeron the purpose of CTS and how to run these tests.
7*6dbdd20aSAndroid Build Coastguard Worker
8*6dbdd20aSAndroid Build Coastguard Worker# Test contents
9*6dbdd20aSAndroid Build Coastguard WorkerThe single GTest target (CtsPerfettoTestCases) contains the following notable
10*6dbdd20aSAndroid Build Coastguard Workertest suites:
11*6dbdd20aSAndroid Build Coastguard Worker* PerfettoCtsTest - verifies that any Android app can operate as a perfetto
12*6dbdd20aSAndroid Build Coastguard Worker  producer.
13*6dbdd20aSAndroid Build Coastguard Worker* HeapprofdCtsTest - verifies that Android apps can be heap-profiled, and that
14*6dbdd20aSAndroid Build Coastguard Worker  the manifest-based opt-in is respected.
15*6dbdd20aSAndroid Build Coastguard Worker* The contents of perfetto/test/end\_to\_end\_integrationtest.cc.
16*6dbdd20aSAndroid Build Coastguard Worker
17*6dbdd20aSAndroid Build Coastguard Worker## PerfettoCtsTest
18*6dbdd20aSAndroid Build Coastguard WorkerThe GTest suite is both the consumer of data as well as the driver the actual
19*6dbdd20aSAndroid Build Coastguard Workertests we wish to run. This target drives the tracing system by requesting
20*6dbdd20aSAndroid Build Coastguard Workertracing to start/stop and ensures the data it receives is correct.  This mimics
21*6dbdd20aSAndroid Build Coastguard Workerthe role of real consumers acting as the driver for tracing on device. This
22*6dbdd20aSAndroid Build Coastguard Workersuite is compiled and pushed to device and subsequently run using a shell
23*6dbdd20aSAndroid Build Coastguard Workeraccount which gives us permissions to access the perfetto consumer socket.
24*6dbdd20aSAndroid Build Coastguard Worker
25*6dbdd20aSAndroid Build Coastguard WorkerThe mock producer is an Android app with a thin Java wrapping around the C++
26*6dbdd20aSAndroid Build Coastguard Workerlibrary interfaced using JNI. The purpose of this target is to ensure that the
27*6dbdd20aSAndroid Build Coastguard WorkerTraceProto received from the consumer is valid and then push some fake data.
28*6dbdd20aSAndroid Build Coastguard WorkerThis ensures that any arbitrary app can push data to the Perfetto socket which
29*6dbdd20aSAndroid Build Coastguard Workercan then be decoded by the GTest consumer.
30*6dbdd20aSAndroid Build Coastguard Worker
31*6dbdd20aSAndroid Build Coastguard Worker## HeapprofdCtsTest
32*6dbdd20aSAndroid Build Coastguard WorkerThe tests cover the intersection of profiling from-startup/at-runtime, and
33*6dbdd20aSAndroid Build Coastguard Workerwhether the target app is debuggable. The GTest binary handles the targets'
34*6dbdd20aSAndroid Build Coastguard Workerlifetimes, acts as a profiling consumer, and asserts the contents of the
35*6dbdd20aSAndroid Build Coastguard Workerresultant traces.
36