Include wrapper scripts when creating avocado-examples package.

Include all examples/wrappers/*.sh scripts when building
the `avocado-examples` package. The scripts will live under
`/usr/share/avocado/wrappers` when installed.

Signed-off-by: Rudá Moura <rmoura@redhat.com>
Make use of python-subprocess32 module if available.

python-subprocess32 [https://code.google.com/p/python-subprocess32/]
is a backport of Python 3.2 subprocess module with:

* Better process forking.
* More reliable when running with threads.

Although we're not going to use any feature of subprocess32,
this change turn it possible to use subprocess32 as a drop-in
replacement for the original subprocess module.

Signed-off-by: Rudá Moura <rmoura@redhat.com>
avocado.test: Support params passing to DropinTests

This patch injects all params as env variables to
DropinTests. This is very useful for multiplexing
these tests.

Additionally the env_variables.sh example test was
adjusted to print CUSTOM_VARIABLE, which can be used
in selftest.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
avocado.job: Fix deadlock in TestRunner.run()

multiprocessing.Queue().put() is asynchronous and in case the test died
critically before the put() was executed, TestRunner.run() waited for
infinity for early_state. This patch uses
multiprocessing.queues.SimpleQueue(), where it's guaranteed that after
executing put() the data are already in the SimpleQueue.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
avocado: Print config file paths in datadir and list subcommands

It is useful information to the user where the config file
is, to reinforce where avocado is picking the default values.
So add it to the output of `datadir` and `list` subcommands.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
avocado.plugin: Visual plugin output tweaks

Get to a more toned down output for the subcommands
'datadir', 'plugins' and 'list'.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
avocado.plugins.plugin: Add parser attribute to Plugin object

This way we define more clearly the attributes of the
plugin object (many of them will implement a parser
object).

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
avocado.plugins: Split sysinfo and test_lister plugins

Put the sysinfo and test_lister plugins into separate
plugin files. Although not strictly necessary, the
neat 1 plugin - 1 source file relation makes things
organized and easy to understand.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
Run avocado when called by 'python -m avocado'

Add a main entry point when avocado is called
by the command line option 'python -m avocado'.

Signed-off-by: Rudá Moura <rmoura@redhat.com>
selftests..multiplex_tests: Check that vars changes

Replace test_run_mplex_timeout with test_run_mplex_params test which
executes 'env_variables.sh' and checks that output contain correct
output. This test checks the multiplexer capability to change variable
value.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
avocado.runner: New module with TestRunner class inside.

Creates the module `avocado.runner` where the `TestRunner` class lives.

Signed-off-by: Rudá Moura <rmoura@redhat.com>
avocado.job: Remove TestRunner class.

Remove TestRunner class from this module, it's now defined inside new
module `avocado.runner`.

Signed-off-by: Rudá Moura <rmoura@redhat.com>
avocado.plugins: Plugins vm and remote uses avocado.runner module.

Change plugins vm and remote to use new module `avocado.runner`
that contains the TestRunner class.

Signed-off-by: Rudá Moura <rmoura@redhat.com>
avocado.core.tree: Fix infinite recursion in TreeNode.__eq__

Original implementation compared self and then parent node. Parent
node again compared self and children => infinite recursion.

In the end we actually don't want to compare parents, because we care
about what is after this node. This implementation compares only Node
and children.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
avocado.core.tree: Fix TreeNode.iter_parents

Iterator should raise StopIteration, not return None.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
avocado.core.tree: Remove unnecessary branch from _create_from_yaml

Yaml creates pairs of items, thus isinstance(dict) branch should
not be possible (I hope).

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
avocado.core.tree: Use None instead of [] as defaults

defaults [] are not recommended, use None instead.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
avocado.multiplexer: Remove filter_only/filter_out

these functions were only used in unittests and were redundant to
tree.apply_filters().

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
avocado: Support for multiple multiplex yaml files

This patch adds support for multiple yaml files by merging the values
together. Merge overrides the nodes value and appends missing children
iteratively. It's deterministic AND order dependant (yaml1 yaml2 migh
not provide the same results as yaml2 yaml1!).

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
avocado.multiplexer: Rename create_variants_from_yaml to multiplex_yamls

create_variants_from_yaml is hideously long. Use multiplex_yamls instead.

Additionally change default values from lists to None.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>