]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virschematest: Construct path to the schema in the SCHEMAS_PATH
authorPeter Krempa <pkrempa@redhat.com>
Thu, 20 Oct 2022 08:30:00 +0000 (10:30 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 2 Nov 2022 08:26:03 +0000 (09:26 +0100)
'abs_top_srcdir' can be prepended to the schema in the macro. Apart from
removing one needless string copy it will also allow pointing to schema
files in the builddir which will come handy in upcoming patches.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
tests/virschematest.c

index 3c91bd37bb5548d526ed83e3d5a175cba514d478..2a89f6a1c04279eb6a6c4fc0903c3726d3896860 100644 (file)
@@ -151,13 +151,10 @@ testSchemaGrammarReport(const void *opaque)
 static virXMLValidator *
 testSchemaGrammarLoad(const char *schema)
 {
-    g_autofree char *schema_path = NULL;
     g_autofree char *testname = NULL;
     virXMLValidator *ret;
 
-    schema_path = g_strdup_printf("%s/%s", abs_top_srcdir, schema);
-
-    ret = virXMLValidatorInit(schema_path);
+    ret = virXMLValidatorInit(schema);
 
     testname = g_strdup_printf("test schema grammar file: '%s'", schema);
 
@@ -335,7 +332,7 @@ mymain(void)
 {
     int ret = 0;
 
-#define SCHEMAS_PATH "src/conf/schemas/"
+#define SCHEMAS_PATH abs_top_srcdir "/src/conf/schemas/"
 
 #define DO_TEST(sch, ent) \
     if (testSchemaEntries((sch), (ent), G_N_ELEMENTS(ent)) < 0) \