usb: raise TestNAError for unsupported devices

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
fix multi_disk

Used wrong path and thus didn't match image file names.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
kvm_vm: Redirect stderr to stdout for 'qemu-kvm -device ?' command

'qemu-kvm -device ?' print output to stderr. So have to udpate the
code to make it work.

Signed-off-by: Feng Yang <fyang@redhat.com>
run: Refactor command line args parsing

Create a specialized class for parsing the arguments,
make the code better organize, and start categorizing
options (such as general options and options specific
to a given virt subtest).

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
run: Refactor application code

Organize test runner code better under an App class.
This way it is easier to visualize in high level terms
what the test runner does.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
run: Expose backing data dir, default QEMU used

So it is easier to visualize each one of these options.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
run: Set english environment when executing virt tests

This was one tweak on the autotest control files not
present in the test runner - There are occasions where
localized output of certain commands might cause failures,
so let's ensure the language is en_US.UTF-8.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
run: Fix slight message inconsistency

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
run: Better text of restore image help

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
run: Add kvm specific option --accel

Make it possible to choose between tcg and kvm when running
the kvm specific tests. This is part of a series of changes
that will end up in renaming what we know today as 'kvm'
test to 'qemu'.

I think there's a bunch of assumptions that we make throughout
the tests with regards to qemu being accelerated with kvm,
that we'll discover when running the tests with tcg. Stay
tuned.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
run: add general option --restart-vm

Add a general flag to restart the vm between tests, which
does nothing but set restart_vm = yes for all cartesian
dicts.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
env_process: Add restore_image postprocessing parameter

Now when setting restore_image = yes, the postprocessing
code will *always* restore the image from backup. With
this we can implement an option in the test runner to
always restore the image from backup between tests.

Useful for folks that want to be extra careful, and
ensure the guest image is always pristine and clean
on every new test.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
run: Add general option --restore-image-between-tests

So on every test the pristine JeOS image is copied over
on every new test. We could've implemented something
with internal disk snapshots, but then we'd restrict
ourselves only to disk images that support snapshots.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
standalone_test: Printing more information in the debug log

Print some useful info in the debug log:

* Timestamp of test job start
* Options passed on the command line
* If using the kvm test, print the qemu binaries used

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
standalone_test: More debug log tweaks

Show on debug messages where we looked for test modules,
what is the search criteria, the modules we found.

Also, put a bit of spacing and some messages that help
to make sense out of the debug log.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
run: Add qemu specific options --nettype and --netdst

If you need to use bridge and tap devices for some
specific reason, now it is possible to specify those
options through the parser command line.

If you do choose --nettype = bridge however, you must
run the execution script as root, and we enforce that
restriction.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
run: Add general option --mem (-m)

Make it possible to specify the main vm's memory through
the parameter --mem (shorthand -m).

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
kvm_vm: Clean network resources upon create_qemu_cmd failure

If an exception happened when assembling the qemu cmd
(for example, unsupported cmdline flags for that
particular qemu version), clean up any tap fd open
for each nic.

This is the more proper solution for the issue first
mentioned here:

https://github.com/autotest/autotest/issues/520

That Gerd hit while running the usb related tests
in the code using RHEL 6. This patch finally makes
the usb tests properly pass when using bridge:

[root@virtblade02 virt-test]# ./run -t kvm --nettype bridge --tests "boot_with_usb reboot_with_usb"
SETUP: PASS (1.55 s)
DATA DIR: /var/lib/virt_test
DEBUG LOG: /root/virt-test/logs/run-2012-12-24-00.27.31/debug.log
TESTS: 20
(1/20) boot_with_usb.ehci: PASS (22.82 s)
(2/20) boot_with_usb.keyboard.uhci: PASS (27.84 s)
(3/20) boot_with_usb.keyboard.xhci: SKIP
(4/20) boot_with_usb.mouse.uhci: PASS (26.95 s)
(5/20) boot_with_usb.mouse.xhci: SKIP
(6/20) boot_with_usb.usb_audio: SKIP
(7/20) boot_with_usb.hub: PASS (27.07 s)
(8/20) boot_with_usb.storage.uhci: PASS (27.76 s)
(9/20) boot_with_usb.storage.ehci: PASS (27.86 s)
(10/20) boot_with_usb.storage.xhci: SKIP
(11/20) reboot_with_usb.ehci: PASS (62.71 s)
(12/20) reboot_with_usb.keyboard.uhci: PASS (64.18 s)
(13/20) reboot_with_usb.keyboard.xhci: SKIP
(14/20) reboot_with_usb.mouse.uhci: PASS (63.01 s)
(15/20) reboot_with_usb.mouse.xhci: SKIP
(16/20) reboot_with_usb.usb_audio: SKIP
(17/20) reboot_with_usb.hub: PASS (63.05 s)
(18/20) reboot_with_usb.storage.uhci: PASS (64.08 s)
(19/20) reboot_with_usb.storage.ehci: PASS (64.16 s)
(20/20) reboot_with_usb.storage.xhci: SKIP

CC: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
reorganize usb tests variants

Create a new "usb" test and move over all usb subtests step by step.
Reduce duplication and allow to run usb tests with a simple --tests=usb

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
usb: add usb-host test

Add test for usb-test (aka pass through).  Requires a physical usb device,
which must be specified in the configuration.  When unconfigured the test
raises TestNAError so the runner flags the test as skipped.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>