avocado-framework/avocado — pull request #258 by ruda (2014-11-20 19:40:29+00:00)
Title: Introduce wrap process inside the tests [V2]

Follow up to PR #256.

Changes from V1:

Fix problems pointed by @clebergnu and improve the class `WrapProcess`.

* Fix documentation.
* Show error message and exit if `--wrapper` and `--gdb-run-bin` are in the same command line.
* The class `WrapProcess` now accepts an optional argument `wrapper`, to better control its usage.

---

Introduce a new command line option `--wrapper` to wrap every new process created with help of module `avocado.utils.process` inside a support script.
The wrappers allows the instrumentation of applications being run by a test in a transparent way and
they can be global, so it will wrap every process or you can set a wrapper to a specific program.

Example of a transparent way of running `strace` as a wrapper::

#!/bin/sh
exec strace -ff -o strace.log -- $@

* Set wrapper to `strace.sh` on each process: `avocado run --wrapper strace.sh sometest`
* Set wrapper only to `strace.sh` and binary `myprog`: `avocado run --wrapper strace.sh:myprog sometest`

You can provide multiples `--wrapper` options in the same command line, but only one global wrapper can be active at time.