tests: module_probe - Fix execution with no previous installer

When no previous installer was found, no modules were
found to load. However, depending on the subtest type,
we can infer modules to load (see the kvm example, we
can load/unload kvm and kvm-[cpu_vendor] modules).

So do the possible to infer the modules, and load/unload
them safely.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
utils_test: Introduce verify_running_as_root()

Some tests do require admin privileges, so, when running
as a regular user and reaching one of those tests, it is
good to just skip the test instead of trying to execute
it.

Therefore, introduce a utility function to verify whether
we're running as root (actually, uid=0), and if not,
throw an exception. Also add a postprocess param, that
will throw an error if the param 'requires_root' is set.

This will also make possible to tell in the test runner
list whether a test requires root or not, making one
more useful information clear to the users.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
run: On test list, print which tests require root

When listing the tests in the test list, it is useful
to know whether a given item does require root to run,
so print that information in the test list.

Unfortunately, only the kvm subtest allows to run a
subset of the tests as non root, so reflect that in
the runner heuristics. We plan on improving that.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
run: Pretty print test list

If colors are supported, when listing tests, use colors
in the test numbers (blue) and, if the test requires
root, print that in yellow, making it easier to process
the information being displayed.

In order to do that, do a little refactor in the Bcolors
class, so we expose colors as class attributes, and also,
move the print test list function to standalone_test.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
run: Print test number on execution list

In order to display one more bit of useful information,
print the test number on the execution list in the
form (current test/total tests).

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
kvm: nic_hotplug - Fix test running with usermode nic

Pass nic nettype to hotplug method, also, correctly
handle hot plugging of nics using user mode. This fixes
running as non root, with JeOS.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
subtests: Add tests that require root

Verified all JeOS related tests that require root.
Obviously, there are some that did not get the
proper label, but we can get to that.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
utils_test: Improve method get_linux_ifname

Recent Linux guests (including our JeOS) changed quite
drastically ifconfig output, making the current regexp
match against the command's output unfeasible. However,
it is possible to look on /sys/net/class to get the same
info, so let's do that if the regexp match didn't work.

Also, this method is called in a bunch of network tests,
that don't really treat its output, it is in our best
interest to make it raise a TestError exception when
it did not work (what happens today is that tests will
happily take None as a result of this function and
proceed, which will later result in a less comprehensible
test failure.

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