qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tests/tcg: Do not use inttypes.h in multiarch/system/memory.c
@ 2024-10-10  8:58 Ilya Leoshkevich
  2024-10-10  9:20 ` Paolo Bonzini
  0 siblings, 1 reply; 6+ messages in thread
From: Ilya Leoshkevich @ 2024-10-10  8:58 UTC (permalink / raw)
  To: Alex Bennée; +Cc: qemu-devel, Ilya Leoshkevich

make check-tcg fails on Fedora with the following error message:

    alpha-linux-gnu-gcc [...] qemu/tests/tcg/multiarch/system/memory.c -o memory [...]
    qemu/tests/tcg/multiarch/system/memory.c:17:10: fatal error: inttypes.h: No such file or directory
       17 | #include <inttypes.h>
          |          ^~~~~~~~~~~~
    compilation terminated.

The reason is that Fedora has cross-compilers, but no cross-glibc
headers. Fix by hardcoding the format specifiers and dropping the
include.

An alternative fix would be to introduce a configure check for
inttypes.h. But this would make it impossible to use Fedora
cross-compilers for softmmu tests, which used to work so far.

Fixes: ecbcc9ead2f8 ("tests/tcg: add a system test to check memory instrumentation")
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
---
 tests/tcg/multiarch/system/memory.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/tests/tcg/multiarch/system/memory.c b/tests/tcg/multiarch/system/memory.c
index 65a6038a241..7508f6b916d 100644
--- a/tests/tcg/multiarch/system/memory.c
+++ b/tests/tcg/multiarch/system/memory.c
@@ -14,7 +14,6 @@
 
 #include <stdint.h>
 #include <stdbool.h>
-#include <inttypes.h>
 #include <minilib.h>
 
 #ifndef CHECK_UNALIGNED
@@ -511,8 +510,8 @@ int main(void)
     int i;
     bool ok = true;
 
-    ml_printf("Test data start: 0x%"PRIxPTR"\n", &test_data[0]);
-    ml_printf("Test data end: 0x%"PRIxPTR"\n", &test_data[TEST_SIZE]);
+    ml_printf("Test data start: 0x%lx\n", (unsigned long)&test_data[0]);
+    ml_printf("Test data end: 0x%lx\n", (unsigned long)&test_data[TEST_SIZE]);
 
     /* Run through the unsigned tests first */
     for (i = 0; i < ARRAY_SIZE(init_ufns) && ok; i++) {
@@ -529,8 +528,8 @@ int main(void)
         ok = do_signed_reads(true);
     }
 
-    ml_printf("Test data read: %"PRId32"\n", test_read_count);
-    ml_printf("Test data write: %"PRId32"\n", test_write_count);
+    ml_printf("Test data read: %lu\n", (unsigned long)test_read_count);
+    ml_printf("Test data write: %lu\n", (unsigned long)test_write_count);
     ml_printf("Test complete: %s\n", ok ? "PASSED" : "FAILED");
     return ok ? 0 : -1;
 }
-- 
2.46.2



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] tests/tcg: Do not use inttypes.h in multiarch/system/memory.c
  2024-10-10  8:58 [PATCH] tests/tcg: Do not use inttypes.h in multiarch/system/memory.c Ilya Leoshkevich
@ 2024-10-10  9:20 ` Paolo Bonzini
  2024-10-29 23:29   ` Ilya Leoshkevich
  0 siblings, 1 reply; 6+ messages in thread
From: Paolo Bonzini @ 2024-10-10  9:20 UTC (permalink / raw)
  To: Ilya Leoshkevich, Alex Bennée; +Cc: qemu-devel

On 10/10/24 10:58, Ilya Leoshkevich wrote:
> make check-tcg fails on Fedora with the following error message:
> 
>      alpha-linux-gnu-gcc [...] qemu/tests/tcg/multiarch/system/memory.c -o memory [...]
>      qemu/tests/tcg/multiarch/system/memory.c:17:10: fatal error: inttypes.h: No such file or directory
>         17 | #include <inttypes.h>
>            |          ^~~~~~~~~~~~
>      compilation terminated.
> 
> The reason is that Fedora has cross-compilers, but no cross-glibc
> headers. Fix by hardcoding the format specifiers and dropping the
> include.
> 
> An alternative fix would be to introduce a configure check for
> inttypes.h. But this would make it impossible to use Fedora
> cross-compilers for softmmu tests, which used to work so far.
> 
> Fixes: ecbcc9ead2f8 ("tests/tcg: add a system test to check memory instrumentation")
> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>

> ---
>   tests/tcg/multiarch/system/memory.c | 9 ++++-----
>   1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/tests/tcg/multiarch/system/memory.c b/tests/tcg/multiarch/system/memory.c
> index 65a6038a241..7508f6b916d 100644
> --- a/tests/tcg/multiarch/system/memory.c
> +++ b/tests/tcg/multiarch/system/memory.c
> @@ -14,7 +14,6 @@
>   
>   #include <stdint.h>
>   #include <stdbool.h>
> -#include <inttypes.h>
>   #include <minilib.h>
>   
>   #ifndef CHECK_UNALIGNED
> @@ -511,8 +510,8 @@ int main(void)
>       int i;
>       bool ok = true;
>   
> -    ml_printf("Test data start: 0x%"PRIxPTR"\n", &test_data[0]);
> -    ml_printf("Test data end: 0x%"PRIxPTR"\n", &test_data[TEST_SIZE]);
> +    ml_printf("Test data start: 0x%lx\n", (unsigned long)&test_data[0]);
> +    ml_printf("Test data end: 0x%lx\n", (unsigned long)&test_data[TEST_SIZE]);
>   
>       /* Run through the unsigned tests first */
>       for (i = 0; i < ARRAY_SIZE(init_ufns) && ok; i++) {
> @@ -529,8 +528,8 @@ int main(void)
>           ok = do_signed_reads(true);
>       }
>   
> -    ml_printf("Test data read: %"PRId32"\n", test_read_count);
> -    ml_printf("Test data write: %"PRId32"\n", test_write_count);
> +    ml_printf("Test data read: %lu\n", (unsigned long)test_read_count);
> +    ml_printf("Test data write: %lu\n", (unsigned long)test_write_count);
>       ml_printf("Test complete: %s\n", ok ? "PASSED" : "FAILED");
>       return ok ? 0 : -1;
>   }



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] tests/tcg: Do not use inttypes.h in multiarch/system/memory.c
  2024-10-10  9:20 ` Paolo Bonzini
