avocado.plugins.manager: Fix wrong variable to log.

Fix the variable to display in log when an external plugin fails
to load.

Signed-off-by: Ruda Moura <rmoura@redhat.com>
selftests: Add  functional tests regarding external plugins.

Add functional tests to explore external plugins in two
bad scenarios: 1) plugin without configure() method implemented,
2) plugin with syntax error.

Signed-off-by: Ruda Moura <rmoura@redhat.com>
avocado/core/output.py: introduce partial progress/success messages

Signed-off-by: Cleber Rosa <crosa@redhat.com>
test result output: allow for test specific progress indication

The throbber that gives visual indication of progress can now show if the progress
includes test specific progress (GREEN) or if the test process is running (YELLOW)
but actual progress is unknown.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
avocado test state: include the extra information regarding test time

And running state. Every time the state is produced and put in the queue,
the elapsed time is updated. Also, a new flag, "running", shows if the
framework has entered or exited the test entry point.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
job main loop: use the test 'running' attribute

So that multiple test states can be received by the main loop, but
only if the test is finished we break out from the loop.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
sleeptenmin test: add new test scenarios

Including number of sleep cycles, sleep cycle length and finally
the sleep method, either using the python time.sleep() or running
the shell "sleep" command.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
job and test communication: let the test have hold of the runner queue

So that it can report back its state whenever it feels like it.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
test progress: allow test to communicate its real progress back to the test runner

A test writer can write its own check that will be called by default, or just decide
on each call to communicate_progress() if there has been any (progress).

Also, the job main loop now shows a green throbber when there has been real test
progress.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
tests/sleeptenmin.py: implement a test specific progress check

Which doesn't hold any logic, but serves as an example.

To watch the intended behavior in action, I recommend running the
"one_hundred_cycles" variant of this tests.

The test runner will show that the test is running (yellow throbber
spinning), and once each six seconds (+1% into the test run) a green
throbber will be shown.

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

Live test state
Merge pull request #157 from ruda/fix_small_bug_external_plugins

Fix small bug in external plugins
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>