[PATCH 05/12] virschematest: Construct path to the schema in the SCHEMAS_PATH

Jonathon Jongsma jjongsma at redhat.com
Tue Nov 1 15:45:14 UTC 2022


On 11/1/22 9:01 AM, Peter Krempa wrote:
> 'abs_top_srcdir' can be prepended to the schema in the macro. Apart from
> removing one needles string copy it will also allow pointing to schema

needless

> files in the builddir which will come handy in upcoming patches.
> 
> Signed-off-by: Peter Krempa <pkrempa at redhat.com>
> ---
>   tests/virschematest.c | 7 ++-----
>   1 file changed, 2 insertions(+), 5 deletions(-)
> 
> 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) \



More information about the libvir-list mailing list