From: Anthony Liguori <anthony@codemonkey.ws>
To: Lucas Meneghel Rodrigues <lmr@redhat.com>
Cc: QEMU devel <qemu-devel@nongnu.org>,
Scott Zawalski <scottz@google.com>,
Cleber Rosa <crosa@redhat.com>,
Autotest Mailing List <autotest@test.kernel.org>,
"kvm-autotest@redhat.com" <kvm-autotest@redhat.com>,
Ademar Reis <areis@redhat.com>
Subject: Re: [Qemu-devel] [RFC] Future goals for autotest and virtualization tests
Date: Thu, 08 Mar 2012 07:36:11 -0600 [thread overview]
Message-ID: <4F58B5CB.8040503@codemonkey.ws> (raw)
In-Reply-To: <4F582EDB.1040608@redhat.com>
On 03/07/2012 10:00 PM, Lucas Meneghel Rodrigues wrote:
> Hi guys. For a while we have been discussing ways to make the virtualization
> tests written on top of autotest useful for development level testing.
>
> One of our main goals is to provide useful tools for the qemu community, since
> we have a good number of tests and libraries written to perform integration/QA
> testing for that tool, being successfuly used by a number of QA teams that work
> on qemu. Also, we recently provided a subset of that infrastructure to test
> libvirt, one of our virtualization projects of interest.
>
> We realized that some (admittedly not very radical) changes have to be made on
> autotest itself, so we're inviting other users of autotest to give this a good
> read. This same document lives in the autotest wiki:
>
> https://github.com/autotest/autotest/wiki/FuturePlans
>
> Please note that splitting the virt tests from autotest is not discarded at the
> moment, and it's not incompatible with the plan outlined below.
>
> ====================================
> Virt tests and autotest future goals
> ====================================
>
> In order to make the autotest infrastructure, and the virt tests developed on
> top of autotest more useful for the people working on developing linux, virt and
> other platform software, as well as the QA teams, we are working on a number of
> goals, to streamline, simplify and make the available tools appropriate for
> *development level testing*.
>
> Executing tests appropriate for *QA level testing* will continue to be
> supported, as it's one of the biggest strenghts of autotest.
>
> The problem
> -----------
>
> Autotest provides as of today a local engine, used to run tests on your local
> machine (your laptop or a remote server). Currently, it runs tests properly
> wrapped and packaged under the autotest client/tests/ folder, using specific
> autotest rules.
>
> For the virt tests that live inside autotest, we have even more rules to follow,
> causing a lot of frustration for people that are not used to how things are
> structured and how to execute and select tests.
>
> The proposed solution
> ---------------------
>
> A solution is needed for both scenarios (virt and other general purpose tests).
> The idea is to create specialized tools can run simple tests without packaging,
> code that:
>
> * Knows nothing about the underlying infrastructure
> * Written in any language (shell script, c, perl, you name it)
>
> It'll be up to the test runner to make sense of the results, provided that the
> test writer follows some simple common sense principles while writing the code:
>
> 1) Make the program to return 0 on success, !=0 on failure
> 2) Make the program use a test output format, mainly TAP
We're using gtest in QEMU, not TAP--for better or worse. If autotest could use
the gtest protocol, it would integrate much better with QEMU's tests.
Within QEMU, everything should be gtest when possible.
> For simple tests, we believe that option 1) will be far more popular. Autotest
> will harness the execution of the test and put the results under the test
> results directory, with all the sysinfo collection and other instrumentation
> transparently available for the user.
>
> At some point, the test writer might want to start the framework features that
> need to be enabled explicitly, then he/she might want to learn how to use the
> python API to do so, but it'll not be a requirement.
>
> More about the test runner
> --------------------------
>
> The test runner for both general and virt cases should have very simple and
> minimal output:
>
> ::
>
> Results stored in /path/to/autotest/results/default
> my-full-test.py -- PASS
> my-other-test.py -- PASS
> look-mom-i-can-use-shell.sh -- PASS
> look-mom-i-can-use-perl.pl -- FAIL
> test-name-is-the-description.sh -- PASS
> my-yet-another-test.sh -- SKIPPED
> i-like-python.py -- PASS
> whatever-test.pl -- PASS
>
> Both will be specialized tools that use the infrastructure of
> client/bin/autotest-local, but with special code to attend to the output spec
> above. They will know how to handle dependencies, and skip tests if needed.
>
> Directory structure
> -------------------
>
> This is just to give a rough idea of how we won't depend the tests to be in the
> autotest source code folder:
>
> ::
>
> /path/to/autotest -> top level dir, that will make the autotest libs available
> - client/bin -> Contains the test runners and auxiliary scripts
> - client/virt/tests: Contains the virt tests that still live in autotest
> - client/tests/kvm/tests: Contains the qemu tests that still live in autotest
>
> /any/path/test1: Contains tests for software foo
> /any/path/test2: Contains tests for software bar
>
> /any/path/images: Contains minimal guest images for virtualization tests
>
> Bootstrap procedure
> -------------------
>
> In order to comfortably use the framework features, some bootstrap steps will be
> needed, along the following lines:
>
> ::
>
> git clone git://github.com/autotest/autotest.git /path/to/autotest
> export PATH='/path/to/autotest/client/bin':$PATH
> export PYTHON_PATH='/path/to/autotest':$PYTHON_PATH
> export AUTOTEST_DATA='/path/to/images'
>
> Writing tests
> -------------
>
> Simple tests, general case
> ~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> As previously mentioned, writing a trivial test is as simple as writing a
> program that returns either 0 (true) or any other value (false). Autotest
> returns PASS on true and FAIL on false.
>
> Simple tests, virt case
> ~~~~~~~~~~~~~~~~~~~~~~~
>
> The difference is that the program might be executed in the guest or the host,
> so a command line flag or environment variable might be set to indicate where
> the program should be executed (host, guest or both). Autotest returns PASS on
> true and FAIL on false. This functionality is inspired on qemu-test, thanks to
> Anthony Liguori.
>
> Instrumented tests, general case
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> The test author can learn how to create an autotest wrapper for the test suite
> and use the specialized tool to run it.
>
> Instrumented tests, virt case
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> The test author can learn how to create an instrumented test for virtualization,
> using the python APIs, or any other language using auxiliary scripts that
> encapsulate high level functionality for use on shell scripts or other
> languages. Ideas for auxiliary scripts:
>
> ::
>
> virt_run_migration [params] [options]
> virt_run_timedrift [params] [options]
> virt_run_nic_hotplug [params] [options]
> virt_run_block_hotplug [params] [options]
>
> Where tests live
> ----------------
>
> The tests won't need to be in the autotest tree, they can live anywhere. The
> reason for this is that projects need in tree tests, that can be maintained by
> the project maintainers.
>
> Standard use case for virt is to have both trivial and instrumented tests living
> in the respective project's tree (qemu and libvirt). Trivial tests don't need
> autotest libs, while instrumented tests will need to, but that's OK provided
> that the appropriate bootstrap procedure was made.
>
> Test Examples
> -------------
>
> simple, non instrumented
> ~~~~~~~~~~~~~~~~~~~~~~~~
>
> ::
>
> uptime.sh:
> #!/bin/sh
> exec uptime
>
> uptime.py:
> #!/usr/bin/python
> import os, sys
> sys.exit(os.system("uptime"))
>
> uptime.pl:
> #!/usr/bin/perl
> system("uptime");
> exit($?);
>
> qemu-img-convert.sh
> #!/bin/bash
> qemu-img convert -O qcow2 $DATA/qemu-imgs/reference.vdi $TEMPDIR/output.qcow2
> diff -b $TEMPDIR/output.qcow2 $DATA/qemu-imgs/reference.qcow2 > /dev/null
> ...
>
> uptime.py - instrummented using libautotest
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> ::
>
> #!/bin/python
>
> from autotest import utils, logging
>
> def run_uptime_host(test, params, env):
> uptime = utils.system_output("uptime")
> logging.info("Host uptime result is: %s", uptime)
>
>
> uptime.py - host/guest mode, instrummented using libautotest
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> ::
>
> #!/bin/python
>
> from autotest import utils, logging
>
> def run_uptime_host_and_guest(test, params, env):
> vm = env.get_vm(params["main_vm"])
> vm.verify_alive()
> session = vm.wait_for_login()
>
> uptime_guest = session.cmd("uptime")
> logging.info("Guest uptime result is: %s", uptime_guest)
>
> uptime_host = utils.system_output("uptime")
> logging.info("Host uptime result is: %s", uptime_host)
>
>
> Virt/qemu tests: Minimal guest images
> -------------------------------------
>
> In order to make development level test possible, we need the tests to run fast.
> In order to do that, a set of minimal guest images is being developed and we
> have a version for x86_64 ready and functional:
>
> https://github.com/autotest/buildroot-autotest
I'm really not a fan of buildroot. Note that in order to ship binaries, full
source needs to be provided in order to comply with the GPL. The FSF at least
states that referring to another website for source that's not under your
control doesn't satisfy the requirements of the GPL.
Just out of curiosity, did you try to use qemu-test? Is there a reason you
created something different?
I think it's good that you're thinking about how to make writing tests easier,
but we have a growing test infrastructure in QEMU and that's what I'd prefer
people focused on.
Regards,
Anthony Liguori
next prev parent reply other threads:[~2012-03-08 13:36 UTC|newest]
Thread overview: 84+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-08 4:00 [Qemu-devel] [RFC] Future goals for autotest and virtualization tests Lucas Meneghel Rodrigues
2012-03-08 11:44 ` Stefan Hajnoczi
2012-03-08 11:54 ` Stefan Hajnoczi
2012-03-08 12:17 ` Ademar Reis
2012-03-08 12:18 ` Ademar Reis
2012-03-09 11:48 ` [Qemu-devel] [KVM-AUTOTEST] " Osier Yang
2012-03-08 12:28 ` [Qemu-devel] " Cleber Rosa
2012-03-08 13:06 ` Stefan Hajnoczi
2012-03-08 13:36 ` Anthony Liguori [this message]
2012-03-08 14:01 ` Lucas Meneghel Rodrigues
2012-03-08 14:48 ` Anthony Liguori
2012-03-08 15:00 ` Ademar Reis
2012-03-08 23:59 ` Andreas Färber
2012-03-09 0:08 ` Ademar Reis
2012-03-08 14:49 ` Ademar Reis
2012-03-08 14:56 ` Anthony Liguori
2012-03-08 15:07 ` Ademar Reis
2012-03-08 15:14 ` Anthony Liguori
2012-03-08 16:05 ` Ademar Reis
2012-03-08 17:03 ` Anthony Liguori
2012-03-08 17:59 ` Ademar Reis
2012-03-08 18:21 ` Lucas Meneghel Rodrigues
2012-03-08 18:22 ` Lucas Meneghel Rodrigues
2012-03-08 19:16 ` Anthony Liguori
2012-03-08 21:02 ` Ademar Reis
2012-03-08 21:24 ` Anthony Liguori
2012-03-08 22:24 ` Ademar Reis
2012-03-08 23:21 ` Anthony Liguori
2012-03-08 23:51 ` Ademar Reis
2012-03-09 9:41 ` Stefan Hajnoczi
2012-03-09 14:00 ` Ademar Reis
2012-03-09 14:54 ` Stefan Hajnoczi
2012-03-09 15:01 ` Ademar Reis
2012-03-09 15:17 ` Stefan Hajnoczi
2012-03-09 11:14 ` Kevin Wolf
2012-03-09 11:59 ` Anthony Liguori
2012-03-09 12:13 ` Kevin Wolf
2012-03-09 12:24 ` Anthony Liguori
2012-03-09 11:20 ` Cleber Rosa
2012-03-09 12:04 ` Anthony Liguori
2012-03-09 12:40 ` Cleber Rosa
2012-03-09 12:42 ` Anthony Liguori
2012-03-09 12:46 ` Cleber Rosa
2012-03-08 23:07 ` Lucas Meneghel Rodrigues
2012-03-08 23:56 ` Ademar Reis
2012-03-09 0:04 ` Anthony Liguori
2012-03-09 13:24 ` Paolo Bonzini
2012-03-09 12:13 ` Anthony Liguori
2012-03-09 12:48 ` Lucas Meneghel Rodrigues
2012-03-09 14:13 ` Anthony Liguori
2012-03-09 14:40 ` Lucas Meneghel Rodrigues
2012-03-09 14:40 ` Ademar Reis
2012-03-09 13:07 ` Paolo Bonzini
2012-03-09 13:56 ` Anthony Liguori
2012-03-09 14:43 ` Paolo Bonzini
2012-03-09 14:48 ` Anthony Liguori
2012-03-09 13:03 ` Paolo Bonzini
2012-03-08 15:46 ` Kevin Wolf
2012-03-08 15:57 ` Ademar Reis
2012-03-08 16:10 ` Anthony Liguori
2012-03-08 16:34 ` Kevin Wolf
2012-03-08 16:36 ` Anthony Liguori
2012-03-08 16:46 ` Ademar Reis
2012-03-08 16:47 ` Kevin Wolf
2012-03-08 16:08 ` Anthony Liguori
2012-03-08 15:19 ` Lucas Meneghel Rodrigues
2012-03-08 18:57 ` Anthony Liguori
2012-03-08 19:34 ` Lucas Meneghel Rodrigues
2012-03-08 19:43 ` Anthony Liguori
2012-03-08 20:17 ` Lucas Meneghel Rodrigues
2012-03-08 21:02 ` Andreas Färber
2012-03-08 21:03 ` Anthony Liguori
2012-03-09 13:36 ` Paolo Bonzini
2012-03-09 14:01 ` Anthony Liguori
2012-03-09 14:30 ` Paolo Bonzini
2012-03-09 14:43 ` Anthony Liguori
2012-03-09 15:00 ` Paolo Bonzini
2012-03-09 15:02 ` Anthony Liguori
2012-03-09 15:17 ` Paolo Bonzini
2012-03-09 15:24 ` Anthony Liguori
2012-03-09 15:34 ` Paolo Bonzini
2012-03-09 15:48 ` Anthony Liguori
2012-03-09 17:02 ` Cleber Rosa
2012-03-08 14:04 ` Alon Levy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4F58B5CB.8040503@codemonkey.ws \
--to=anthony@codemonkey.ws \
--cc=areis@redhat.com \
--cc=autotest@test.kernel.org \
--cc=crosa@redhat.com \
--cc=kvm-autotest@redhat.com \
--cc=lmr@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=scottz@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).