tree: e3ad5fb302bedab45382d947319f22c225166d15 [path history] [tgz]
  1. breakpoint_test.cc
  2. BUILD.gn
  3. debugged_job_test.cc
  4. dynamic_loader.cc
  5. elf_symbol_test.cc
  6. message_loop_wrapper.cc
  7. message_loop_wrapper.h
  8. multithreaded_breakpoint_test.cc
  9. README.md
  10. so_wrapper.cc
  11. so_wrapper.h
  12. watchpoint_test.cc
  13. write_registers_test.cc
src/developer/debug/debug_agent/integration_tests/README.md

Debug Agent Integration Tests

These tests are all tests that exercise real functionality within Zircon. They are meant to verify that the debug agent actually does what the unit tests say it does.

Functionality

The tests generally work by “tricking” the debug agent that it's connected to a client. This is important because the DebugAgent works receiving messages triggered by the message loop and either returns immediatelly from the remote API (//src/developer/debug/debug_agent/remote_api.h) or sending out notifications.

Generally all the interesting behaviour is in the notifications, as they represent exceptions (ie. I hit a breakpoint or a process died). There is a wrapper class meant to easily react to those notifications.

Usage

This directory contains both the tests (ending in “_test.cc”) and utilities for making these kind of testing easier.

Some pre-work needs to be done on each test in order to work properly:

MockStreamBackend

This class mocks being a debug::StreamBuffer::Writer, which is the interface the DebugAgent uses to write it‘s notifications. Each test is meant to inherit from this class and override the notifications it’s interested in.

MessageLoopWrapper

A simple RAII wrapper over the message loop. Nothing really special about it, but it's good to handle resources about it.

SoWrapper

A simple RAII wrapper over loading a .so. This is meant to have an easy way to query symbols using the dlsym-interface.

Example

breakpoint_test.cc is a canonical example and should show the usage of these elements.