[libvirt] [PATCH 2/2] tests: Add tests for CPU selection in qemu driver

Eric Blake eblake at redhat.com
Wed Dec 1 17:59:29 UTC 2010


On 12/01/2010 07:56 AM, Jiri Denemark wrote:
> ---
> diff --git a/tests/qemuxml2argvdata/qemu.sh b/tests/qemuxml2argvdata/qemu.sh
> new file mode 100755
> index 0000000..6d5d354
> --- /dev/null
> +++ b/tests/qemuxml2argvdata/qemu.sh
> @@ -0,0 +1,64 @@
> +#! /bin/sh

> +real_qemu()
> +{
> +    if test x$qemu != x; then
> +        exec $qemu "$@"
> +    else
> +        return 1
> +    fi
> +}
> +
> +faked_machine()
> +{
> +    echo "pc"
> +}

> +case $* in
> +"-M ?")
> +    faked_machine
> +    ;;
> +"-cpu ?")
> +    faked_cpu
> +    ;;
> +*)
> +    real_qemu "$@"
> +    ;;
> +esac

Nice - you can control the output of possible machines and cpus, even if
a qemu upgrade gains support for more names later.

> @@ -223,6 +226,10 @@ mymain(int argc, char **argv)
>      if (!abs_srcdir)
>          abs_srcdir = getcwd(cwd, sizeof(cwd));
>  
> +    abs_top_srcdir = getenv("abs_top_srcdir");
> +    if (!abs_top_srcdir)
> +        abs_top_srcdir = "..";

Not really absolute, is it?  But it matches other tests, and does the
job, so no need to change it.

ACK.

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20101201/d611e2f1/attachment-0001.sig>


More information about the libvir-list mailing list