virt.py: Small coding style fixes

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
standalone_test: Runner - allow more statuses in results

When running virt tests under autotest, the following
test errors trigger special behavior in autotest:

1) error.TestNAError: The test wasn't executed since
   there is no support for it in the system in question
2) error.TestWarning: An error occurred, but not serious
   enough to ruin subsequent tests. It's a flag for the
   person running the tests to take a careful look at
   the logs

In the current stand alone harness though, these special
exceptions have one single meaning -> test FAIL. We can
fix that by treating the special exceptions differently.

Note that this still needs more formal testing, some
unittests will be written and a more complete version
will be posted.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
virt: Add fail and skip tests

So we can test the TestWarn and TestNAError mechanisms
when failing tests. To see how they work, you can use:

./run -t kvm --tests "fail_test warning_test skip_test"

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
run: When setup is taking too long, print a message to the user

If JeOS has to be downloaded and uncompressed, the user
will execute the test runner and see no output for a long
time (in my system, ~200 seconds). So, if we have to wait
for setup for complete more than 3 seconds, print a message
to the user that setup is being executed.

In order to do this, moved the bootstrap stage to a thread,
where we can check whether more than 3 seconds have elapsed
since it started. In order to keep the run script clean,
the bootstrap functions were moved to standalone_test,
and the functions were properly documented.

Before:

[lmr@freedom virt-test.git]$ ./run -t kvm --tests "fail_test warning_test skip_test" --restore-image
SETUP: PASS (21.44 s)
DATA DIR: /home/lmr/virt_test

After:

[lmr@freedom virt-test.git]$ ./run -t kvm --tests "fail_test warning_test skip_test" --restore-image
Running setup. Please wait...
SETUP: PASS (21.44 s)
DATA DIR: /home/lmr/virt_test

If the setup stage is under 3 seconds, no change in the output:

[lmr@freedom virt-test.git]$ ./run -t kvm
SETUP: PASS (0.90 s)
DATA DIR: /home/lmr/virt_test

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
run: When setup is taking too long, print a message to the user

If JeOS has to be downloaded and uncompressed, the user
will execute the test runner and see no output for a long
time (in my system, ~200 seconds). So, if we have to wait
for setup for complete more than 3 seconds, print a message
to the user that setup is being executed.

In order to do this, moved the bootstrap stage to a thread,
where we can check whether more than 3 seconds have elapsed
since it started. In order to keep the run script clean,
the bootstrap functions were moved to standalone_test,
and the functions were properly documented.

Before:

[lmr@freedom virt-test.git]$ ./run -t kvm --tests "fail_test warning_test skip_test" --restore-image
SETUP: PASS (21.44 s)
DATA DIR: /home/lmr/virt_test

After:

[lmr@freedom virt-test.git]$ ./run -t kvm --tests "fail_test warning_test skip_test" --restore-image
Running setup. Please wait...
SETUP: PASS (21.44 s)
DATA DIR: /home/lmr/virt_test

If the setup stage is under 3 seconds, no change in the output:

[lmr@freedom virt-test.git]$ ./run -t kvm
SETUP: PASS (0.90 s)
DATA DIR: /home/lmr/virt_test

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
utils_misc: Fix hard coded /var/tmp image location

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
kvm.ksm_overcommit: Change the path of the scripts

Currently, the scripts dir has change from virt/scripts to virt/shared/
scripts. This make the test fail. Change it to correct dir.

Signed-off-by: Mike Qiu <qiudayu@linux.vnet.ibm.com>
Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
utils_misc: Fix exception handling when restoring env file

If we had an exception loading the environment, we
won't have an exception in the trace stack, so an
error like:

21:12:18 ERROR| Traceback (most recent call last):
21:12:18 ERROR|   File "/home/lmr/Code/virt-test.git/virttest/standalone_test.py", line 85, in run_once
21:12:18 ERROR|     env = utils_misc.Env(env_filename, self.env_version)
21:12:18 ERROR|   File "/home/lmr/Code/virt-test.git/virttest/utils_misc.py", line 395, in __init__
21:12:18 ERROR|     traceback.print_last()
21:12:18 ERROR|   File "/usr/lib64/python2.7/traceback.py", line 250, in print_last
21:12:18 ERROR|     raise ValueError("no last exception")
21:12:18 ERROR| ValueError: no last exception
21:12:18 ERROR|
21:12:18 ERROR| FAIL -> ValueError: no last exception

Will be thrown. Instead, let's just error the exception
thrown as an error message.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
utils_misc: Removing unused import

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
utils_misc: Fix use of reserved keyword in generate_random_string

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
virt_test_assistant: Restore missing uncompressed JeOS image

This is a solution for issue #93.

If for some reason there's a pristine, compressed JeOS
image in the appropriate location, but not an uncompressed
file, decompress it so the user doesn't get an error and
the tests can proceed normally.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
virt-tests: Add .gitignore file

This is a solution for issue #88.

Create a .gitignore file with appropriate list of
files to be ignored by the version control system.

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