@ 2024-10-29 23:29   ` Ilya Leoshkevich
  2024-11-04 11:34     ` Richard Henderson
  0 siblings, 1 reply; 6+ messages in thread
From: Ilya Leoshkevich @ 2024-10-29 23:29 UTC (permalink / raw)
  To: Paolo Bonzini, Alex Bennée, Richard Henderson; +Cc: qemu-devel

On Thu, 2024-10-10 at 11:20 +0200, Paolo Bonzini wrote:
> On 10/10/24 10:58, Ilya Leoshkevich wrote:
> > make check-tcg fails on Fedora with the following error message:
> > 
> >      alpha-linux-gnu-gcc [...]
> > qemu/tests/tcg/multiarch/system/memory.c -o memory [...]
> >      qemu/tests/tcg/multiarch/system/memory.c:17:10: fatal error:
> > inttypes.h: No such file or directory
> >         17 | #include <inttypes.h>
> >            |          ^~~~~~~~~~~~
> >      compilation terminated.
> > 
> > The reason is that Fedora has cross-compilers, but no cross-glibc
> > headers. Fix by hardcoding the format specifiers and dropping the
> > include.
> > 
> > An alternative fix would be to introduce a configure check for
> > inttypes.h. But this would make it impossible to use Fedora
> > cross-compilers for softmmu tests, which used to work so far.
> > 
> > Fixes: ecbcc9ead2f8 ("tests/tcg: add a system test to check memory
> > instrumentation")
> > Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
> 
> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>

[...]

Thanks for the review!

Could someone please pick this one and also [1] up?
Both patches are aimed at improving the situation with the test builds.

[1]
https://lore.kernel.org/qemu-devel/20241023131250.48510-1-iii@linux.ibm.com/


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] tests/tcg: Do not use inttypes.h in multiarch/system/memory.c
  2024-10-29 23:29   ` Ilya Leoshkevich
@ 2024-11-04 11:34     ` Richard Henderson
  2024-12-16 11:26       ` Ilya Leoshkevich
  0 siblings, 1 reply; 6+ messages in thread
From: Richard Henderson @ 2024-11-04 11:34 UTC (permalink / raw)
  To: Ilya Leoshkevich, Paolo Bonzini, Alex Bennée; +Cc: qemu-devel

On 10/29/24 23:29, Ilya Leoshkevich wrote:
> On Thu, 2024-10-10 at 11:20 +0200, Paolo Bonzini wrote:
>> On 10/10/24 10:58, Ilya Leoshkevich wrote:
>>> make check-tcg fails on Fedora with the following error message:
>>>
>>>       alpha-linux-gnu-gcc [...]
>>> qemu/tests/tcg/multiarch/system/memory.c -o memory [...]
>>>       qemu/tests/tcg/multiarch/system/memory.c:17:10: fatal error:
>>> inttypes.h: No such file or directory
>>>          17 | #include <inttypes.h>
>>>             |          ^~~~~~~~~~~~
>>>       compilation terminated.
>>>
>>> The reason is that Fedora has cross-compilers, but no cross-glibc
>>> headers. Fix by hardcoding the format specifiers and dropping the
>>> include.
>>>
>>> An alternative fix would be to introduce a configure check for
>>> inttypes.h. But this would make it impossible to use Fedora
>>> cross-compilers for softmmu tests, which used to work so far.
>>>
>>> Fixes: ecbcc9ead2f8 ("tests/tcg: add a system test to check memory
>>> instrumentation")
>>> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
>>
>> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
> 
> [...]
> 
> Thanks for the review!
> 
> Could someone please pick this one and also [1] up?
> Both patches are aimed at improving the situation with the test builds.
> 
> [1]
> https://lore.kernel.org/qemu-devel/20241023131250.48510-1-iii@linux.ibm.com/

Queued, thanks.

r~


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] tests/tcg: Do not use inttypes.h in multiarch/system/memory.c
  2024-11-04 11:34     ` Richard Henderson
