[libvirt] [PATCH][TCK] add test for get and define save image xml

xhu xhu at redhat.com
Wed Jan 11 08:08:17 UTC 2012


  On 01/11/2012 01:13 AM, Daniel P. Berrange wrote:
> On Mon, Jan 09, 2012 at 03:43:47PM +0800, Xiaoqiang Hu wrote:
>> add test for get and define save image xml and there are types of save image
>> file covered in the test: persistent, transient and invalid domain save image
>>
>> ---
>>   scripts/qemu/400-save-image-xml.t |  107 +++++++++++++++++++++++++++++++++++++
>>   1 files changed, 107 insertions(+), 0 deletions(-)
>>   create mode 100644 scripts/qemu/400-save-image-xml.t
>>
>> diff --git a/scripts/qemu/400-save-image-xml.t b/scripts/qemu/400-save-image-xml.t
>> new file mode 100644
>> index 0000000..d584de1
>> --- /dev/null
>> +++ b/scripts/qemu/400-save-image-xml.t
>> @@ -0,0 +1,107 @@
>> +# -*- perl -*-
>> +#
>> +# Copyright (C) 2012-2013 Red Hat, Inc.
>> +# Copyright (C) 2012-2013 Xiaoqiang Hu<xhu at redhat.com>
>> +#
>> +# This program is free software; You can redistribute it and/or modify
>> +# it under the GNU General Public License as published by the Free
>> +# Software Foundation; either version 2, or (at your option) any
>> +# later version
>> +#
>> +# The file "LICENSE" distributed along with this file provides full
>> +# details of the terms and conditions
>> +#
>> +
>> +=pod
>> +
>> +=head1 NAME
>> +
>> +qemu/400-save-image-xml.t: test get and define xml from save image
>> +
>> +=head1 DESCRIPTION
>> +
>> +The test case validates that it is possible to define and get domain xml
>> +from save image. There are three types of save image file covered in the
>> +test: persistent, transient and invalid domain save image
>> +=cut
>> +
>> +use strict;
>> +use warnings;
>> +
>> +use Test::More tests =>  10;
>> +
>> +use Sys::Virt::TCK;
>> +use Test::Exception;
>> +
>> +my $tck = Sys::Virt::TCK->new();
>> +my $conn = eval { $tck->setup(); };
>> +BAIL_OUT "failed to setup test harness: $@" if $@;
>> +END {
>> +    $tck->cleanup if $tck;
>> +    unlink "tck.img" if -f "tck.img";
>> +}
>> +
>> +SKIP:{
>> +    skip "Only relevant to QEMU driver", 10 unless $conn->get_type() eq "QEMU";
>> +
>> +    # scenario 1 - get/define xml from transient domain save image
>> +    my $xml = $tck->generic_domain("tck")->as_xml;
>> +    diag "Creating a new transient domain";
>> +    my $dom;
>> +    ok_domain(sub { $dom = $conn->create_domain($xml) }, "created transient domain object");
>> +
>> +    unlink "tck.img" if -f "tck.img";
>> +    eval { $dom->save("tck.img"); };
> We should probably prefix $tck->scratch_dir() onto the front of
> all cases of 'tck.img' in this script. This ensures we don't
> fill up the current working directory with test files.
ok and i have sent the v2 patch.
Thanks for reviewing!
>
> Apart from that, this test looks good.
>
>
> Daniel




More information about the libvir-list mailing list