Deflake TracingServiceImplTest.WriteIntoFileAndStopOnMaxSize.

The test was asserting the wrong properties and passing for the wrong reasons.
It independently checked that: (a) there's at least 10 packets in the file, (b)
a prefix of the test packets has the expected payloads (but not that all test
packets are accounted for).

What was happening in practice is that in the passing case, the 512 bytes were
filled with the 4 preamble packets (sync marker, clock snapshot, trace stats,
trace config), followed by 6 (out of 10 expected) test packets.

The test became flaky as that combined size of these 10 packets became very
close to 512 bytes in practice, s.t. sometimes the 6th test packet could not
fit (-> there would only be 9 packets in the file). A possible explanation of
why the issue manifested as being timing dependent - varint encoding of
timestamps, slower test execution -> over the threshold for fitting the 10th
packet in 512 bytes.

I've decided to assert the number of preamble packets strictly (making this a bit of a
change-detector test), erring on the side of eager and obvious failures if someone
changes the preamble format significantly.

(Credit for most of the debugging goes to Lalit)

Change-Id: I13951dc4756d76327a1bbf611828fe5c91201700
1 file changed
tree: b6ba809002e4a6a2ce38a07f8d60c70a32941d31
  1. build_overrides/
  2. buildtools/
  3. debian/
  4. docs/
  5. gn/
  6. include/
  7. infra/
  8. protos/
  9. src/
  10. test/
  11. tools/
  12. ui/
  13. .clang-format
  14. .gitignore
  15. .gn
  16. .travis.yml
  17. Android.bp
  18. Android.bp.extras
  19. BUILD.gn
  20. codereview.settings
  21. heapprofd.rc
  22. MODULE_LICENSE_APACHE2
  23. NOTICE
  24. OWNERS
  25. perfetto.rc
  26. PRESUBMIT.py
  27. README.chromium
  28. README.md
README.md

Perfetto - Performance instrumentation and tracing

Perfetto is an open-source project for performance instrumentation and tracing of Linux/Android/Chrome platforms and user-space apps.

See www.perfetto.dev for docs.

Bugs

  • For bugs affecting Android or the tracing internals use the internal bug tracker (go/perfetto-bugs).
  • For bugs affecting Chrome use http://crbug.com, Component:Speed>Tracing label:Perfetto.