@ 2024-12-16 11:26       ` Ilya Leoshkevich
  2024-12-16 15:40         ` Richard Henderson
  0 siblings, 1 reply; 6+ messages in thread
From: Ilya Leoshkevich @ 2024-12-16 11:26 UTC (permalink / raw)
  To: Richard Henderson; +Cc: qemu-devel

On Mon, 2024-11-04 at 11:34 +0000, Richard Henderson wrote:
> On 10/29/24 23:29, Ilya Leoshkevich wrote:
> > On Thu, 2024-10-10 at 11:20 +0200, Paolo Bonzini wrote:
> > > On 10/10/24 10:58, Ilya Leoshkevich wrote:
> > > > make check-tcg fails on Fedora with the following error
> > > > message:
> > > > 
> > > >       alpha-linux-gnu-gcc [...]
> > > > qemu/tests/tcg/multiarch/system/memory.c -o memory [...]
> > > >       qemu/tests/tcg/multiarch/system/memory.c:17:10: fatal
> > > > error:
> > > > inttypes.h: No such file or directory
> > > >          17 | #include <inttypes.h>
> > > >             |          ^~~~~~~~~~~~
> > > >       compilation terminated.
> > > > 
> > > > The reason is that Fedora has cross-compilers, but no cross-
> > > > glibc
> > > > headers. Fix by hardcoding the format specifiers and dropping
> > > > the
> > > > include.
> > > > 
> > > > An alternative fix would be to introduce a configure check for
> > > > inttypes.h. But this would make it impossible to use Fedora
> > > > cross-compilers for softmmu tests, which used to work so far.
> > > > 
> > > > Fixes: ecbcc9ead2f8 ("tests/tcg: add a system test to check
> > > > memory
> > > > instrumentation")
> > > > Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
> > > 
> > > Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
> > 
> > [...]
> > 
> > Thanks for the review!
> > 
> > Could someone please pick this one and also [1] up?
> > Both patches are aimed at improving the situation with the test
> > builds.
> > 
> > [1]
> > https://lore.kernel.org/qemu-devel/20241023131250.48510-1-iii@linux.ibm.com/
> 
> Queued, thanks.
> 
> r~

Hi Richard,

I noticed that this patch doesn't seem to be in master yet. Could it be
that it was overlooked, or is there some issue with it that I missed?

Best regards,
Ilya


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] tests/tcg: Do not use inttypes.h in multiarch/system/memory.c
  2024-12-16 11:26       ` Ilya Leoshkevich
@ 2024-12-16 15:40         ` Richard Henderson
  0 siblings, 0 replies; 6+ messages in thread
