]> xenbits.xensource.com Git - libvirt.git/commitdiff
tests: virschema: Propagate errors from directory traversal in testSchemaDir
authorPeter Krempa <pkrempa@redhat.com>
Tue, 19 Nov 2019 10:55:05 +0000 (11:55 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 20 Nov 2019 11:57:50 +0000 (12:57 +0100)
testSchemaDir is a helper which invokes the schema test using virTestRun
on all schema files. Since the function itself is not called inside
virTestRun any helper function call is not dispatched to the user and
thus it's hard to debug the test. Propagate errors from the directory
traversal.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
tests/virschematest.c

index 8a2322b3bd8d5069876f036a2df70de5d99874bc..df50ef17173b81e65cfdfe39550a1c675ffecf8b 100644 (file)
@@ -76,8 +76,10 @@ testSchemaDir(const char *schema,
         .validator = validator,
     };
 
-    if (virDirOpen(&dir, dir_path) < 0)
+    if (virDirOpen(&dir, dir_path) < 0) {
+        virTestPropagateLibvirtError();
         return -1;
+    }
 
     while ((rc = virDirRead(dir, &ent, dir_path)) > 0) {
         g_autofree char *test_name = NULL;
@@ -97,8 +99,10 @@ testSchemaDir(const char *schema,
             ret = -1;
     }
 
-    if (rc < 0)
+    if (rc < 0) {
+        virTestPropagateLibvirtError();
         ret = -1;
+    }
 
     VIR_DIR_CLOSE(dir);
     return ret;