From: Peter Krempa Date: Thu, 20 Oct 2022 08:30:00 +0000 (+0200) Subject: virschematest: Construct path to the schema in the SCHEMAS_PATH X-Git-Tag: v8.10.0-rc1~202 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cc2cdb3324d16df30477e9b75956672be6549a5e;p=thirdparty%2Flibvirt.git virschematest: Construct path to the schema in the SCHEMAS_PATH '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 Reviewed-by: Ján Tomko --- diff --git a/tests/virschematest.c b/tests/virschematest.c index 3c91bd37bb..2a89f6a1c0 100644 --- a/tests/virschematest.c +++ b/tests/virschematest.c @@ -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) \