From b1f6208cf986a60e1c9f8b960db5a00851f48f98 Mon Sep 17 00:00:00 2001 From: Bin Meng Date: Mon, 17 Oct 2022 21:20:22 +0800 Subject: tests/qtest: migration-test: Fix [-Werror=format-overflow=] build warning 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 Fixes: e5553c1b8d28 ("tests/qtest: migration-test: Avoid using hardcoded /tmp") Signed-off-by: Bin Meng Reviewed-by: Markus Armbruster Message-Id: <20221017132023.2228641-1-bmeng.cn@gmail.com> Signed-off-by: Laurent Vivier --- tests/qtest/migration-test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index ef4427ff4d..aa1ba179fa 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -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); -- cgit v1.2.3 From 1c324bf908e3de1cf352e36484c73dc07767d938 Mon Sep 17 00:00:00 2001 From: Bin Meng Date: Mon, 17 Oct 2022 21:20:23 +0800 Subject: tests/qtest: vhost-user-test: Fix [-Werror=format-overflow=] build warning 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 Fixes: e6efe236c1d1 ("tests/qtest: vhost-user-test: Avoid using hardcoded /tmp") Signed-off-by: Bin Meng Reviewed-by: Markus Armbruster Message-Id: <20221017132023.2228641-2-bmeng.cn@gmail.com> Signed-off-by: Laurent Vivier --- tests/qtest/vhost-user-test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/qtest/vhost-user-test.c b/tests/qtest/vhost-user-test.c index e8d2da7228..bf9f7c4248 100644 --- a/tests/qtest/vhost-user-test.c +++ b/tests/qtest/vhost-user-test.c @@ -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); -- cgit v1.2.3