tests/qtest: migration-test: Fix [-Werror=format-overflow=] build warning
PATCH v2 1/2 tests/qtest: migration-test: Fix [-Werror=format-overflow=] build warning
From: Bin Meng <[email protected]>
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.
While we are here, improve the error message as well.
---
Changes in v2:
- improve the error message
tests/qtest/migration-test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tests/qtest/migration-test.c +2 -2
@@ -2481,8 +2481,8 @@ 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, - err->message); +g_test_message ("Can't create temporary directory in %s: %s" , +g_get_tmp_dir (), err->message); }g_assert (tmpfs);
Signature · 1 line
2.34.1
PATCH v2 2/2 tests/qtest: vhost-user-test: Fix [-Werror=format-overflow=] build warning
From: Bin Meng <[email protected]>
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.
While we are here, improve the error message as well.
---
Changes in v2:
- improve the error message
tests/qtest/vhost-user-test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tests/qtest/vhost-user-test.c +2 -2
@@ -571,8 +571,8 @@ 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, - err->message); +g_test_message ("Can't create temporary directory in %s: %s" , +g_get_tmp_dir (), err->message);g_error_free (err); }g_assert (tmpfs);
Signature · 1 line
2.34.1
Laurent Vivier
AppliedRe: [PATCH v2 2/2] tests/qtest: vhost-user-test: Fix [-Werror=format-overflow=] build warning
Le 17/10/2022 à 15:20, Bin Meng a écrit :
Quoted 25 lines
From: Bin Meng <[email protected]>
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.
While we are here, improve the error message as well.
Reported-by Shengjiang Wu <[email protected]>Fixes e6efe236c1d1 ("tests/qtest: vhost-user-test: Avoid using hardcoded /tmp")Signed-off-by Bin Meng <[email protected]>Reviewed-by Markus Armbruster <[email protected]>---
Changes in v2:
- improve the error messagetests/qtest/vhost-user-test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)tests/qtest/vhost-user-test.c +0
-0
tests/qtest/vhost-user-test.c static TestServer *test_server_new(const gchar *name, · line 578
Quoted 10 lines
tests/qtest/vhost-user-test.c +2
-2@@ -571,8 +571,8 @@ 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, - err->message); +g_test_message ("Can't create temporary directory in %s: %s" , +g_get_tmp_dir (), err->message);g_error_free (err); }g_assert (tmpfs);
Applied to my trivial-patches branch.
Thanks,
Laurent
Laurent Vivier
AppliedLe 17/10/2022 à 15:20, Bin Meng a écrit :
Quoted 25 lines
From: Bin Meng <[email protected]>
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.
While we are here, improve the error message as well.
Reported-by Shengjiang Wu <[email protected]>Fixes e5553c1b8d28 ("tests/qtest: migration-test: Avoid using hardcoded /tmp")Signed-off-by Bin Meng <[email protected]>Reviewed-by Markus Armbruster <[email protected]>---
Changes in v2:
- improve the error messagetests/qtest/migration-test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)tests/qtest/migration-test.c +0
-0
tests/qtest/migration-test.c int main(int argc, char **argv) · line 2488
Quoted 10 lines
tests/qtest/migration-test.c +2
-2@@ -2481,8 +2481,8 @@ 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, - err->message); +g_test_message ("Can't create temporary directory in %s: %s" , +g_get_tmp_dir (), err->message); }g_assert (tmpfs);
Applied to my trivial-patches branch.
Thanks,
Laurent