From: Richard Henderson @ 2024-12-16 15:40 UTC (permalink / raw)
  To: Ilya Leoshkevich; +Cc: qemu-devel

On 12/16/24 05:26, Ilya Leoshkevich wrote:
> On Mon, 2024-11-04 at 11:34 +0000, Richard Henderson wrote:
>> On 10/29/24 23:29, Ilya Leoshkevich wrote:
>>> On Thu, 2024-10-10 at 11:20 +0200, Paolo Bonzini wrote:
>>>> On 10/10/24 10:58, Ilya Leoshkevich wrote:
>>>>> make check-tcg fails on Fedora with the following error
>>>>> message:
>>>>>
>>>>>        alpha-linux-gnu-gcc [...]
>>>>> qemu/tests/tcg/multiarch/system/memory.c -o memory [...]
>>>>>        qemu/tests/tcg/multiarch/system/memory.c:17:10: fatal
>>>>> error:
>>>>> inttypes.h: No such file or directory
>>>>>           17 | #include <inttypes.h>
>>>>>              |          ^~~~~~~~~~~~
>>>>>        compilation terminated.
>>>>>
>>>>> The reason is that Fedora has cross-compilers, but no cross-
>>>>> glibc
>>>>> headers. Fix by hardcoding the format specifiers and dropping
>>>>> the
>>>>> include.
>>>>>
>>>>> An alternative fix would be to introduce a configure check for
>>>>> inttypes.h. But this would make it impossible to use Fedora
>>>>> cross-compilers for softmmu tests, which used to work so far.
>>>>>
>>>>> Fixes: ecbcc9ead2f8 ("tests/tcg: add a system test to check
>>>>> memory
>>>>> instrumentation")
>>>>> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
>>>>
>>>> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
>>>
>>> [...]
>>>
>>> Thanks for the review!
>>>
>>> Could someone please pick this one and also [1] up?
>>> Both patches are aimed at improving the situation with the test
>>> builds.
>>>
>>> [1]
>>> https://lore.kernel.org/qemu-devel/20241023131250.48510-1-iii@linux.ibm.com/
>>
>> Queued, thanks.
>>
>> r~
> 
> Hi Richard,
> 
> I noticed that this patch doesn't seem to be in master yet. Could it be
> that it was overlooked, or is there some issue with it that I missed?

Sorry, I'm not sure what happened.  I must have made some mistake with destructive branch 
pushing somewhere.  I've queued it again.  :-}


r~


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-12-16 15:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-10  8:58 [PATCH] tests/tcg: Do not use inttypes.h in multiarch/system/memory.c Ilya Leoshkevich
2024-10-10  9:20 ` Paolo Bonzini
2024-10-29 23:29   ` Ilya Leoshkevich
2024-11-04 11:34     ` Richard Henderson
2024-12-16 11:26       ` Ilya Leoshkevich
2024-12-16 15:40         ` Richard Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).