Cope better with errors in child processes
If a test needs to run in a child process, make it easier to cope if
that child process encounters a failure along the way.
- Add a stringly-typed `Error` to the `run_as` module, which can:
- be serialized and so emitted from child processes
- be constructed from an `anyhow::Error`.
- Add helper macros that construct and `return` an `Error` rather than
directly panicking.
- Add a `recv_or_die()` method that attempts to read a response message
from the child process, but copes with the channel being gone. This
happens if the child has already exited; in this case a final result
message is hopefully available on the `result_reader`.
- Migrate the auth-bound tests to use `Result<(), run_as::Error>`.
Test: keystore2_client_tests auth_bound
Change-Id: Ic306bb272f740a44c0e1d06c948f11435ac3b211
4 files changed