]> xenbits.xensource.com Git - libvirt.git/commitdiff
tests: virlogtest: Fix testLogParseOutputs return value
authorErik Skultety <eskultet@redhat.com>
Thu, 17 Mar 2016 09:16:19 +0000 (10:16 +0100)
committerErik Skultety <eskultet@redhat.com>
Thu, 24 Mar 2016 15:39:28 +0000 (16:39 +0100)
The test can return positive value even though it should have failed. It just
returns the value parser returned, which should be flipped back to -1 if
something went wrong or the result was unexpected, but it isn't.

tests/virlogtest.c

index 4eef4fd25be680e3ebbcf3207bc90dbd7c29bce0..acb0b0829f0c8e5f5223fab41ffe300cf9dcad78 100644 (file)
@@ -47,10 +47,11 @@ static int
 testLogParseOutputs(const void *opaque)
 {
     int ret = -1;
+    int noutputs;
     const struct testLogData *data = opaque;
 
-    ret = virLogParseOutputs(data->str);
-    if (ret < 0) {
+    noutputs = virLogParseOutputs(data->str);
+    if (noutputs < 0) {
         if (!data->pass) {
             VIR_TEST_DEBUG("Got expected error: %s\n",
                            virGetLastErrorMessage());
@@ -58,9 +59,9 @@ testLogParseOutputs(const void *opaque)
             ret = 0;
             goto cleanup;
         }
-    } else if (ret != data->count) {
+    } else if (noutputs != data->count) {
             VIR_TEST_DEBUG("Expected number of parsed outputs is %d, "
-                           "but got %d\n", data->count, ret);
+                           "but got %d\n", data->count, noutputs);
             goto cleanup;
     } else if (!data->pass) {
         VIR_TEST_DEBUG("Test should have failed\n");