Message ID | 20221017114647.2226535-2-bmeng.cn@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [1/2] tests/qtest: migration-test: Fix [-Werror=format-overflow=] build warning | expand |
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>
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
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); }