qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] tests/qtest: migration-test: Fix [-Werror=format-overflow=] build warning
@ 2022-10-17 11:46 Bin Meng
  2022-10-17 11:46 ` [PATCH 2/2] tests/qtest: vhost-user-test: " Bin Meng
  2022-10-17 12:28 ` [PATCH 1/2] tests/qtest: migration-test: " Markus Armbruster
  0 siblings, 2 replies; 8+ messages in thread
From: Bin Meng @ 2022-10-17 11:46 UTC (permalink / raw)
  To: qemu-devel
  Cc: Bin Meng, Shengjiang Wu, Dr. David Alan Gilbert, Juan Quintela,
	Laurent Vivier, Paolo Bonzini, Thomas Huth

From: Bin Meng <bin.meng@windriver.com>

When tmpfs is NULL, a build warning is seen with GCC 9.3.0.
It's strange that GCC 11.2.0 on Ubuntu 22.04 does not catch this,
neither did the QEMU CI.

Reported-by: Shengjiang Wu <shengjiang.wu@windriver.com>
Fixes: e5553c1b8d28 ("tests/qtest: migration-test: Avoid using hardcoded /tmp")
Signed-off-by: Bin Meng <bin.meng@windriver.com>
---

 tests/qtest/migration-test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
index ef4427ff4d..83a8998e40 100644
--- a/tests/qtest/migration-test.c
+++ b/tests/qtest/migration-test.c
@@ -2481,7 +2481,7 @@ int main(int argc, char **argv)
 
     tmpfs = g_dir_make_tmp("migration-test-XXXXXX", &err);
     if (!tmpfs) {
-        g_test_message("g_dir_make_tmp on path (%s): %s", tmpfs,
+        g_test_message("g_dir_make_tmp on path (%s): %s", g_get_tmp_dir(),
                        err->message);
     }
     g_assert(tmpfs);
-- 
2.34.1



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

* [PATCH 2/2] tests/qtest: vhost-user-test: Fix [-Werror=format-overflow=] build warning
  2022-10-17 11:46 [PATCH 1/2] tests/qtest: migration-test: Fix [-Werror=format-overflow=] build warning Bin Meng
@ 2022-10-17 11:46 ` Bin Meng
  2022-10-17 12:33   ` Markus Armbruster
  2022-10-17 12:28 ` [PATCH 1/2] tests/qtest: migration-test: " Markus Armbruster
  1 sibling, 1 reply; 8+ messages in thread
From: Bin Meng @ 2022-10-17 11:46 UTC (permalink / raw)
  To: qemu-devel
  Cc: Bin Meng, Shengjiang Wu, Laurent Vivier, Paolo Bonzini,
	Thomas Huth

From: Bin Meng <bin.meng@windriver.com>

When tmpfs is NULL, a build warning is seen with GCC 9.3.0.
It's strange that GCC 11.2.0 on Ubuntu 22.04 does not catch this,
neither did the QEMU CI.

Reported-by: Shengjiang Wu <shengjiang.wu@windriver.com>
Fixes: e6efe236c1d1 ("tests/qtest: vhost-user-test: Avoid using hardcoded /tmp")
Signed-off-by: Bin Meng <bin.meng@windriver.com>
---

 tests/qtest/vhost-user-test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/qtest/vhost-user-test.c b/tests/qtest/vhost-user-test.c
index e8d2da7228..819b87df3c 100644
--- a/tests/qtest/vhost-user-test.c
+++ b/tests/qtest/vhost-user-test.c
@@ -571,7 +571,7 @@ static TestServer *test_server_new(const gchar *name,
 
     tmpfs = g_dir_make_tmp("vhost-test-XXXXXX", &err);
     if (!tmpfs) {
-        g_test_message("g_dir_make_tmp on path (%s): %s", tmpfs,
+        g_test_message("g_dir_make_tmp on path (%s): %s", g_get_tmp_dir(),
                        err->message);
         g_error_free(err);
     }
-- 
2.34.1



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

* Re: [PATCH 1/2] tests/qtest: migration-test: Fix [-Werror=format-overflow=] build warning
  2022-10-17 11:46 [PATCH 1/2] tests/qtest: migration-test: Fix [-Werror=format-overflow=] build warning Bin Meng
  2022-10-17 11:46 ` [PATCH 2/2] tests/qtest: vhost-user-test: " Bin Meng
@ 2022-10-17 12:28 ` Markus Armbruster
  2022-10-17 12:30   ` Markus Armbruster
  2022-10-17 13:56   ` Bin Meng
  1 sibling, 2 replies; 8+ messages in thread
From: Markus Armbruster @ 2022-10-17 12:28 UTC (permalink / raw)
  To: Bin Meng
  Cc: qemu-devel, Bin Meng, Shengjiang Wu, Dr. David Alan Gilbert,
	Juan Quintela, Laurent Vivier, Paolo Bonzini, Thomas Huth

Bin Meng <bmeng.cn@gmail.com> writes:

> From: Bin Meng <bin.meng@windriver.com>
>
> When tmpfs is NULL, a build warning is seen with GCC 9.3.0.
> It's strange that GCC 11.2.0 on Ubuntu 22.04 does not catch this,
> neither did the QEMU CI.
>
> Reported-by: Shengjiang Wu <shengjiang.wu@windriver.com>
> Fixes: e5553c1b8d28 ("tests/qtest: migration-test: Avoid using hardcoded /tmp")
> Signed-off-by: Bin Meng <bin.meng@windriver.com>
> ---
>
>  tests/qtest/migration-test.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
> index ef4427ff4d..83a8998e40 100644
> --- a/tests/qtest/migration-test.c
> +++ b/tests/qtest/migration-test.c
> @@ -2481,7 +2481,7 @@ int main(int argc, char **argv)
>  
>      tmpfs = g_dir_make_tmp("migration-test-XXXXXX", &err);
>      if (!tmpfs) {
> -        g_test_message("g_dir_make_tmp on path (%s): %s", tmpfs,
> +        g_test_message("g_dir_make_tmp on path (%s): %s", g_get_tmp_dir(),
>                         err->message);
>      }
>      g_assert(tmpfs);

Thomas posted the same fix as "[PATCH] tests/qtest/migration-test: Do
not try to print NULL pointer string".  You guys figure out which one
you like better :)

Reviewed-by: Markus Armbruster <armbru@redhat.com>



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

* Re: [PATCH 1/2] tests/qtest: migration-test: Fix [-Werror=format-overflow=] build warning
  2022-10-17 12:28 ` [PATCH 1/2] tests/qtest: migration-test: " Markus Armbruster
@ 2022-10-17 12:30   ` Markus Armbruster
  2022-10-17 13:56   ` Bin Meng
  1 sibling, 0 replies; 8+ messages in thread
From: Markus Armbruster @ 2022-10-17 12:30 UTC (permalink / raw)
  To: Bin Meng
  Cc: qemu-devel, Bin Meng, Shengjiang Wu, Dr. David Alan Gilbert,
	Juan Quintela, Laurent Vivier, Paolo Bonzini, Thomas Huth

Markus Armbruster <armbru@redhat.com> writes:

> Bin Meng <bmeng.cn@gmail.com> writes:
>
>> From: Bin Meng <bin.meng@windriver.com>
>>
>> When tmpfs is NULL, a build warning is seen with GCC 9.3.0.
>> It's strange that GCC 11.2.0 on Ubuntu 22.04 does not catch this,
>> neither did the QEMU CI.
>>
>> Reported-by: Shengjiang Wu <shengjiang.wu@windriver.com>
>> Fixes: e5553c1b8d28 ("tests/qtest: migration-test: Avoid using hardcoded /tmp")
>> Signed-off-by: Bin Meng <bin.meng@windriver.com>
>> ---
>>
>>  tests/qtest/migration-test.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
>> index ef4427ff4d..83a8998e40 100644
>> --- a/tests/qtest/migration-test.c
>> +++ b/tests/qtest/migration-test.c
>> @@ -2481,7 +2481,7 @@ int main(int argc, char **argv)
>>  
>>      tmpfs = g_dir_make_tmp("migration-test-XXXXXX", &err);
>>      if (!tmpfs) {
>> -        g_test_message("g_dir_make_tmp on path (%s): %s", tmpfs,
>> +        g_test_message("g_dir_make_tmp on path (%s): %s", g_get_tmp_dir(),
>>                         err->message);
>>      }
>>      g_assert(tmpfs);
>
> Thomas posted the same fix as "[PATCH] tests/qtest/migration-test: Do
> not try to print NULL pointer string".  You guys figure out which one
> you like better :)

Correction: not the same.

> Reviewed-by: Markus Armbruster <armbru@redhat.com>



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

* Re: [PATCH 2/2] tests/qtest: vhost-user-test: Fix [-Werror=format-overflow=] build warning
  2022-10-17 11:46 ` [PATCH 2/2] tests/qtest: vhost-user-test: " Bin Meng
@ 2022-10-17 12:33   ` Markus Armbruster
  2022-10-17 13:57     ` Bin Meng
  0 siblings, 1 reply; 8+ messages in thread
From: Markus Armbruster @ 2022-10-17 12:33 UTC (permalink / raw)
  To: Bin Meng
  Cc: qemu-devel, Bin Meng, Shengjiang Wu, Laurent Vivier,
	Paolo Bonzini, Thomas Huth

Bin Meng <bmeng.cn@gmail.com> writes:

> From: Bin Meng <bin.meng@windriver.com>
>
> When tmpfs is NULL, a build warning is seen with GCC 9.3.0.
> It's strange that GCC 11.2.0 on Ubuntu 22.04 does not catch this,
> neither did the QEMU CI.
>
> Reported-by: Shengjiang Wu <shengjiang.wu@windriver.com>
> Fixes: e6efe236c1d1 ("tests/qtest: vhost-user-test: Avoid using hardcoded /tmp")
> Signed-off-by: Bin Meng <bin.meng@windriver.com>
> ---
>
>  tests/qtest/vhost-user-test.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tests/qtest/vhost-user-test.c b/tests/qtest/vhost-user-test.c
> index e8d2da7228..819b87df3c 100644
> --- a/tests/qtest/vhost-user-test.c
> +++ b/tests/qtest/vhost-user-test.c
> @@ -571,7 +571,7 @@ static TestServer *test_server_new(const gchar *name,
>  
>      tmpfs = g_dir_make_tmp("vhost-test-XXXXXX", &err);
>      if (!tmpfs) {
> -        g_test_message("g_dir_make_tmp on path (%s): %s", tmpfs,
> +        g_test_message("g_dir_make_tmp on path (%s): %s", g_get_tmp_dir(),
>                         err->message);
>          g_error_free(err);
>      }

Suggest to improve the error message while there: "can't create
temporary file in %s: %s"

Reviewed-by: Markus Armbruster <armbru@redhat.com>



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

* Re: [PATCH 1/2] tests/qtest: migration-test: Fix [-Werror=format-overflow=] build warning
  2022-10-17 12:28 ` [PATCH 1/2] tests/qtest: migration-test: " Markus Armbruster
  2022-10-17 12:30   ` Markus Armbruster
@ 2022-10-17 13:56   ` Bin Meng
  2022-10-17 14:14     ` Thomas Huth
  1 sibling, 1 reply; 8+ messages in thread
From: Bin Meng @ 2022-10-17 13:56 UTC (permalink / raw)
  To: Markus Armbruster
  Cc: qemu-devel, Bin Meng, Shengjiang Wu, Dr. David Alan Gilbert,
	Juan Quintela, Laurent Vivier, Paolo Bonzini, Thomas Huth

On Mon, Oct 17, 2022 at 8:28 PM Markus Armbruster <armbru@redhat.com> wrote:
>
> Bin Meng <bmeng.cn@gmail.com> writes:
>
> > From: Bin Meng <bin.meng@windriver.com>
> >
> > When tmpfs is NULL, a build warning is seen with GCC 9.3.0.
> > It's strange that GCC 11.2.0 on Ubuntu 22.04 does not catch this,
> > neither did the QEMU CI.
> >
> > Reported-by: Shengjiang Wu <shengjiang.wu@windriver.com>
> > Fixes: e5553c1b8d28 ("tests/qtest: migration-test: Avoid using hardcoded /tmp")
> > Signed-off-by: Bin Meng <bin.meng@windriver.com>
> > ---
> >
> >  tests/qtest/migration-test.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
> > index ef4427ff4d..83a8998e40 100644
> > --- a/tests/qtest/migration-test.c
> > +++ b/tests/qtest/migration-test.c
> > @@ -2481,7 +2481,7 @@ int main(int argc, char **argv)
> >
> >      tmpfs = g_dir_make_tmp("migration-test-XXXXXX", &err);
> >      if (!tmpfs) {
> > -        g_test_message("g_dir_make_tmp on path (%s): %s", tmpfs,
> > +        g_test_message("g_dir_make_tmp on path (%s): %s", g_get_tmp_dir(),
> >                         err->message);
> >      }
> >      g_assert(tmpfs);
>
> Thomas posted the same fix as "[PATCH] tests/qtest/migration-test: Do
> not try to print NULL pointer string".  You guys figure out which one
> you like better :)
>

Oops, almost the same time :)

Will let Thomas decide.

> Reviewed-by: Markus Armbruster <armbru@redhat.com>
>

Regards,
Bin


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

* Re: [PATCH 2/2] tests/qtest: vhost-user-test: Fix [-Werror=format-overflow=] build warning
  2022-10-17 12:33   ` Markus Armbruster
@ 2022-10-17 13:57     ` Bin Meng
  0 siblings, 0 replies; 8+ messages in thread
From: Bin Meng @ 2022-10-17 13:57 UTC (permalink / raw)
  To: Markus Armbruster
  Cc: qemu-devel, Bin Meng, Shengjiang Wu, Laurent Vivier,
	Paolo Bonzini, Thomas Huth

On Mon, Oct 17, 2022 at 8:33 PM Markus Armbruster <armbru@redhat.com> wrote:
>
> Bin Meng <bmeng.cn@gmail.com> writes:
>
> > From: Bin Meng <bin.meng@windriver.com>
> >
> > When tmpfs is NULL, a build warning is seen with GCC 9.3.0.
> > It's strange that GCC 11.2.0 on Ubuntu 22.04 does not catch this,
> > neither did the QEMU CI.
> >
> > Reported-by: Shengjiang Wu <shengjiang.wu@windriver.com>
> > Fixes: e6efe236c1d1 ("tests/qtest: vhost-user-test: Avoid using hardcoded /tmp")
> > Signed-off-by: Bin Meng <bin.meng@windriver.com>
> > ---
> >
> >  tests/qtest/vhost-user-test.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/tests/qtest/vhost-user-test.c b/tests/qtest/vhost-user-test.c
> > index e8d2da7228..819b87df3c 100644
> > --- a/tests/qtest/vhost-user-test.c
> > +++ b/tests/qtest/vhost-user-test.c
> > @@ -571,7 +571,7 @@ static TestServer *test_server_new(const gchar *name,
> >
> >      tmpfs = g_dir_make_tmp("vhost-test-XXXXXX", &err);
> >      if (!tmpfs) {
> > -        g_test_message("g_dir_make_tmp on path (%s): %s", tmpfs,
> > +        g_test_message("g_dir_make_tmp on path (%s): %s", g_get_tmp_dir(),
> >                         err->message);
> >          g_error_free(err);
> >      }
>
> Suggest to improve the error message while there: "can't create
> temporary file in %s: %s"

Thanks for the review. I've sent v2 with the suggested improvement on
the error message.

>
> Reviewed-by: Markus Armbruster <armbru@redhat.com>
>

Regards,
Bin


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

* Re: [PATCH 1/2] tests/qtest: migration-test: Fix [-Werror=format-overflow=] build warning
  2022-10-17 13:56   ` Bin Meng
@ 2022-10-17 14:14     ` Thomas Huth
  0 siblings, 0 replies; 8+ messages in thread
From: Thomas Huth @ 2022-10-17 14:14 UTC (permalink / raw)
  To: Bin Meng, Markus Armbruster
  Cc: qemu-devel, Bin Meng, Shengjiang Wu, Dr. David Alan Gilbert,
	Juan Quintela, Laurent Vivier, Paolo Bonzini

On 17/10/2022 15.56, Bin Meng wrote:
> On Mon, Oct 17, 2022 at 8:28 PM Markus Armbruster <armbru@redhat.com> wrote:
>>
>> Bin Meng <bmeng.cn@gmail.com> writes:
>>
>>> From: Bin Meng <bin.meng@windriver.com>
>>>
>>> When tmpfs is NULL, a build warning is seen with GCC 9.3.0.
>>> It's strange that GCC 11.2.0 on Ubuntu 22.04 does not catch this,
>>> neither did the QEMU CI.
>>>
>>> Reported-by: Shengjiang Wu <shengjiang.wu@windriver.com>
>>> Fixes: e5553c1b8d28 ("tests/qtest: migration-test: Avoid using hardcoded /tmp")
>>> Signed-off-by: Bin Meng <bin.meng@windriver.com>
>>> ---
>>>
>>>   tests/qtest/migration-test.c | 2 +-
>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
>>> index ef4427ff4d..83a8998e40 100644
>>> --- a/tests/qtest/migration-test.c
>>> +++ b/tests/qtest/migration-test.c
>>> @@ -2481,7 +2481,7 @@ int main(int argc, char **argv)
>>>
>>>       tmpfs = g_dir_make_tmp("migration-test-XXXXXX", &err);
>>>       if (!tmpfs) {
>>> -        g_test_message("g_dir_make_tmp on path (%s): %s", tmpfs,
>>> +        g_test_message("g_dir_make_tmp on path (%s): %s", g_get_tmp_dir(),
>>>                          err->message);
>>>       }
>>>       g_assert(tmpfs);
>>
>> Thomas posted the same fix as "[PATCH] tests/qtest/migration-test: Do
>> not try to print NULL pointer string".  You guys figure out which one
>> you like better :)
>>
> 
> Oops, almost the same time :)
> 
> Will let Thomas decide.

The improvement of the error message in your v2 makes a lot of sense - I'll 
queue that version.

  Thomas




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

end of thread, other threads:[~2022-10-17 14:19 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-17 11:46 [PATCH 1/2] tests/qtest: migration-test: Fix [-Werror=format-overflow=] build warning Bin Meng
2022-10-17 11:46 ` [PATCH 2/2] tests/qtest: vhost-user-test: " Bin Meng
2022-10-17 12:33   ` Markus Armbruster
2022-10-17 13:57     ` Bin Meng
2022-10-17 12:28 ` [PATCH 1/2] tests/qtest: migration-test: " Markus Armbruster
2022-10-17 12:30   ` Markus Armbruster
2022-10-17 13:56   ` Bin Meng
2022-10-17 14:14     ` Thomas Huth

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).