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