GDB: add `--gdb-prerun-commands` option to GDB plugin

This feature allows custom GDB commands to be executed before the
actual binary is run. What it can do then, is only limited by the
user's goals.

This is intended to allow complex applications, such as QEMU,
to be debugged inside Avocado tests. Configuring GDB for QEMU,
for example, involves passing signals to the application that
would otherwise result in an event that would stop the debugger.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
requirements.txt: Add pystache requirement

That's necessary for our upcoming HTML results plugin.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
avocado.plugins.plugin: Create get_resources_path API

Allow other plugins to locate resources through the
new get_resource_path API. It'll return correctly
the full path for the given resource file, and the
interface is similar to the os.join() API.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
Avocado: Add htmlresult plugin

Add a plugin to write a job summary HTML page.
The plugin takes results and creates a JSON context, that
is used by the pystache library, to render an HTML page
using a mustache template.

This commit contains the base plugin code, and the resource
files used by the plugin (bootstrap for some of the js, base
css, datatables for the test results table functionality).

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
avocado.job: If possible, write an HTML report at the job results dir

If the HTML plugin is enabled on this install, write a
report at html/ on that job results directory. This will
help people to read avocado test results on a portable
and pleasant way.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
setup.py: Add plugin resource files

Package plugin resource files, as they're necessary to
the given plugin's functionality. Update MANIFEST.in
with the new data dir.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
avocado.spec: Add subpackage plugins-output-html

Add a subpackage plugins-output-html, that will turn
HTML functionality optional in avocado. This way
we don't force people to install unnecessary dependencies
for the functionality they actually want.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
selftests: Add html plugin tests

Functional verification of the HTML output plugin functionality.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
GDB: let user choose the GDB binary to use

Developers using Avocado's GDB support may need to use their custom
build of GDB, or simply their system has GDB at a different location.
So, allow users to optionally specify the path to the GDB binary.

Also, allow GDB API users to pass extra options to GDB via the command
line.

Changes from v1:
   * use `avocado.utils.process.find_command` as the first default
     location for the gdb binary, falling back to the hard coded
     default of `/usr/bin/gdb` if that fails.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
GDB: let user choose the gdbserver binary to use

Developers using Avocado's GDB support may also need to use their custom
build of gdbserver.

This implements the same logic and options as the previous commit does
for the GDB binary, including API level changes.

Changes from v1:
   * use `avocado.utils.process.find_command` as the first default
     location for the gdbserver binary, falling back to the hard coded
     default of `/usr/bin/gdbserver` if that fails.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
Merge pull request #266 from clebergnu/gdb_path_v2

GDB: support for setting gdb/gdbserver paths [v2]
Merge remote-tracking branch 'lmr/html-reports_v2'
Merge branch 'gdb_pre_run_commands' of https://github.com/clebergnu/avocado into clebergnu-gdb_pre_run_commands

Conflicts:
	man/avocado.rst
Merge branch 'clebergnu-gdb_pre_run_commands'
Reorganize requirements.txt and Travis CI job

Document requirements.txt, split it into 3 files:

 * requirements.txt - Used to install deps for functionality
 * tests-requirements.txt - Used to install deps to test avocado
 * travis-requirements.txt - Used exclusively for Travis CI jobs

Also, clean up and simplify Travis install job section.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
Merge pull request #268 from lmr/reorganizing-travis-job

Reorganize requirements.txt and Travis CI job
Introduce new runner option --wrapper.

Introduce a new command line option (--wrapper) to wrap
every new process created with help of module `avocado.utils.process`
inside a support script.

Wrappers can be global, so it will wrap every process or
you can set a wrapper to a specific program.

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

You can provide multiples --wrapper options,
but only one global wrapper can be active at time.

For API, the class WrapProcess accepts an optional argument `wrapper`.
If it is defined, then use this parameter as the wrapper script.
If undefined, then it will look for the value inside
`runtime.CURRENT_WRAPPER` and use it.

If `runtime.CURRENT_WRAPPER` is None, then just behave like the
`SubProcess` class.

Signed-off-by: Rudá Moura <rmoura@redhat.com>
examples.wrappers: Scripts to use with option --wrapper.

Scripts to use with command line option --wrapper.

* dummy.sh    Do nothing (use as a template).
* strace.sh   Run process on strace, output: strace.log.<pid>
* ltrace.sh   Run process on  ltrace, output: ltrace.log.<pid>
* perf.sh     Record process on perf, output: perf.data.<pid>
* valgrind.sh Run process on valgrind's memcheck, output: valgrind.log.<pid>

Usage:

  avocado run datadir --wrapper examples/wrappers/strace.sh
  avocado run datadir \
              --wrapper examples/wrappers/ltrace.sh:make \
              --wrapper examples/wrappers/perf.sh:datadir \

Signed-off-by: Rudá Moura <rmoura@redhat.com>

Valgrind.

Signed-off-by: Rudá Moura <rmoura@redhat.com>
selftests: Add functional tests for --wrapper feature.

Add some functional tests to explore the --wrapper feature.

Signed-off-by: Rudá Moura <rmoura@redhat.com>
docs+man: Add documentation for the --wrapper feature.

Add documentation manual page part for the command line
feature `--wrapper`.

Signed-off-by: Rudá Moura <rmoura@redhat.com>