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 <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2022-10-20 10:30:00 +02:00
parent 868ffe3b90
commit cc2cdb3324

View 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) \