This blog explains about my patch to avocado-vt framework to enable tp-libvirt tests to run independent of guest import and delete_guest tests as we run tp-qemu tests.


Introduction to Avocado Test Framework:

Refer my previous blog titled `Testing KVM on Power Using Avocado Test Framework`

Patches that are needed to support below enablement:

avocado-vt: *
2c3ad894 Add param to cleanup env
e6df69b7 Enable libvirt vm start in preprocess
44773144 Undefine libvirt vm using param during postprocess

* already merged upstream

Steps to setup avocado in host and to run tp-libvirt tests:

Make sure your host has all packages installed which are needed to run KVM guests through libvirt.

Below tests results are on Fedora28 in IBM Power8 host and it has been verified with no change to tests, framework in x86 aswell.

Installing avocado...
#git clone https://github.com/avocado-framework/avocado.git -b 68.0
#cd avocado
#make requirements-selftests
#python setup.py install

Installing avocado-vt...
#git clone https://github.com/avocado-framework/avocado-vt.git
#cd avocado-vt
#make requirements
#python setup.py install

Bootstrapping to get guest(VM) image and tests...
#avocado vt-bootstrap --vt-type libvirt
------------> Say yes to download JeOS guest image

Running tests...
# avocado run guestpin --vt-type libvirt --vt-extra-params create_vm_libvirt=yes kill_vm_libvirt=yes env_cleanup=yes backup_image_before_testing=no restore_image_after_testing=no vcpu_cores=2 smp=2 --vt-guest-os JeOS.27.ppc64le
JOB ID     : cacac07981928e019bc4d967e1be5166e85da7b1
JOB LOG    : /home/sath/avocado-fvt-wrapper/results/job-2018-05-17T03.24-cacac07/job.log
 (01/37) type_specific.io-github-autotest-libvirt.guestpin.without_emulatorpin.randompin.positive.with_host_smt: CANCEL (36.27 s)
 (02/37) type_specific.io-github-autotest-libvirt.guestpin.without_emulatorpin.randompin.positive.with_guest_smt: PASS (76.74 s)
 (03/37) type_specific.io-github-autotest-libvirt.guestpin.without_emulatorpin.randompin.positive.with_save: PASS (87.26 s)
 (04/37) type_specific.io-github-autotest-libvirt.guestpin.without_emulatorpin.randompin.positive.with_managedsave: PASS (88.58 s)
 (05/37) type_specific.io-github-autotest-libvirt.guestpin.without_emulatorpin.randompin.positive.with_suspend: PASS (47.47 s)
 (06/37) type_specific.io-github-autotest-libvirt.guestpin.without_emulatorpin.randompin.positive.iteration: PASS (56.97 s)
 (07/37) type_specific.io-github-autotest-libvirt.guestpin.without_emulatorpin.randompin.positive.with_stress.guestcpu: PASS (677.52 s)
 (08/37) type_specific.io-github-autotest-libvirt.guestpin.without_emulatorpin.randompin.positive.with_stress.guestmem: PASS (676.46 s)
 (09/37) type_specific.io-github-autotest-libvirt.guestpin.without_emulatorpin.randompin.positive.with_cpu_hotplug: PASS (60.73 s)
 (10/37) type_specific.io-github-autotest-libvirt.guestpin.without_emulatorpin.sequential.positive.with_host_smt: CANCEL (43.77 s)
 (11/37) type_specific.io-github-autotest-libvirt.guestpin.without_emulatorpin.sequential.positive.with_guest_smt: PASS (76.49 s)
 (12/37) type_specific.io-github-autotest-libvirt.guestpin.without_emulatorpin.sequential.positive.with_save: PASS (86.65 s)
 (13/37) type_specific.io-github-autotest-libvirt.guestpin.without_emulatorpin.sequential.positive.with_managedsave: PASS (87.97 s)
 (14/37) type_specific.io-github-autotest-libvirt.guestpin.without_emulatorpin.sequential.positive.with_suspend: PASS (46.27 s)
 (15/37) type_specific.io-github-autotest-libvirt.guestpin.without_emulatorpin.sequential.positive.iteration: PASS (57.30 s)
 (16/37) type_specific.io-github-autotest-libvirt.guestpin.without_emulatorpin.sequential.positive.with_stress.guestcpu: PASS (676.80 s)
 (17/37) type_specific.io-github-autotest-libvirt.guestpin.without_emulatorpin.sequential.positive.with_stress.guestmem: PASS (676.28 s)
 (18/37) type_specific.io-github-autotest-libvirt.guestpin.without_emulatorpin.sequential.positive.with_cpu_hotplug: PASS (60.49 s)
 (19/37) type_specific.io-github-autotest-libvirt.guestpin.with_emualorpin.randompin.positive.with_host_smt: CANCEL (44.20 s)
 (20/37) type_specific.io-github-autotest-libvirt.guestpin.with_emualorpin.randompin.positive.with_guest_smt: PASS (77.16 s)
 (21/37) type_specific.io-github-autotest-libvirt.guestpin.with_emualorpin.randompin.positive.with_save: PASS (87.70 s)
 (22/37) type_specific.io-github-autotest-libvirt.guestpin.with_emualorpin.randompin.positive.with_managedsave: PASS (88.20 s)
 (23/37) type_specific.io-github-autotest-libvirt.guestpin.with_emualorpin.randompin.positive.with_suspend: PASS (47.04 s)
 (24/37) type_specific.io-github-autotest-libvirt.guestpin.with_emualorpin.randompin.positive.iteration: PASS (56.09 s)
 (25/37) type_specific.io-github-autotest-libvirt.guestpin.with_emualorpin.randompin.positive.with_stress.guestcpu: PASS (677.03 s)
 (26/37) type_specific.io-github-autotest-libvirt.guestpin.with_emualorpin.randompin.positive.with_stress.guestmem: PASS (238.97 s)
 (27/37) type_specific.io-github-autotest-libvirt.guestpin.with_emualorpin.randompin.positive.with_cpu_hotplug: PASS (60.24 s)
 (28/37) type_specific.io-github-autotest-libvirt.guestpin.with_emualorpin.randompin.positive.with_load_switch: PASS (679.63 s)
 (29/37) type_specific.io-github-autotest-libvirt.guestpin.with_emualorpin.sequential.positive.with_host_smt: CANCEL (43.70 s)
 (30/37) type_specific.io-github-autotest-libvirt.guestpin.with_emualorpin.sequential.positive.with_guest_smt: PASS (76.70 s)
 (31/37) type_specific.io-github-autotest-libvirt.guestpin.with_emualorpin.sequential.positive.with_save: PASS (88.16 s)
 (32/37) type_specific.io-github-autotest-libvirt.guestpin.with_emualorpin.sequential.positive.with_managedsave: PASS (87.71 s)
 (33/37) type_specific.io-github-autotest-libvirt.guestpin.with_emualorpin.sequential.positive.with_suspend: PASS (46.95 s)
 (34/37) type_specific.io-github-autotest-libvirt.guestpin.with_emualorpin.sequential.positive.iteration: PASS (57.66 s)
 (35/37) type_specific.io-github-autotest-libvirt.guestpin.with_emualorpin.sequential.positive.with_stress.guestcpu: PASS (676.51 s)
 (36/37) type_specific.io-github-autotest-libvirt.guestpin.with_emualorpin.sequential.positive.with_stress.guestmem: PASS (249.92 s)
 (37/37) type_specific.io-github-autotest-libvirt.guestpin.with_emualorpin.sequential.positive.with_cpu_hotplug: PASS (59.96 s)
RESULTS    : PASS 33 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 4


Feel free to run any number of tests just with these params enabled which will automatically create VM in libvirt environment irrespective of test configs.

create_vm_libvirt=yes kill_vm_libvirt=yes env_cleanup=yes

Here, I have a run guestpin test from tp-libvirt which tests different combinations of vcpupin and emulatorpin libvirt apis and it is evident from below run that no guest import and delete guest tests are used and no additional changes to test case are required!!.

Many more tests are available which can be browsed by `avocado list -V --vt-type=qemu`


Hope this helps you in someways!!
Thanks for taking time in reading this blog....