aboutsummaryrefslogtreecommitdiff
path: root/tests/migration-test.c
AgeCommit message (Collapse)Author
2020-01-12test: Move qtests to a separate directoryThomas Huth
The tests directory itself is pretty overcrowded, and it's hard to see which test belongs to which test subsystem (unit, qtest, ...). Let's move the qtests to a separate folder for more clarity. Message-Id: <20191218103059.11729-6-thuth@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2020-01-06tests: add migration-helpers unitMarc-André Lureau
Move a few helper functions from migration-test.c to migration-helpers.c Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2019-12-17vl: configure accelerators from -accel optionsPaolo Bonzini
Drop the "accel" property from MachineState, and instead desugar "-machine accel=" to a list of "-accel" options. This has a semantic change due to removing merge_lists from -accel. For example: - "-accel kvm -accel tcg" all but ignored "-accel kvm". This is a bugfix. - "-accel kvm -accel thread=single" ignored "thread=single", since it applied the option to KVM. Now it fails due to not specifying the accelerator on "-accel thread=single". - "-accel tcg -accel thread=single" chose single-threaded TCG, while now it will fail due to not specifying the accelerator on "-accel thread=single". Also, "-machine accel" and "-accel" become incompatible. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-12-17migration-test: Use a struct for test_migrate_start parametersJuan Quintela
It has two bools and two strings, it is very difficult to remember which does what. And it makes very difficult to add new parameters as we need to modify all the callers. Signed-off-by: Juan Quintela <quintela@redhat.com> Tested-by: Cornelia Huck <cohuck@redhat.com> #s390x Tested-by: Laurent Vivier <lvivier@redhat.com>
2019-12-17migration-test: Rename cmd_src/dst to arch_source/arch_targetJuan Quintela
This explains better what they do and avoid confussino with command_src/target. Signed-off-by: Juan Quintela <quintela@redhat.com> Tested-by: Cornelia Huck <cohuck@redhat.com> #s390x Tested-by: Laurent Vivier <lvivier@redhat.com>
2019-12-17migration-test: Move -incomming handling to common commandlineJuan Quintela
Signed-off-by: Juan Quintela <quintela@redhat.com> Tested-by: Cornelia Huck <cohuck@redhat.com> #s390x Tested-by: Laurent Vivier <lvivier@redhat.com>
2019-12-17migration-test: Move -serial handling to common commandlineJuan Quintela
Signed-off-by: Juan Quintela <quintela@redhat.com> Tested-by: Cornelia Huck <cohuck@redhat.com> #s390x Tested-by: Laurent Vivier <lvivier@redhat.com>
2019-12-17migration-test: Move -name handling to common commandlineJuan Quintela
Signed-off-by: Juan Quintela <quintela@redhat.com> Tested-by: Cornelia Huck <cohuck@redhat.com> #s390x Tested-by: Laurent Vivier <lvivier@redhat.com>
2019-12-17migration-test: Move shmem handling to common commandlineJuan Quintela
Signed-off-by: Juan Quintela <quintela@redhat.com> Tested-by: Cornelia Huck <cohuck@redhat.com> #s390x Tested-by: Laurent Vivier <lvivier@redhat.com>
2019-12-17migration-test: Move memory size to common commandlineJuan Quintela
Signed-off-by: Juan Quintela <quintela@redhat.com> Tested-by: Cornelia Huck <cohuck@redhat.com> #s390x Tested-by: Laurent Vivier <lvivier@redhat.com>
2019-12-17migration-test: Move -machine to common commandlineJuan Quintela
Signed-off-by: Juan Quintela <quintela@redhat.com> Tested-by: Cornelia Huck <cohuck@redhat.com> #s390x Tested-by: Laurent Vivier <lvivier@redhat.com>
2019-12-17migration-test: Move hide_stderr to common commandlineJuan Quintela
Signed-off-by: Juan Quintela <quintela@redhat.com> Tested-by: Cornelia Huck <cohuck@redhat.com> #s390x Tested-by: Laurent Vivier <lvivier@redhat.com>
2019-12-17migration-test: Create cmd_soure and cmd_targetJuan Quintela
We are repeating almost everything for each machine while creating the command line for migration. And once for source and another for destination. We start putting there opts_src and opts_dst. Signed-off-by: Juan Quintela <quintela@redhat.com> Tested-by: Cornelia Huck <cohuck@redhat.com> #s390x Tested-by: Laurent Vivier <lvivier@redhat.com>
2019-12-17pseries: disable migration-test if /dev/kvm cannot be usedLaurent Vivier
On ppc64, migration-test only works with kvm_hv, and we already have a check to verify the module is loaded. kvm_hv module can be loaded in memory and /sys/module/kvm_hv exists, but on some systems (like build systems) /dev/kvm can be missing (by administrators choice). And as kvm_hv exists test-migration is started but QEMU falls back to TCG because it cannot be used: Could not access KVM kernel module: No such file or directory failed to initialize KVM: No such file or directory Back to tcg accelerator And as the test is done with TCG, it fails. As for s390x, we must check for the existence and the access rights of /dev/kvm. Reported-by: Cole Robinson <crobinso@redhat.com> Signed-off-by: Laurent Vivier <lvivier@redhat.com> Message-Id: <20191120170955.242900-1-lvivier@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Greg Kurz <groug@kaod.org> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2019-11-26pseries: fix migration-test and pxe-testLaurent Vivier
Commit 29cb4187497d ("spapr: Set VSMT to smp_threads by default") has introduced a new default value for VSMT that is not supported by old kernels (before 4.13 kernel) and this breaks "make check" on these kernels. To fix that, explicitly set in the involved tests the value that was used as the default value before the change. Cc: Greg Kurz <groug@kaod.org> Signed-off-by: Laurent Vivier <lvivier@redhat.com> Message-Id: <20191120142539.236279-1-lvivier@redhat.com> Acked-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Tested-by: Greg Kurz <groug@kaod.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2019-11-11tests/migration: Print some debug on bad statusDr. David Alan Gilbert
We're seeing occasional asserts in 'wait_for_migraiton_fail', that I can't reliably reproduce, and where the cores don't have any useful state. Print the 'status' out, so we can see which unexpected state we're ending up in. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Message-Id: <20191108104307.125020-1-dgilbert@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2019-10-03tests/migration: Add a test for auto convergeYury Kotov
Signed-off-by: Yury Kotov <yury-kotov@yandex-team.ru> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Message-Id: <20190909131335.16848-4-yury-kotov@yandex-team.ru> [Reorganize check_migration_status for rebase. - Paolo] Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-09-25tests/migration/postcopy: trim migration bandwidthDr. David Alan Gilbert
On slow hosts with tcg we were sometimes finding that the migration would complete during precopy and never get into the postcopy test. Trim back the bandwidth a bit to make that much less likely. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Message-Id: <20190923131022.15498-3-dgilbert@redhat.com> Reviewed-by: Cleber Rosa <crosa@redhat.com> Acked-by: Alex Bennée <alex.bennee@linaro.org> Tested-by: Cleber Rosa <crosa@redhat.com> Tested-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
2019-09-25tests/migration: Fail on unexpected migration statesDr. David Alan Gilbert
We've got various places where we wait for a migration to enter a given state; but if we enter an unexpected state we tend to fail in odd ways; add a mechanism for explicitly testing for any state which we shouldn't be in. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Message-Id: <20190923131022.15498-2-dgilbert@redhat.com> Reviewed-by: Cleber Rosa <crosa@redhat.com> Tested-by: Cleber Rosa <crosa@redhat.com> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
2019-09-12tests/migration: Add a test for validate-uuid capabilityYury Kotov
Signed-off-by: Yury Kotov <yury-kotov@yandex-team.ru> Message-Id: <20190903162246.18524-4-yury-kotov@yandex-team.ru> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
2019-09-05tests/migration: Do not use functions anymore that rely on global_qtestThomas Huth
The migration tests deal with multiple test states, so we really should not use functions here that rely on the single global_qtest variable. Switch from qtest_start() to qtest_init() to make sure that global_qtest is not set anymore. This also revealed a regression in the migrate() function: It has once been converted to use the qtest_qmp() function, but commit b5bbd3f315d686bd511 ("Clean up string interpolation into QMP, part 2") accidentally reverted it back to qmp(). Message-Id: <20190904130047.25808-2-thuth@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Laurent Vivier <lvivier@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2019-08-16Clean up inclusion of sysemu/sysemu.hMarkus Armbruster
In my "build everything" tree, changing sysemu/sysemu.h triggers a recompile of some 5400 out of 6600 objects (not counting tests and objects that don't depend on qemu/osdep.h). Almost a third of its inclusions are actually superfluous. Delete them. Downgrade two more to qapi/qapi-types-run-state.h, and move one from char/serial.h to char/serial.c. hw/semihosting/config.c, monitor/monitor.c, qdev-monitor.c, and stubs/semihost.c define variables declared in sysemu/sysemu.h without including it. The compiler is cool with that, but include it anyway. This doesn't reduce actual use much, as it's still included into widely included headers. The next commit will tackle that. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Message-Id: <20190812052359.30071-27-armbru@redhat.com> Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
2019-07-23tests/migration-test: don't spam the logs when we failAlex Bennée
Quite often the information about which test failed is hidden by the wall of repeated failures for each page. Stop outputting the error after 10 bad pages and just summarise the total damage at the end. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Laurent Vivier <lvivier@redhat.com>
2019-07-15migration-test: rename parameter to parameter_intJuan Quintela
We would need _str ones on the next patch. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Wei Yang <richardw.yang@linux.intel.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
2019-07-08tests/migration-test: Fix read off end of aarch64_kernel arrayPeter Maydell
The test aarch64 kernel is in an array defined with unsigned char aarch64_kernel[] = { [...] } which means it could be any size; currently it's quite small. However we write it to a file using init_bootfile(), which writes exactly 512 bytes to the file. This will break if we ever end up with a kernel larger than that, and will read garbage off the end of the array in the current setup where the kernel is smaller. Make init_bootfile() take an argument giving the length of the data to write. This allows us to use it for all architectures (previously s390 had a special-purpose init_bootfile_s390x which hardcoded the file to write so it could write the correct length). We assert that the x86 bootfile really is exactly 512 bytes as it should be (and as we were previously just assuming it was). This was detected by the clang-7 asan: ==15607==ERROR: AddressSanitizer: global-buffer-overflow on address 0x55a796f51d20 at pc 0x55a796b89c2f bp 0x7ffc58e89160 sp 0x7ffc58e88908 READ of size 512 at 0x55a796f51d20 thread T0 #0 0x55a796b89c2e in fwrite (/home/petmay01/linaro/qemu-from-laptop/qemu/build/sanitizers/tests/migration-test+0xb0c2e) #1 0x55a796c46492 in init_bootfile /home/petmay01/linaro/qemu-from-laptop/qemu/tests/migration-test.c:99:5 #2 0x55a796c46492 in test_migrate_start /home/petmay01/linaro/qemu-from-laptop/qemu/tests/migration-test.c:593 #3 0x55a796c44101 in test_baddest /home/petmay01/linaro/qemu-from-laptop/qemu/tests/migration-test.c:854:9 #4 0x7f906ffd3cc9 (/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x72cc9) #5 0x7f906ffd3bfa (/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x72bfa) #6 0x7f906ffd3bfa (/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x72bfa) #7 0x7f906ffd3ea1 in g_test_run_suite (/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x72ea1) #8 0x7f906ffd3ec0 in g_test_run (/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x72ec0) #9 0x55a796c43707 in main /home/petmay01/linaro/qemu-from-laptop/qemu/tests/migration-test.c:1187:11 #10 0x7f906e9abb96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310 #11 0x55a796b6c2d9 in _start (/home/petmay01/linaro/qemu-from-laptop/qemu/build/sanitizers/tests/migration-test+0x932d9) Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Laurent Vivier <lvivier@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-id: 20190702150311.20467-1-peter.maydell@linaro.org
2019-06-12Include qemu/module.h where needed, drop it from qemu-common.hMarkus Armbruster
Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20190523143508.25387-4-armbru@redhat.com> [Rebased with conflicts resolved automatically, except for hw/usb/dev-hub.c hw/misc/exynos4210_rng.c hw/misc/bcm2835_rng.c hw/misc/aspeed_scu.c hw/display/virtio-vga.c hw/arm/stm32f205_soc.c; ui/cocoa.m fixed up]
2019-06-05migration-test: Add a test for fd protocolYury Kotov
Signed-off-by: Yury Kotov <yury-kotov@yandex-team.ru> Reviewed-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
2019-03-12test-migration: fix memory leakPaolo Bonzini
Reported by ASAN. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-03-07tests: Do not use "\n" in g_test_message() stringsThomas Huth
g_test_message() takes care of the newline on its own, so we should not use \n in the strings here. Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2019-03-06tests: Add basic migration precopy tcp testJuan Quintela
Not sharing code from precopy/unix because we have to read back the tcp parameter. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Message-Id: <20190227105128.1655-4-quintela@redhat.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> dgilbert: Fixup for clash with Yury's
2019-03-06tests: Add migration xbzrle testJuan Quintela
Reviewed-by: Peter Xu <peterx@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com> Message-Id: <20190227105128.1655-2-quintela@redhat.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> dgilbert: Fixup for class with Yury's series
2019-03-06tests/migration-test: Add a test for ignore-shared capabilityYury Kotov
Signed-off-by: Yury Kotov <yury-kotov@yandex-team.ru> Message-Id: <20190215174548.2630-5-yury-kotov@yandex-team.ru> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> dgilbert: Disabled the test for now, not happy on aarch64
2019-01-11test: execute g_test_run when tests are skippedPaolo Bonzini
Sometimes a test's main() function recognizes that the environment does not support the test, and therefore exits. In this case, we still should run g_test_run() so that a TAP harness will print the test plan ("1..0") and the test will be marked as skipped. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <1543513531-1151-2-git-send-email-pbonzini@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2018-10-24tests/migration-test: Disable s390x test when running with TCGThomas Huth
The migration test for s390x sometimes hangs when running with TCG, similar to the problems that we have already observed with TCG for the ppc64 guests. Thus disable the s390x test when we are not running with KVM for now until the problem with TCG has been resolved. Reviewed-by: Laurent Vivier <lvivier@redhat.com> Reviewed-by: Emilio G. Cota <cota@braap.org> Signed-off-by: Thomas Huth <thuth@redhat.com>
2018-10-11tests/migration: Enable the migration test on s390x, tooThomas Huth
We can re-use the s390-ccw bios code to implement a small firmware for a s390x guest which prints out the "A" and "B" characters and modifies the memory, as required for the migration test. [quintela: Converted the compile script to Makefile rules] Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com> Message-Id: <1539078677-25396-1-git-send-email-thuth@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Fixed up Makefile since the aarch patch sneaked in first
2018-10-11tests: Add migration test for aarch64Wei Huang
This patch adds migration test support for aarch64. The test code, which implements the same functionality as x86, is booted as a kernel in qemu. Here are the design choices we make for aarch64: * We choose this -kernel approach because aarch64 QEMU doesn't provide a built-in fw like x86 does. So instead of relying on a boot loader, we use -kernel approach for aarch64. * The serial output is sent to PL011 directly. * The physical memory base for mach-virt machine is 0x40000000. We change the start_address and end_address for aarch64. In addition to providing the binary, this patch also includes the source code and the build script in tests/migration/aarch64. So users can change the source and/or re-compile the binary as they wish. Reviewed-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Andrew Jones <drjones@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Wei Huang <wei@redhat.com> Message-Id: <1538669326-28135-1-git-send-email-wei@redhat.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
2018-09-26tests/migration: Speed up the test on ppc64Thomas Huth
The SLOF boot process is always quite slow ... but we can speed it up a little bit by specifying "-nodefaults" and by using the "nvramrc" variable instead of "boot-command" (since "nvramrc" is evaluated earlier in the SLOF boot process than "boot-command"). Signed-off-by: Thomas Huth <thuth@redhat.com> Message-Id: <1537204330-16076-1-git-send-email-thuth@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Laurent Vivier <lvivier@redhat.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
2018-09-26tests/migration: Add migration-test header fileWei Huang
This patch moves the settings related migration-test from the migration-test.c file to a new header file. Reviewed-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Andrew Jones <drjones@redhat.com> Signed-off-by: Wei Huang <wei@redhat.com> Message-Id: <1536174934-26022-4-git-send-email-wei@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
2018-09-26tests/migration: Support cross compilation in generating boot header fileWei Huang
Recently a new configure option, CROSS_CC_GUEST, was added to $(TARGET)-softmmu/config-target.mak to support TCG-related tests. This patch tries to leverage this option to support cross compilation when the migration boot block file is being re-generated: * The x86 related files are moved to a new sub-dir (named ./i386). * A new top-layer Makefile is created in tests/migration/ directory. This Makefile searches and parses CROSS_CC_GUEST to generate CROSS_PREFIX. The CROSS_PREFIX, if available, is then passed to migration/$ARCH/Makefile. Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Wei Huang <wei@redhat.com> Message-Id: <1536174934-26022-3-git-send-email-wei@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
2018-08-23tests/migration-test: Silence the kvm_hv message by defaultThomas Huth
When running "make check" on a non-POWER host, the output is quite distorted like this: [...] GTESTER check-qtest-nios2 GTESTER check-qtest-or1k GTESTER check-qtest-ppc64 Skipping test: kvm_hv not available Skipping test: kvm_hv not available Skipping test: kvm_hv not available Skipping test: kvm_hv not available GTESTER check-qtest-ppcemb GTESTER check-qtest-ppc GTESTER check-qtest-riscv32 GTESTER check-qtest-riscv64 [...] Move the check to the beginning of the main function instead, so that we do not have to test the condition again and again for each test, and better use g_test_message() instead of g_print() here, like it is also done in ufd_version_check() already. Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com> Message-Id: <1534419358-10932-2-git-send-email-thuth@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2018-08-16migration-test: Clean up string interpolation into QMP, part 3Markus Armbruster
Leaving interpolation into JSON to qmp() is more robust than building QMP input manually, as explained in the recent commit "tests: Clean up string interpolation into QMP input (simple cases)". migration-test.c interpolates strings into JSON in a few places: * migrate_set_parameter() interpolates string parameter @value as a JSON number. Change it to long long. This requires changing migrate_check_parameter() similarly. * migrate_set_capability() interpolates string parameter @value as a JSON boolean. Change it to bool. * deprecated_set_speed() interpolates string parameter @value as a JSON number. Change it to long long. Bonus: gets rid of non-literal format strings. A step towards compile-time format string checking without triggering -Wformat-nonliteral. Cc: Juan Quintela <quintela@redhat.com> Cc: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20180806065344.7103-21-armbru@redhat.com>
2018-08-16migration-test: Clean up string interpolation into QMP, part 2Markus Armbruster
Leaving interpolation into JSON to qmp() is more robust than building QMP input manually, as explained in the recent commit "tests: Clean up string interpolation into QMP input (simple cases)". migrate() interpolates members into a JSON object. Change it to take its extra QMP arguments as arguments for qdict_from_jsonf_nofail() instead of a string containing JSON members. Bonus: gets rid of a non-literal format string. A step towards compile-time format string checking without triggering -Wformat-nonliteral. Cc: Juan Quintela <quintela@redhat.com> Cc: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20180806065344.7103-20-armbru@redhat.com>
2018-08-16migration-test: Clean up string interpolation into QMP, part 1Markus Armbruster
Leaving interpolation into JSON to qmp() is more robust than building QMP input manually, as explained in the recent commit "tests: Clean up string interpolation into QMP input (simple cases)". migrate_recover() builds QMP input manually because wait_command() can't interpolate. Well, it can since the previous commit. Simplify accordingly. Bonus: gets rid of a non-literal format string. A step towards compile-time format string checking without triggering -Wformat-nonliteral. Cc: Juan Quintela <quintela@redhat.com> Cc: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20180806065344.7103-19-armbru@redhat.com>
2018-08-16migration-test: Make wait_command() cope with '%'Markus Armbruster
wait_command() passes its argument @command to qtest_qmp_send(). Falls apart if @command contain '%'. Two ways to disarm this trap: suppress interpretation of '%' by passing @command as argument to format string "%s", or fix it by having wait_command() take the variable arguments to go with @command. Do the latter. This is another step towards compile-time format string checking without triggering -Wformat-nonliteral. Cc: Juan Quintela <quintela@redhat.com> Cc: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20180806065344.7103-18-armbru@redhat.com>
2018-08-16tests: New helper qtest_qmp_receive_success()Markus Armbruster
Commit b21373d0713 copied wait_command() from tests/migration-test.c to tests/tpm-util.c. Replace both copies by new libqtest helper qtest_qmp_receive_success(). Also use it to simplify qtest_qmp_device_del(). Bonus: gets rid of a non-literal format string. A step towards compile-time format string checking without triggering -Wformat-nonliteral. Cc: Thomas Huth <thuth@redhat.com> Cc: Juan Quintela <quintela@redhat.com> Cc: Dr. David Alan Gilbert <dgilbert@redhat.com> Cc: Stefan Berger <stefanb@linux.vnet.ibm.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20180806065344.7103-17-armbru@redhat.com>
2018-08-16migration-test: Make wait_command() return the "return" memberMarkus Armbruster
All callers of wait_command() are only interested in the success response's "return" member. Lift its extraction into wait_command(). Cc: Juan Quintela <quintela@redhat.com> Cc: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20180806065344.7103-16-armbru@redhat.com>
2018-08-16tests: Clean up string interpolation into QMP input (simple cases)Markus Armbruster
When you build QMP input manually like this cmd = g_strdup_printf("{ 'execute': 'migrate'," "'arguments': { 'uri': '%s' } }", uri); rsp = qmp(cmd); g_free(cmd); you're responsible for escaping the interpolated values for JSON. Not done here, and therefore works only for sufficiently nice @uri. For instance, if @uri contained a single "'", qobject_from_vjsonf_nofail() would abort. A sufficiently nasty @uri could even inject unwanted members into the arguments object. Leaving interpolation into JSON to qmp() is more robust: rsp = qmp("{ 'execute': 'migrate', 'arguments': { 'uri': %s } }", uri); It's also more concise. Clean up the simple cases where we interpolate exactly a JSON value. Bonus: gets rid of non-literal format strings. A step towards compile-time format string checking without triggering -Wformat-nonliteral. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20180806065344.7103-13-armbru@redhat.com>
2018-08-16libqtest: Remove qtest_qmp_discard_response() & friendsMarkus Armbruster
qtest_qmp_discard_response(...) is shorthand for qobject_unref(qtest_qmp(...), except it's not actually shorter. Moreover, the presence of these functions encourage sloppy testing. Remove them from libqtest. Add them as macros to the tests that use them, with a TODO comment asking for cleanup. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20180806065344.7103-5-armbru@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com>
2018-07-24tests: only update last_byte when at the edgePeter Xu
The only possible change of last_byte is when it reaches the edge. Setting it every time might let last_byte contain an invalid data when memory corruption is detected, then the check of the next byte will be incorrect. For example, a single page corruption at address 0x14ad000 will also lead to a "fake" corruption at 0x14ae000: Memory content inconsistency at 14ad000 first_byte = 44 last_byte = 44 current = ef hit_edge = 0 Memory content inconsistency at 14ae000 first_byte = 44 last_byte = ef current = 44 hit_edge = 0 After the patch, it'll only report the corrputed page: Memory content inconsistency at 14ad000 first_byte = 44 last_byte = 44 current = ef hit_edge = 0 Signed-off-by: Peter Xu <peterx@redhat.com> Message-Id: <20180723123305.24792-4-peterx@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
2018-07-10tests: hide stderr for postcopy recovery testPeter Xu
We dumped something when network failure happens. We should avoid those messages to be dumped when running the tests: $ ./tests/migration-test -p /x86_64/migration/postcopy/recovery /x86_64/migration/postcopy/recovery: qemu-system-x86_64: check_section_footer: Read section footer failed: -5 qemu-system-x86_64: Detected IO failure for postcopy. Migration paused. qemu-system-x86_64: Detected IO failure for postcopy. Migration paused. OK After the patch: $ ./tests/migration-test -p /x86_64/migration/postcopy/recovery /x86_64/migration/postcopy/recovery: OK Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Peter Xu <peterx@redhat.com> Message-Id: <20180710091902.28780-11-peterx@redhat.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>