[libvirt] [PATCHv2 5/5] storage: test backing chain traversal
Eric Blake
eblake at redhat.com
Fri Feb 15 22:43:58 UTC 2013
On 02/15/2013 03:26 PM, Peter Krempa wrote:
> On 02/15/13 21:38, Eric Blake wrote:
>> Testing our backing chain handling will make it much easier to
>> ensure that we avoid issues in the future. If only I had written
>> this test before I first caused several regressions...
>>
>> * tests/virstoragetest.c: New test.
>> * tests/Makefile.am (test_programs): Build it.
>> * .gitignore: Ignore new files.
>> ---
>> .gitignore | 1 +
>> tests/Makefile.am | 6 +
>> tests/virstoragetest.c | 546
>> +++++++++++++++++++++++++++++++++++++++++++++++++
>> 3 files changed, 553 insertions(+)
>> create mode 100644 tests/virstoragetest.c
>
> I just skimmed through this test as I don't feel well enough to review
> it thoroughly. It seems OK to me and it compiles and runs okay so I give
> a weak ACK.
I did one more thing to strengthen the test; I'm squashing this before
pushing.
diff --git i/tests/virstoragetest.c w/tests/virstoragetest.c
index 6b4ca99..9da58f3 100644
--- i/tests/virstoragetest.c
+++ w/tests/virstoragetest.c
@@ -228,8 +228,16 @@ testStorageChain(const void *args)
fprintf(stderr, "call should have failed\n");
goto cleanup;
}
- if (data->flags & EXP_WARN)
+ if (data->flags & EXP_WARN) {
+ if (!virGetLastError()) {
+ fprintf(stderr, "call should have warned\n");
+ goto cleanup;
+ }
virResetLastError();
+ } else if (virGetLastError()) {
+ fprintf(stderr, "call should not have warned\n");
+ goto cleanup;
+ }
elt = meta;
while (elt) {
@@ -498,10 +506,10 @@ mymain(void)
/* Qcow2 file with backing protocol instead of file */
const testFileData chain11[] = { qcow2_protocol };
TEST_CHAIN(11, "qcow2", absqcow2, VIR_STORAGE_FILE_QCOW2,
- chain11, EXP_WARN,
- chain11, ALLOW_PROBE | EXP_WARN,
- chain11, EXP_WARN,
- chain11, ALLOW_PROBE | EXP_WARN);
+ chain11, EXP_PASS,
+ chain11, ALLOW_PROBE | EXP_PASS,
+ chain11, EXP_PASS,
+ chain11, ALLOW_PROBE | EXP_PASS);
/* qed file */
const testFileData chain12a[] = { raw };
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130215/1313d0eb/attachment-0001.sig>
More information about the libvir-list
mailing list