,," /> " />

目 录CONTENT

文章目录

Avocado-VT

Administrator
2024-02-18 / 0 评论 / 0 点赞 / 12 阅读 / 9399 字

Avocado是一个开源的测试框架,设计用于帮助开发人员和测试人员编写和执行各种类型的测试,包括虚拟化测试。

Avocado具有一些特性,使其特别适合虚拟化测试:

  • 灵活的测试API:Avocado提供了一组丰富的API,可以用于编写复杂的测试,包括对虚拟机的操作。

  • 测试隔离:Avocado支持在独立的环境中运行每个测试,这可以防止测试之间的相互影响,这对于虚拟化测试非常重要。

  • 可插拔的架构:Avocado的架构支持插件,这意味着您可以为特定的虚拟化技术或框架编写自定义的插件。

  • 日志和结果管理:Avocado可以自动收集和管理测试的日志和结果,这对于分析虚拟化测试的结果非常有用。

Avocado还有一个子项目叫做Avocado-VT,它是一个专门用于虚拟化测试的Avocado插件。Avocado-VT提供了一些预定义的测试和工具,可以用于测试各种虚拟化技术和框架,例如KVM,QEMU,libvirt等。

总的来说,如果您正在进行虚拟化测试,那么Avocado和Avocado-VT可能是非常有用的工具。

Avocado-vt是一个Avocado框架的插件,专门用于虚拟化测试。它提供了一组工具和API,用于管理虚拟机、创建虚拟化环境和执行虚拟化测试。它支持多种虚拟化技术,包括KVM,Xen,LXC,OpenVZ,VMware,以及其他的虚拟化技术。

Avocado-vt的主要特性包括:

  • 虚拟机管理Avocado-vt可以创建、启动、停止和销毁虚拟机。它支持多种虚拟机的配置和磁盘镜像格式。

  • 测试APIAvocado-vt提供了一组API,用于编写虚拟化测试。这些API可以用于操作虚拟机、检查虚拟机的状态、发送命令到虚拟机等。

  • 预定义的测试Avocado-vt包含了一些预定义的测试,用于测试虚拟化技术的常见功能和性能。

  • 测试隔离Avocado-vt支持在独立的环境中运行每个测试,这可以防止测试之间的相互影响。

要使用Avocado-vt,您首先需要安装Avocado框架,然后安装Avocado-vt插件。安装完成后,您可以使用avocado vt-bootstrap命令来设置虚拟化测试环境,然后使用avocado run命令来执行虚拟化测试。

Avocado用户手册:
https://avocado-framework.readthedocs.io/en/latest/guides/user/index.html
Avocado-VT 用户手册:
https://avocado-vt.readthedocs.io/en/latest/Introduction.html

1.安装Avocado

pip3 install avocado-framework

2.安装Avocado-VT

pip3 install git+https://gitee.com/openeuler/avocado-vt

3.引导Avocado-VT(在线下载方式)

1.安装python3-devel

yum install python3-devel

如果python3-devel包没有安装,后续执行avocado vt-bootstrap命令时会报错缺失Python.h,如下:

Required include Python.h is missing. You may have to install it
Missing (cmds/includes): Python.h

2.修改test-providers的ini配置

在/usr/local/lib/python3.6/site-packages/virttest/test-providers.d目录下有三个ini配置文件:

io-github-autotest-libvirt.ini
io-github-autotest-qemu.ini
io-github-spiceqa-spice.ini

这三个ini配置文件中配置了test-provider的uri地址,后续执行avocado vt-bootstrap命令时会去对应的uri地址下载代码,但是这三个uri指定的是github地址,通常无法成功下载,因此需要修改这三个配置文件。

注意,如果不修改这三个ini配置,后续执行avocado vt-bootstrap命令时会卡在如下步骤:

