tests/qtest: migration-test: Fix [-Werror=format-overflow=] build warning
PATCH 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.
---
tests/qtest/migration-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tests/qtest/migration-test.c +1 -1
@@ -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);
Signature · 1 line
2.34.1
PATCH 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.
---
tests/qtest/vhost-user-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tests/qtest/vhost-user-test.c +1 -1
@@ -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); }
Signature · 1 line
2.34.1
Re: [PATCH 2/2] tests/qtest: vhost-user-test: Fix [-Werror=format-overflow=] build warning
Quoted 19 lines · Bin Meng
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.
Reported-by Shengjiang Wu <[email protected]>Fixes e6efe236c1d1 ("tests/qtest: vhost-user-test: Avoid using hardcoded /tmp")Signed-off-by Bin Meng <[email protected]>---
tests/qtest/vhost-user-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tests/qtest/vhost-user-test.c +0
-0
tests/qtest/vhost-user-test.c static TestServer *test_server_new(const gchar *name, · line 577
Quoted 8 lines
tests/qtest/vhost-user-test.c +1
-1@@ -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"
Re: [PATCH 2/2] tests/qtest: vhost-user-test: Fix [-Werror=format-overflow=] build warning
Quoted 23 lines · Markus Armbruster
Quoted 20 lines · Bin Meng
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.
Reported-by Shengjiang Wu <[email protected]>Fixes e6efe236c1d1 ("tests/qtest: vhost-user-test: Avoid using hardcoded /tmp")Signed-off-by Bin Meng <[email protected]>---
tests/qtest/vhost-user-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tests/qtest/vhost-user-test.c +0
-0@@ -571,7 +571,7 @@ static TestServer *test_server_new(const gchar *name,
Quoted 10 lines
tests/qtest/vhost-user-test.c static TestServer *test_server_new(const gchar *name, · line 577
Quoted 7 lines
tests/qtest/vhost-user-test.c +1
-1tmpfs =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.
Quoted 3 lines
Reviewed-by Markus Armbruster <[email protected]>
Regards,
Bin
Quoted 19 lines · Bin Meng
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.
Reported-by Shengjiang Wu <[email protected]>Fixes e5553c1b8d28 ("tests/qtest: migration-test: Avoid using hardcoded /tmp")Signed-off-by Bin Meng <[email protected]>---
tests/qtest/migration-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tests/qtest/migration-test.c +0
-0
tests/qtest/migration-test.c int main(int argc, char **argv) · line 2487
Quoted 8 lines
tests/qtest/migration-test.c +1
-1@@ -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 :)
Quoted 22 lines · Markus Armbruster
Quoted 20 lines · Bin Meng
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.
Reported-by Shengjiang Wu <[email protected]>Fixes e5553c1b8d28 ("tests/qtest: migration-test: Avoid using hardcoded /tmp")Signed-off-by Bin Meng <[email protected]>---
tests/qtest/migration-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tests/qtest/migration-test.c +0
-0@@ -2481,7 +2481,7 @@ int main(int argc, char **argv)
Quoted 11 lines
tests/qtest/migration-test.c int main(int argc, char **argv) · line 2487
Quoted 7 lines
tests/qtest/migration-test.c +1
-1tmpfs =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.
Quoted 1 line
Reviewed-by Markus Armbruster <[email protected]>
Quoted 23 lines · Markus Armbruster
Quoted 20 lines · Bin Meng
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.
Reported-by Shengjiang Wu <[email protected]>Fixes e5553c1b8d28 ("tests/qtest: migration-test: Avoid using hardcoded /tmp")Signed-off-by Bin Meng <[email protected]>---
tests/qtest/migration-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tests/qtest/migration-test.c +0
-0@@ -2481,7 +2481,7 @@ int main(int argc, char **argv)
Quoted 12 lines
tests/qtest/migration-test.c int main(int argc, char **argv) · line 2487
Quoted 7 lines
tests/qtest/migration-test.c +1
-1tmpfs =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.
Quoted 2 lines
Reviewed-by Markus Armbruster <[email protected]>
Regards,
Bin
Quoted 37 lines · Bin Meng
Quoted 23 lines · Markus Armbruster
Quoted 20 lines · Bin Meng
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.
Reported-by Shengjiang Wu <[email protected]>Fixes e5553c1b8d28 ("tests/qtest: migration-test: Avoid using hardcoded /tmp")Signed-off-by Bin Meng <[email protected]>---
tests/qtest/migration-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tests/qtest/migration-test.c +0
-0@@ -2481,7 +2481,7 @@ int main(int argc, char **argv)Quoted 12 lines
tests/qtest/migration-test.c int main(int argc, char **argv) · line 2487
Quoted 7 lines
tests/qtest/migration-test.c +1
-1tmpfs =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 :)
Quoted 3 lines
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