QTest patches for 2025-01-02
The following changes since commit 8b70d7f2071e2db51b1910502bfb7f84ebf926be:
Merge tag 'hw-misc-20241231' of https://github.com/philmd/qemu into staging (2025-01-01 15:17:08 -0500)
are available in the Git repository at:
https://gitlab.com/farosas/qemu.git tags/qtest-20250102-pull-request
for you to fetch changes up to d9f2b09dd6c3030cda9af9c29e26a0bdfc02bec6:
qtest/fw-cfg: remove compiled out code (2025-01-02 19:02:11 -0300)
----------------------------------------------------------------
Qtest pull request
- migration-test: fix UADK build, reinstate postcopy tests and other cleanups
- a couple of memory leak fixes for bios-tables-test and virtio-iommu-test
- drop dead code from fw_cfg-test
----------------------------------------------------------------
Ani Sinha (1):
qtest/fw-cfg: remove compiled out code
Fabiano Rosas (5):
tests/qtest/migration: Do proper cleanup in the dirty_limit test tests/qtest/migration: Initialize buffer in probe_o_direct_support tests/qtest/bios-tables-test: Free tables at dump_aml_files tests/qtest/virtio-iommu-test: Don't pass uninitialized data into
qtest_memwrite
tests/qtest/migration: Re-enable postcopy tests
Peter Xu (1):
tests/migration: Drop arch_[source|target]
Shameer Kolothum (1):
tests/qtest/migration: Fix compile errors when CONFIG_UADK is set
tests/qtest/bios-tables-test.c | 1 + tests/qtest/fw_cfg-test.c | 6 --- tests/qtest/migration/compression-tests.c | 54 ----------------------- tests/qtest/migration/framework.c | 8 +--- tests/qtest/migration/migration-util.c | 7 ++- tests/qtest/migration/precopy-tests.c | 5 +++ tests/qtest/virtio-iommu-test.c | 4 +- 7 files changed, 16 insertions(+), 69 deletions(-)
Signature · 1 line
2.35.3
[PULL 1/8] tests/qtest/migration: Fix compile errors when CONFIG_UADK is set
From: Shameer Kolothum <[email protected]>
Removes accidental inclusion of unrelated functions within CONFIG_UADK as this causes compile errors like:
error: redefinition of ‘migrate_hook_start_xbzrle’
Message-Id: <[email protected]>
--- tests/qtest/migration/compression-tests.c | 54 ----------------------- 1 file changed, 54 deletions(-)
tests/qtest/migration/compression-tests.c +0 -54
@@ -88,59 +88,6 @@ migrate_hook_start_precopy_tcp_multifd_uadk(QTestState *from,return migrate_hook_start_precopy_tcp_multifd_common (from, to,"uadk" ); } -static void * -migrate_hook_start_xbzrle (QTestState *from, -QTestState *to) -{ -migrate_set_parameter_int (from,"xbzrle-cache-size" ,33554432 ); - -migrate_set_capability (from,"xbzrle" , true); -migrate_set_capability (to,"xbzrle" , true); - -return NULL ; -} - -static void test_precopy_unix_xbzrle (void ) -{ - g_autofree char *uri = g_strdup_printf("unix:%s/migsocket", tmpfs); -MigrateCommon args = { - .connect_uri = uri, - .listen_uri = uri, - .start_hook = migrate_hook_start_xbzrle, - .iterations =2 , -/* -* XBZRLE needs pages to be modified when doing the 2nd+ round -* iteration to have real data pushed to the stream. -*/ - .live = true, - }; - -test_precopy_common (&args); -} - -static void * -migrate_hook_start_precopy_tcp_multifd_zlib (QTestState *from, -QTestState *to) -{ -/* -* Overloading this test to also check that set_parameter does not error. -* This is also done in the tests for the other compression methods. -*/ -migrate_set_parameter_int (from,"multifd-zlib-level" ,2 ); -migrate_set_parameter_int (to,"multifd-zlib-level" ,2 ); - -return migrate_hook_start_precopy_tcp_multifd_common (from, to,"zlib" ); -} - -static void test_multifd_tcp_zlib (void ) -{ -MigrateCommon args = { - .listen_uri ="defer" , - .start_hook = migrate_hook_start_precopy_tcp_multifd_zlib, - }; -test_precopy_common (&args); -} -static void test_multifd_tcp_uadk (void ) {MigrateCommon args = {
@@ -151,7 +98,6 @@ static void test_multifd_tcp_uadk(void) }#endif /* CONFIG_UADK */ -static void *migrate_hook_start_xbzrle (QTestState *from,QTestState *to)
Signature · 1 line
2.35.3
[PULL 8/8] qtest/fw-cfg: remove compiled out code
In reply to Fabiano RosasFrom: Ani Sinha <[email protected]>
Remove code that is already compiled out. This prevents confusion.
Message-Id: <[email protected]>
--- tests/qtest/fw_cfg-test.c | 6 ------ 1 file changed, 6 deletions(-)
tests/qtest/fw_cfg-test.c +0 -6
@@ -243,12 +243,6 @@ int main(int argc, char **argv)qtest_add_func ("fw_cfg/ram_size" , test_fw_cfg_ram_size);qtest_add_func ("fw_cfg/nographic" , test_fw_cfg_nographic);qtest_add_func ("fw_cfg/nb_cpus" , test_fw_cfg_nb_cpus); -#if 0 -qtest_add_func ("fw_cfg/machine_id" , test_fw_cfg_machine_id); -qtest_add_func ("fw_cfg/kernel" , test_fw_cfg_kernel); -qtest_add_func ("fw_cfg/initrd" , test_fw_cfg_initrd); -qtest_add_func ("fw_cfg/boot_device" , test_fw_cfg_boot_device); -#endif qtest_add_func ("fw_cfg/max_cpus" , test_fw_cfg_max_cpus);qtest_add_func ("fw_cfg/numa" , test_fw_cfg_numa);qtest_add_func ("fw_cfg/boot_menu" , test_fw_cfg_boot_menu);
Signature · 1 line
2.35.3
[PULL 2/8] tests/qtest/migration: Do proper cleanup in the dirty_limit test
In reply to Fabiano RosasThe dirty_limit test does two migrations in a row and is leaking the first 'to' instance. Do proper cleanup.
Message-Id: <[email protected]>
--- tests/qtest/migration/precopy-tests.c | 5 +++++ 1 file changed, 5 insertions(+)
tests/qtest/migration/precopy-tests.c +5 -0
@@ -877,6 +877,11 @@ static void test_dirty_limit(void)migrate_cancel (from);wait_for_migration_status (from,"cancelled" ,NULL ); +/* destination always fails after cancel */ +migration_event_wait (to,"failed" ); +qtest_set_expected_status (to,EXIT_FAILURE ); +qtest_quit (to); +/* Check if dirty limit throttle switched off, set timeout 1ms */ do { throttle_us_per_full =
Signature · 1 line
2.35.3
[PULL 4/8] tests/qtest/bios-tables-test: Free tables at dump_aml_files
In reply to Fabiano RosasThe dump_aml_files() function calls load_expected_aml() to allocate the tables but never frees it. Add the missing call to free_test_data().
Message-Id: <[email protected]>
--- tests/qtest/bios-tables-test.c | 1 + 1 file changed, 1 insertion(+)
tests/qtest/bios-tables-test.c +1 -0
@@ -292,6 +292,7 @@ static void dump_aml_files(test_data *data, bool rebuild)g_free (aml_file); } +free_test_data (&exp_data); }static bool create_tmp_asl (AcpiSdtTable *sdt)
Signature · 1 line
2.35.3
[PULL 6/8] tests/migration: Drop arch_[source|target]
In reply to Fabiano RosasFrom: Peter Xu <[email protected]>
Coverity complained about them. These two variables are never used now after commit 832c732c5d ("migration-test: Create arch_opts"), and/or commit 34cc54fb35 ("tests/qtest/migration-test: Use custom asm bios for ppc64").
Resolves: Coverity CID 1568379
Resolves: Coverity CID 1568380
Message-Id: <[email protected]>
--- tests/qtest/migration/framework.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
tests/qtest/migration/framework.c +2 -6
@@ -197,8 +197,6 @@ static void cleanup(const char *filename)int migrate_start (QTestState **from,QTestState **to,const char *uri,MigrateStart *args) { - g_autofree gchar *arch_source = NULL; - g_autofree gchar *arch_target = NULL;/* options for source and target */ g_autofree gchar *arch_opts = NULL; g_autofree gchar *cmd_source = NULL;
@@ -307,12 +305,11 @@ int migrate_start(QTestState **from, QTestState **to, const char *uri,"-name source,debug-threads=on " "-m %s " "-serial file:%s/src_serial " -"%s %s %s %s %s" , +"%s %s %s %s" , kvm_opts ? kvm_opts :"" , machine, machine_opts, memory_size, tmpfs, arch_opts ? arch_opts :"" , - arch_source ? arch_source :"" , shmem_opts ? shmem_opts :"" , args->opts_source ? args->opts_source :"" , ignore_stderr);
@@ -329,12 +326,11 @@ int migrate_start(QTestState **from, QTestState **to, const char *uri,"-m %s " "-serial file:%s/dest_serial " "-incoming %s " -"%s %s %s %s %s" , +"%s %s %s %s" , kvm_opts ? kvm_opts :"" , machine, machine_opts, memory_size, tmpfs, uri, arch_opts ? arch_opts :"" , - arch_target ? arch_target :"" , shmem_opts ? shmem_opts :"" , args->opts_target ? args->opts_target :"" , ignore_stderr);
Signature · 1 line
2.35.3
[PULL 7/8] tests/qtest/migration: Re-enable postcopy tests
In reply to Fabiano RosasPostcopy tests have been inadvertently disabled since commit 124a3c58b8 ("tests/qtest/migration: Move ufd_version_check to utils"). That commit moved the ufd_version_check() function to another file but failed to make sense of the ifdefs and includes:
The <sys/syscall> include was incorrectly dropped. It is needed to pull in <asm/unistd.h> for __NR_userfaultfd.
The <sys/ioctl.h> was moved under the wrong ifdef.
Message-Id: <[email protected]>
--- tests/qtest/migration/migration-util.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
tests/qtest/migration/migration-util.c +5 -1
@@ -22,6 +22,11 @@#include "migration/bootfile.h" #include "migration/migration-util.h" +#if defined(__linux__) +#include <sys/ioctl.h> +#include <sys/syscall.h> +#endif +/* for uffd_version_check() */ #if defined(__linux__) && defined(__NR_userfaultfd) && defined(CONFIG_EVENTFD )#include <sys/eventfd.h>
@@ -31,7 +36,6 @@/* For dirty ring test; so far only x86_64 is supported */ #if defined(__linux__) && defined(HOST_X86_64 )#include "linux/kvm.h" -#include <sys/ioctl.h> #endif
Signature · 1 line
2.35.3
[PULL 3/8] tests/qtest/migration: Initialize buffer in probe_o_direct_support
In reply to Fabiano RosasValgrind complains about the probe_o_direct_support() function reading from an uninitialized buffer. For probing O_DIRECT support we don't actually need to write to the file, just make sure the pwrite call doesn't reject the write. Still, write zeroes to the buffer to suppress the warning.
Message-Id: <[email protected]>
--- tests/qtest/migration/migration-util.c | 1 + 1 file changed, 1 insertion(+)
tests/qtest/migration/migration-util.c +1 -0
@@ -284,6 +284,7 @@ bool probe_o_direct_support(const char *tmpfs) buf =qemu_try_memalign (len, len);g_assert (buf); +memset (buf,0 , len); ret =pwrite (fd, buf, len, offset);unlink (filename);
Signature · 1 line
2.35.3
[PULL 5/8] tests/qtest/virtio-iommu-test: Don't pass uninitialized data into qtest_memwrite
In reply to Fabiano RosasValgrind complains about:
Use of uninitialised value of size 8
&
Conditional jump or move depends on uninitialised value(s)
both at:
at 0x5265931: _itoa_word (_itoa.c:180)
by 0x527EEC7: __vfprintf_internal (vfprintf-internal.c:1687) by 0x528C8B0: __vsprintf_internal (iovsprintf.c:96) by 0x526B920: sprintf (sprintf.c:30)
by 0x1296C7: qtest_memwrite (libqtest.c:1273)
by 0x193C04: send_map (virtio-iommu-test.c:125)
by 0x194392: test_attach_detach (virtio-iommu-test.c:214) by 0x17BDE7: run_one_test (qos-test.c:181)
by 0x4B0699D: test_case_run (gtestutils.c:2900)
by 0x4B0699D: g_test_run_suite_internal (gtestutils.c:2988) by 0x4B068B2: g_test_run_suite_internal (gtestutils.c:3005) by 0x4B068B2: g_test_run_suite_internal (gtestutils.c:3005) by 0x4B068B2: g_test_run_suite_internal (gtestutils.c:3005)
Uninitialised value was created by a stack allocation
at 0x193AFD: send_map (virtio-iommu-test.c:103)
Message-Id: <[email protected]>
--- tests/qtest/virtio-iommu-test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tests/qtest/virtio-iommu-test.c +2 -2
@@ -105,7 +105,7 @@ static int send_map(QTestState *qts, QVirtioIOMMU *v_iommu,QVirtQueue *vq = v_iommu->vq;uint64_t ro_addr, wr_addr;uint32_t free_head; -struct virtio_iommu_req_map req; +struct virtio_iommu_req_map req = {};size_t ro_size =sizeof (req) -sizeof (struct virtio_iommu_req_tail );size_t wr_size =sizeof (struct virtio_iommu_req_tail );struct virtio_iommu_req_tail buffer;
@@ -147,7 +147,7 @@ static int send_unmap(QTestState *qts, QVirtioIOMMU *v_iommu,QVirtQueue *vq = v_iommu->vq;uint64_t ro_addr, wr_addr;uint32_t free_head; -struct virtio_iommu_req_unmap req; +struct virtio_iommu_req_unmap req = {};size_t ro_size =sizeof (req) -sizeof (struct virtio_iommu_req_tail );size_t wr_size =sizeof (struct virtio_iommu_req_tail );struct virtio_iommu_req_tail buffer;
Signature · 1 line
2.35.3
Stefan Hajnoczi
AppliedApplied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/10.0 for any user-visible changes.