avocado.core: Introduce tree library

Introduce a new data structure that will be the base of
our new multiplexing mechanism.

Signed-off-by: Ruda Moura <rmoura@redhat.com>
avocado: Introduce the new multiplexer library

Based on the new treenode data structure, we
built a new multiplexing algorithm. It has some
different properties and uses a more standard
YAML file format for the configuration files.

This commit is the new base library.

Signed-off-by: Ruda Moura <rmoura@redhat.com>
avocado: Change framework to use the new multiplexer

That change has to be made all at once for the sake of
bisectability. Update avocado.job and the multiplexer
plugin with the new multiplexing library code.

Also, update functional tests, the avocado sample tests
with the new YAML based config files, and the requirements.txt
file with the new prominent dependency of avocado, PyYAML.

Signed-off-by: Ruda Moura <rmoura@redhat.com>
avocado: Remove the old multiplexer

Signed-off-by: Ruda Moura <rmoura@redhat.com>
docs: Update documentation with new multiplexer sections

Also, remove the references to the old system.

Signed-off-by: Ruda Moura <rmoura@redhat.com>
Merge pull request #159 from lmr/new-multiplexer-rmoura

New multiplexer
avocado.job: Remove the 'Interrupted by user' message on Ctrl+C

If a process is misbehaved, that message will be confusing,
because avocado is actually waiting on child processes to
finish.

Then let's get rid of the message altogether.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
avocado.utils.process: Execute commands on a subshell

For a number of reasons, the original implementation
called the processes with shell=False (subprocess default),
I noticed later that we lose things like the ability
to use pipes in commands executed and proper job
control and process handling.

So change that and use shell=True.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
selftests/functional: basic_tests: Remove unused import

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
avocado.utils.process: Refactor and bugfix

Chasing a bug, I found opportunities to improve the
process related code:

*  Populating the CmdResult object on every
   opportunity that wait() or poll() is executed
   in the subprocess.

*  Changing the name of the original wait() method
   to run(), making it consistent with the run()
   function of the module.

Also, to avoid a defunct process on a Ctrl+C, register
the SIGINT signal handler to the SubProcess wait()
method.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
avocado.job: Fix Ctrl+C handling (for real this time)

1) Revert the test subprocess side SIGINT handler
   to its original form (just raising an appropriate
   TestInterruptError exception)
2) Move the KeyboardInterrupt handling to the test
   run main loop, as we had nested handling blocks
   that ended up creating a deadlock.
3) Start counting the ignore window time after Ctrl+C is
   pressed by the second time, not the first.

With this, we finally get trinity to call its Ctrl+C
handler correctly and cleanup after itself, as well
as avocado cleaning up correctly if enough time is
given to the test subprocesses to end.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
tests/trinity: Don't print ResultCmd object

Not necessary or desirable, since we get trinity's
output in the logs already, and the output of the
test is quite extensive.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>