[PATCH v1] tests: Adjust libxlxml2domconfigtest to work with Xen < 4.8

Olaf Hering posted 1 patch 3 years, 1 month ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20210308132931.8756-1-olaf@aepfle.de
tests/libxlxml2domconfigtest.c | 6 ++++++
1 file changed, 6 insertions(+)
[PATCH v1] tests: Adjust libxlxml2domconfigtest to work with Xen < 4.8
Posted by Olaf Hering 3 years, 1 month ago
Commit fcdc387410fadfb066b95395c5b5d2a6a16f7066 used a libxl API which
is only available since Xen 4.8.

Due to lack of a specific guard for this API change, reuse another
guard from libxl.h.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
---
 tests/libxlxml2domconfigtest.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tests/libxlxml2domconfigtest.c b/tests/libxlxml2domconfigtest.c
index d58be1211b..c13a562a3c 100644
--- a/tests/libxlxml2domconfigtest.c
+++ b/tests/libxlxml2domconfigtest.c
@@ -105,7 +105,13 @@ testCompareXMLToDomConfig(const char *xmlfile,
      */
 # ifndef LIBXL_HAVE_BUILDINFO_APIC
     if (expectconfig.c_info.type == LIBXL_DOMAIN_TYPE_HVM) {
+# ifdef LIBXL_HAVE_MEMKB_64BITS
+        /*
+         * This part of the libxl API was changed without a guard in Xen 4.8.
+         * Reuse another Xen 4.8 specific conditional.
+         */
         libxl_defbool_unset(&expectconfig.b_info.acpi);
+# endif
         libxl_defbool_set(&expectconfig.b_info.u.hvm.apic, true);
         libxl_defbool_set(&expectconfig.b_info.u.hvm.acpi, true);
     }

Re: [PATCH v1] tests: Adjust libxlxml2domconfigtest to work with Xen < 4.8
Posted by Daniel Henrique Barboza 3 years, 1 month ago

On 3/8/21 10:29 AM, Olaf Hering wrote:
> Commit fcdc387410fadfb066b95395c5b5d2a6a16f7066 used a libxl API which
> is only available since Xen 4.8.
> 
> Due to lack of a specific guard for this API change, reuse another
> guard from libxl.h.
> 
> Signed-off-by: Olaf Hering <olaf@aepfle.de>
> ---

The patch failed the sc_preprocessor_indentation test:

--- stderr ---
cppi: /home/danielhb/kvm-project/libvirt/tests/libxlxml2domconfigtest.c: line 108: not properly indented
cppi: /home/danielhb/kvm-project/libvirt/tests/libxlxml2domconfigtest.c: line 114: not properly indented
build-aux/syntax-check.mk: incorrect preprocessor indentation
make: *** [/home/danielhb/kvm-project/libvirt/build-aux/syntax-check.mk:762: sc_preprocessor_indentation] Error 1



This change fixes it:

$ git diff
diff --git a/tests/libxlxml2domconfigtest.c b/tests/libxlxml2domconfigtest.c
index c13a562a3c..3c133ac6f0 100644
--- a/tests/libxlxml2domconfigtest.c
+++ b/tests/libxlxml2domconfigtest.c
@@ -105,13 +105,13 @@ testCompareXMLToDomConfig(const char *xmlfile,
       */
  # ifndef LIBXL_HAVE_BUILDINFO_APIC
      if (expectconfig.c_info.type == LIBXL_DOMAIN_TYPE_HVM) {
-# ifdef LIBXL_HAVE_MEMKB_64BITS
+#  ifdef LIBXL_HAVE_MEMKB_64BITS
          /*
           * This part of the libxl API was changed without a guard in Xen 4.8.
           * Reuse another Xen 4.8 specific conditional.
           */
          libxl_defbool_unset(&expectconfig.b_info.acpi);
-# endif
+#  endif
          libxl_defbool_set(&expectconfig.b_info.u.hvm.apic, true);
          libxl_defbool_set(&expectconfig.b_info.u.hvm.acpi, true);
      }
$


If the maintainer is willing to amend it before pushing it:


Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>


>   tests/libxlxml2domconfigtest.c | 6 ++++++
>   1 file changed, 6 insertions(+)
> 
> diff --git a/tests/libxlxml2domconfigtest.c b/tests/libxlxml2domconfigtest.c
> index d58be1211b..c13a562a3c 100644
> --- a/tests/libxlxml2domconfigtest.c
> +++ b/tests/libxlxml2domconfigtest.c
> @@ -105,7 +105,13 @@ testCompareXMLToDomConfig(const char *xmlfile,
>        */
>   # ifndef LIBXL_HAVE_BUILDINFO_APIC
>       if (expectconfig.c_info.type == LIBXL_DOMAIN_TYPE_HVM) {
> +# ifdef LIBXL_HAVE_MEMKB_64BITS
> +        /*
> +         * This part of the libxl API was changed without a guard in Xen 4.8.
> +         * Reuse another Xen 4.8 specific conditional.
> +         */
>           libxl_defbool_unset(&expectconfig.b_info.acpi);
> +# endif
>           libxl_defbool_set(&expectconfig.b_info.u.hvm.apic, true);
>           libxl_defbool_set(&expectconfig.b_info.u.hvm.acpi, true);
>       }
> 

Re: [PATCH v1] tests: Adjust libxlxml2domconfigtest to work with Xen < 4.8
Posted by Jim Fehlig 3 years, 1 month ago
On 3/16/21 12:57 PM, Daniel Henrique Barboza wrote:
> 
> 
> On 3/8/21 10:29 AM, Olaf Hering wrote:
>> Commit fcdc387410fadfb066b95395c5b5d2a6a16f7066 used a libxl API which
>> is only available since Xen 4.8.
>>
>> Due to lack of a specific guard for this API change, reuse another
>> guard from libxl.h.
>>
>> Signed-off-by: Olaf Hering <olaf@aepfle.de>
>> ---
> 
> The patch failed the sc_preprocessor_indentation test:
> 
> --- stderr ---
> cppi: /home/danielhb/kvm-project/libvirt/tests/libxlxml2domconfigtest.c: line 
> 108: not properly indented
> cppi: /home/danielhb/kvm-project/libvirt/tests/libxlxml2domconfigtest.c: line 
> 114: not properly indented
> build-aux/syntax-check.mk: incorrect preprocessor indentation
> make: *** [/home/danielhb/kvm-project/libvirt/build-aux/syntax-check.mk:762: 
> sc_preprocessor_indentation] Error 1
> 
> 
> 
> This change fixes it:
> 
> $ git diff
> diff --git a/tests/libxlxml2domconfigtest.c b/tests/libxlxml2domconfigtest.c
> index c13a562a3c..3c133ac6f0 100644
> --- a/tests/libxlxml2domconfigtest.c
> +++ b/tests/libxlxml2domconfigtest.c
> @@ -105,13 +105,13 @@ testCompareXMLToDomConfig(const char *xmlfile,
>        */
>   # ifndef LIBXL_HAVE_BUILDINFO_APIC
>       if (expectconfig.c_info.type == LIBXL_DOMAIN_TYPE_HVM) {
> -# ifdef LIBXL_HAVE_MEMKB_64BITS
> +#  ifdef LIBXL_HAVE_MEMKB_64BITS
>           /*
>            * This part of the libxl API was changed without a guard in Xen 4.8.
>            * Reuse another Xen 4.8 specific conditional.
>            */
>           libxl_defbool_unset(&expectconfig.b_info.acpi);
> -# endif
> +#  endif
>           libxl_defbool_set(&expectconfig.b_info.u.hvm.apic, true);
>           libxl_defbool_set(&expectconfig.b_info.u.hvm.acpi, true);
>       }
> $
> 
> 
> If the maintainer is willing to amend it before pushing it:
> 
> 
> Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>

I've squashed in your adjustment, added R-B's, and pushed it.

Regards,
Jim

> 
> 
>>   tests/libxlxml2domconfigtest.c | 6 ++++++
>>   1 file changed, 6 insertions(+)
>>
>> diff --git a/tests/libxlxml2domconfigtest.c b/tests/libxlxml2domconfigtest.c
>> index d58be1211b..c13a562a3c 100644
>> --- a/tests/libxlxml2domconfigtest.c
>> +++ b/tests/libxlxml2domconfigtest.c
>> @@ -105,7 +105,13 @@ testCompareXMLToDomConfig(const char *xmlfile,
>>        */
>>   # ifndef LIBXL_HAVE_BUILDINFO_APIC
>>       if (expectconfig.c_info.type == LIBXL_DOMAIN_TYPE_HVM) {
>> +# ifdef LIBXL_HAVE_MEMKB_64BITS
>> +        /*
>> +         * This part of the libxl API was changed without a guard in Xen 4.8.
>> +         * Reuse another Xen 4.8 specific conditional.
>> +         */
>>           libxl_defbool_unset(&expectconfig.b_info.acpi);
>> +# endif
>>           libxl_defbool_set(&expectconfig.b_info.u.hvm.apic, true);
>>           libxl_defbool_set(&expectconfig.b_info.u.hvm.acpi, true);
>>       }
>>
>