1Native tests for 'perfprofd'. Please run with 'runtest perfprofd' 2(a.k.a. "$ANDROID_BUILD_TOP"/development/testrunner/runtest.py). 3 4Notes: 5 61. One of the testpoints in this test suite performs a live 'perf' 7run on the device; before invoking the test be sure that 'perf' 8has been built and installed on the device in /system/bin/perf 9 102. The daemon under test, perfprofd, is broken into a main function, a 11"core" library, and a "utils library. Picture: 12 13 +-----------+ perfprofdmain.o 14 | perfprofd | 15 | main() | 1-liner; calls perfprofd_main() 16 +-----------+ 17 | 18 v 19 +-----------+ perfprofdcore.a 20 | perfprofd | 21 | core | most of the interesting code is here; 22 | | calls into utils library when for 23 +-----------+ operations such as sleep, log, etc 24 | 25 v 26 +-----------+ perfprofdutils.a 27 | perfprofd | 28 | utils | real implementations of perfprofd_sleep, 29 | | perfprofd_log_* etc 30 +-----------+ 31 32Because the daemon tends to spend a lot of time sleeping/waiting, 33it is impractical to try to test it directly. Instead we insert a 34mock utilities layer and then have a test driver that invokes the 35daemon main function. Picture for perfprofd_test: 36 37 +----------------+ perfprofd_test.cc 38 | perfprofd_test | 39 | | makes calls into perfprofd_main(), 40 +----------------+ then verifies behavior 41 | 42 v 43 +-----------+ perfprofdcore.a 44 | perfprofd | 45 | core | same as above 46 +-----------+ 47 | 48 v 49 +-----------+ perfprofdmockutils.a 50 | perfprofd | 51 | mockutils | mock implementations of perfprofd_sleep, 52 | | perfprofd_log_* etc 53 +-----------+ 54 55The mockup versions of perfprofd_sleep() and perfprofd_log_* do 56simply log the fact that they are called; the test driver can 57then examine the log to make sure that the daemon is doing 58what it is supposed to be doing. 59