From 24f7eeed9ad7f90975c2da44425d15b8f0837120 Mon Sep 17 00:00:00 2001 From: Miroslav Rezanina Date: Tue, 21 Jan 2020 10:28:13 +0100 Subject: test-logging: Fix -Werror=maybe-uninitialized warning Checking for uninitialized variables raises warning for file path variables in test_logfile_write and test_logfile_lock functions. To suppress this warning, initialize varibles to NULL. This is safe change as result of g_build_filename is stored to them before any usage. Signed-off-by: Miroslav Rezanina Message-Id: <63b0fcedf7dfe799c8210b113e5dccf32414a89d.1579598240.git.mrezanin@redhat.com> Reviewed-by: Thomas Huth Reviewed-by: Robert Foley Signed-off-by: Thomas Huth --- tests/test-logging.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/test-logging.c b/tests/test-logging.c index 1e646f0..6387e49 100644 --- a/tests/test-logging.c +++ b/tests/test-logging.c @@ -114,8 +114,8 @@ static void test_logfile_write(gconstpointer data) QemuLogFile *logfile2; gchar const *dir = data; Error *err = NULL; - g_autofree gchar *file_path; - g_autofree gchar *file_path1; + g_autofree gchar *file_path = NULL; + g_autofree gchar *file_path1 = NULL; FILE *orig_fd; /* @@ -157,7 +157,7 @@ static void test_logfile_lock(gconstpointer data) FILE *logfile; gchar const *dir = data; Error *err = NULL; - g_autofree gchar *file_path; + g_autofree gchar *file_path = NULL; file_path = g_build_filename(dir, "qemu_test_logfile_lock0.log", NULL); -- cgit v1.1 From 4eb387267ee7604239be2fbd45e5cb34de93d6d8 Mon Sep 17 00:00:00 2001 From: "Dr. David Alan Gilbert" Date: Fri, 17 Jan 2020 12:26:48 +0000 Subject: tests/vhost-user-bridge: Fix build vhost-user-bridge isn't actually a test, it's just a helper (that should probably move somewhere else) - but the build was broken in the qtest move. Fixes: 833884f37adc9f125fa2 Signed-off-by: Dr. David Alan Gilbert Message-Id: <20200117122648.137862-1-dgilbert@redhat.com> Reviewed-by: Thomas Huth Signed-off-by: Thomas Huth --- tests/Makefile.include | 1 + tests/qtest/Makefile.include | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/Makefile.include b/tests/Makefile.include index a1bff5d..fe63fec 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -586,6 +586,7 @@ include $(SRC_PATH)/tests/qtest/Makefile.include tests/test-qga$(EXESUF): qemu-ga$(EXESUF) tests/test-qga$(EXESUF): tests/test-qga.o $(qtest-obj-y) +tests/vhost-user-bridge$(EXESUF): tests/vhost-user-bridge.o $(test-util-obj-y) libvhost-user.a SPEED = quick diff --git a/tests/qtest/Makefile.include b/tests/qtest/Makefile.include index e6bb4ab..eb0f23b 100644 --- a/tests/qtest/Makefile.include +++ b/tests/qtest/Makefile.include @@ -290,7 +290,6 @@ tests/qtest/test-filter-redirector$(EXESUF): tests/qtest/test-filter-redirector. tests/qtest/test-x86-cpuid-compat$(EXESUF): tests/qtest/test-x86-cpuid-compat.o $(qtest-obj-y) tests/qtest/ivshmem-test$(EXESUF): tests/qtest/ivshmem-test.o contrib/ivshmem-server/ivshmem-server.o $(libqos-pc-obj-y) $(libqos-spapr-obj-y) tests/qtest/dbus-vmstate-test$(EXESUF): tests/qtest/dbus-vmstate-test.o tests/qtest/migration-helpers.o tests/qtest/dbus-vmstate1.o $(libqos-pc-obj-y) $(libqos-spapr-obj-y) -tests/qtest/vhost-user-bridge$(EXESUF): tests/qtest/vhost-user-bridge.o $(test-util-obj-y) libvhost-user.a tests/qtest/test-arm-mptimer$(EXESUF): tests/qtest/test-arm-mptimer.o tests/qtest/numa-test$(EXESUF): tests/qtest/numa-test.o tests/qtest/vmgenid-test$(EXESUF): tests/qtest/vmgenid-test.o tests/qtest/boot-sector.o tests/qtest/acpi-utils.o -- cgit v1.1 From ab00cf4d73150822f24ca6cf762595a8c0cda452 Mon Sep 17 00:00:00 2001 From: Thomas Huth Date: Mon, 27 Jan 2020 14:44:35 +0100 Subject: tests/Makefile: Fix inclusion of the qos dependency files The qos dependency files can be found under tests/qtest/libqos and not under tests/qtest/qos. Fixes: 1cf4323ecd0 ("Move the libqos files under tests/qtest/") Message-Id: <20200127140245.20065-1-thuth@redhat.com> Reviewed-by: Laurent Vivier Signed-off-by: Thomas Huth --- tests/Makefile.include | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/Makefile.include b/tests/Makefile.include index fe63fec..2f1cafe 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -919,6 +919,6 @@ all: $(QEMU_IOTESTS_HELPERS-y) -include $(wildcard tests/*.d) -include $(wildcard tests/qtest/*.d) --include $(wildcard tests/qtest/qos/*.d) +-include $(wildcard tests/qtest/libqos/*.d) endif -- cgit v1.1 From 77c24259b635c2c858e2b5ae61363843c4d88560 Mon Sep 17 00:00:00 2001 From: Pan Nengyuan Date: Mon, 3 Feb 2020 10:59:35 +0800 Subject: boot-order-test: fix memleaks in boot-order-test It's not a big deal, but 'check qtest-ppc/ppc64' runs fail if sanitizers is enabled. The memory leak stack is as follow: Direct leak of 128 byte(s) in 4 object(s) allocated from: #0 0x7f11756f5970 in __interceptor_calloc (/lib64/libasan.so.5+0xef970) #1 0x7f1174f2549d in g_malloc0 (/lib64/libglib-2.0.so.0+0x5249d) #2 0x556af05aa7da in mm_fw_cfg_init /mnt/sdb/qemu/tests/libqos/fw_cfg.c:119 #3 0x556af059f4f5 in read_boot_order_pmac /mnt/sdb/qemu/tests/boot-order-test.c:137 #4 0x556af059efe2 in test_a_boot_order /mnt/sdb/qemu/tests/boot-order-test.c:47 #5 0x556af059f2c0 in test_boot_orders /mnt/sdb/qemu/tests/boot-order-test.c:59 #6 0x556af059f52d in test_pmac_oldworld_boot_order /mnt/sdb/qemu/tests/boot-order-test.c:152 #7 0x7f1174f46cb9 (/lib64/libglib-2.0.so.0+0x73cb9) #8 0x7f1174f46b73 (/lib64/libglib-2.0.so.0+0x73b73) #9 0x7f1174f46b73 (/lib64/libglib-2.0.so.0+0x73b73) #10 0x7f1174f46f71 in g_test_run_suite (/lib64/libglib-2.0.so.0+0x73f71) #11 0x7f1174f46f94 in g_test_run (/lib64/libglib-2.0.so.0+0x73f94) Reported-by: Euler Robot Signed-off-by: Pan Nengyuan Message-Id: <20200203025935.36228-1-pannengyuan@huawei.com> Reviewed-by: Thomas Huth Signed-off-by: Thomas Huth --- tests/qtest/boot-order-test.c | 6 +++--- tests/qtest/libqos/fw_cfg.h | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/qtest/boot-order-test.c b/tests/qtest/boot-order-test.c index 4a6218a..2f1c072 100644 --- a/tests/qtest/boot-order-test.c +++ b/tests/qtest/boot-order-test.c @@ -110,7 +110,7 @@ static void test_pc_boot_order(void) static uint64_t read_boot_order_pmac(QTestState *qts) { - QFWCFG *fw_cfg = mm_fw_cfg_init(qts, 0xf0000510); + g_autoptr(QFWCFG) fw_cfg = mm_fw_cfg_init(qts, 0xf0000510); return qfw_cfg_get_u16(fw_cfg, FW_CFG_BOOT_DEVICE); } @@ -135,7 +135,7 @@ static void test_pmac_newworld_boot_order(void) static uint64_t read_boot_order_sun4m(QTestState *qts) { - QFWCFG *fw_cfg = mm_fw_cfg_init(qts, 0xd00000510ULL); + g_autoptr(QFWCFG) fw_cfg = mm_fw_cfg_init(qts, 0xd00000510ULL); return qfw_cfg_get_u16(fw_cfg, FW_CFG_BOOT_DEVICE); } @@ -147,7 +147,7 @@ static void test_sun4m_boot_order(void) static uint64_t read_boot_order_sun4u(QTestState *qts) { - QFWCFG *fw_cfg = io_fw_cfg_init(qts, 0x510); + g_autoptr(QFWCFG) fw_cfg = io_fw_cfg_init(qts, 0x510); return qfw_cfg_get_u16(fw_cfg, FW_CFG_BOOT_DEVICE); } diff --git a/tests/qtest/libqos/fw_cfg.h b/tests/qtest/libqos/fw_cfg.h index 13325cc..c6a7cf8 100644 --- a/tests/qtest/libqos/fw_cfg.h +++ b/tests/qtest/libqos/fw_cfg.h @@ -49,4 +49,6 @@ static inline void pc_fw_cfg_uninit(QFWCFG *fw_cfg) io_fw_cfg_uninit(fw_cfg); } +G_DEFINE_AUTOPTR_CLEANUP_FUNC(QFWCFG, mm_fw_cfg_uninit) + #endif -- cgit v1.1 From c66e8ab0e3af8fb163a7de8fa2df2dd69858a894 Mon Sep 17 00:00:00 2001 From: Heyi Guo Date: Sun, 2 Feb 2020 19:00:09 +0800 Subject: tests/qtest: update comments about bios-tables-test-allowed-diff.h Update comments in tests/qtest/bios-tables-test.c to reflect the current path of bios-tables-test-allowed-diff.h, which is now under tests/qtest/ as well. Signed-off-by: Heyi Guo Message-Id: <20200202110009.51479-1-guoheyi@huawei.com> Reviewed-by: Thomas Huth Reviewed-by: Igor Mammedov Signed-off-by: Thomas Huth --- tests/qtest/bios-tables-test.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'tests') diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c index 3ab4872..b4752c6 100644 --- a/tests/qtest/bios-tables-test.c +++ b/tests/qtest/bios-tables-test.c @@ -14,14 +14,14 @@ * How to add or update the tests: * Contributor: * 1. add empty files for new tables, if any, under tests/data/acpi - * 2. list any changed files in tests/bios-tables-test-allowed-diff.h + * 2. list any changed files in tests/qtest/bios-tables-test-allowed-diff.h * 3. commit the above *before* making changes that affect the tables * * Contributor or ACPI Maintainer (steps 4-7 need to be redone to resolve conflicts * in binary commit created in step 6): * * After 1-3 above tests will pass but ignore differences with the expected files. - * You will also notice that tests/bios-tables-test-allowed-diff.h lists + * You will also notice that tests/qtest/bios-tables-test-allowed-diff.h lists * a bunch of files. This is your hint that you need to do the below: * 4. Run * make check V=1 @@ -40,14 +40,14 @@ * in commit log. * 7. Before sending patches to the list (Contributor) * or before doing a pull request (Maintainer), make sure - * tests/bios-tables-test-allowed-diff.h is empty - this will ensure + * tests/qtest/bios-tables-test-allowed-diff.h is empty - this will ensure * following changes to ACPI tables will be noticed. * * The resulting patchset/pull request then looks like this: - * - patch 1: list changed files in tests/bios-tables-test-allowed-diff.h. + * - patch 1: list changed files in tests/qtest/bios-tables-test-allowed-diff.h. * - patches 2 - n: real changes, may contain multiple patches. * - patch n + 1: update golden master binaries and empty - * tests/bios-tables-test-allowed-diff.h + * tests/qtest/bios-tables-test-allowed-diff.h */ #include "qemu/osdep.h" -- cgit v1.1