avocado-framework/avocado — pull request #265 by ruda (2014-11-25 11:34:25+00:00)
Title: Introduce wrap process inside the tests [V3]

Follow up to PR #258

Changes from V2:

Fix problems pointed by @clebergnu and @adereis .

* ltrace.sh script now respects exit codes (by a suggestion of @ldoktor ).
* the scripts lstrace.sh and perf.sh uses the PID in the log name.
* Include a new wrapper script: valgrind.sh.
* Comparing binaries with absolute paths but fall backs to comparing by base name if wrapper's target binary or the binary to run by the test is not an absolute path.
* Merge fix commits backs to the feature, documentation and test commits.
* Rebase code to the current master.

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.