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