4 - Downloading the test providers from remote repos
Creating directory /var/lib/avocado/data/avocado-vt/virttest/test-providers.d/downloads/io-github-autotest-libvirt for git repo https://github.com/autotest/tp-libvirt.git
Initializing new git repo at /var/lib/avocado/data/avocado-vt/virttest/test-providers.d/downloads/io-github-autotest-libvirt for receiving git repo https://github.com/autotest/tp-libvirt.git
Running '/usr/bin/git init'
[stdout] Initialized empty Git repository in /var/lib/avocado/data/avocado-vt/virttest/test-providers.d/downloads/io-github-autotest-libvirt/.git/
Command '/usr/bin/git init' finished with 0 after 0.00392603874206543s
Fetching git [REP 'https://github.com/autotest/tp-libvirt.git' BRANCH 'master'] -> /var/lib/avocado/data/avocado-vt/virttest/test-providers.d/downloads/io-github-autotest-libvirt
Running '/usr/bin/git fetch -q -f -u -t https://github.com/autotest/tp-libvirt.git master:master'

3.执行avocado vt-bootstrap

执行过程中会去avocado官网下载qcow2文件,注意选择y。

avocado vt-bootstrap --vt-type qemu
...
8 - Verifying (and possibly downloading) guest image
Verifying expected SHA1 sum from https://avocado-project.org/data/assets/jeos/27/SHA1SUM_JEOS_27_64
Expected SHA1 sum: ce560ecdd5adaeaf00895f70cf4bdeecda9defd2
Found /var/lib/avocado/data/avocado-vt/images/jeos-27-x86_64.qcow2.xz
Actual SHA1 sum: da39a3ee5e6b4b0d3255bfef95601890afd80709
The file seems corrupted or outdated. Would you like to download it? (y/n) y

vt-bootstrap执行成功后可以使用avocado list --vt-type qemu命令查看qemu的测试用例:

[root@ip avocado]# avocado list --vt-type qemu
WARNING:root:No python imaging library installed. Screendump and Windows guest BSOD detection are disabled. In order to enable it, please install python-imaging or the equivalent for your distro.
WARNING:root:No python imaging library installed. PPM image conversion to JPEG disabled. In order to enable it, please install python-imaging or the equivalent for your distro.
VT io-github-autotest-qemu.unattended_install.url.extra_cdrom_ks.default_install.aio_native
VT io-github-autotest-qemu.unattended_install.url.extra_cdrom_ks.default_install.aio_threads
VT io-github-autotest-qemu.unattended_install.url.extra_cdrom_ks.perf.aio_native
VT io-github-autotest-qemu.unattended_install.url.extra_cdrom_ks.perf.aio_threads
...

4.执行测试

[root@ip avocado]# avocado run io-github-autotest-qemu
WARNING:root:No python imaging library installed. Screendump and Windows guest BSOD detection are disabled. In order to enable it, please install python-imaging or the equivalent for your distro.
WARNING:root:No python imaging library installed. PPM image conversion to JPEG disabled. In order to enable it, please install python-imaging or the equivalent for your distro.

可以看到其日志文件在/root/avocado/job-results/job-/job.log。

附:执行avocado vt-bootstrap的过程:

[root@ip images]# avocado vt-bootstrap --vt-type qemu
WARNING:root:No python imaging library installed. Screendump and Windows guest BSOD detection are disabled. In order to enable it, please install python-imaging or the equivalent for your distro.
WARNING:root:No python imaging library installed. PPM image conversion to JPEG disabled. In order to enable it, please install python-imaging or the equivalent for your distro.
Running bootstrap for qemu

1 - Checking the mandatory programs and headers

2 - Checking the recommended programs

3 - Updating test providers repo configuration from local copy

4 - Updating the test providers from remote repos

5 - Verifying directories

6 - Syncing backend dirs /usr/local/lib/python3.6/site-packages/virttest/backends -> /var/lib/avocado/data/avocado-vt/backends

7 - Generating config set

8 - Verifying (and possibly downloading) guest image

9 - Checking for modules kvm, kvm-intel
Module kvm loaded
Module kvm-intel loaded

VT-BOOTSTRAP FINISHED

0
  1. 支付宝打赏

    qrcode alipay
  2. 微信打赏

    qrcode weixin

评论区