aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-03-22Update version for v7.0.0-rc1 releasev7.0.0-rc1Peter Maydell
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2022-03-22Merge tag 'pull-request-2022-03-21' of https://gitlab.com/thuth/qemu into ↵Peter Maydell
staging * Fix stack-overflow due to recursive DMA in intel-hda (CVE-2021-3611) * Fix heap overflow due to recursive DMA in sdhci code # gpg: Signature made Mon 21 Mar 2022 16:14:36 GMT # gpg: using RSA key 27B88847EEE0250118F3EAB92ED9D774FE702DB5 # gpg: issuer "thuth@redhat.com" # gpg: Good signature from "Thomas Huth <th.huth@gmx.de>" [full] # gpg: aka "Thomas Huth <thuth@redhat.com>" [full] # gpg: aka "Thomas Huth <huth@tuxfamily.org>" [full] # gpg: aka "Thomas Huth <th.huth@posteo.de>" [unknown] # Primary key fingerprint: 27B8 8847 EEE0 2501 18F3 EAB9 2ED9 D774 FE70 2DB5 * tag 'pull-request-2022-03-21' of https://gitlab.com/thuth/qemu: tests/qtest/fuzz-sdcard-test: Add reproducer for OSS-Fuzz (Issue 29225) hw/sd/sdhci: Prohibit DMA accesses to devices hw/sd/sdhci: Honor failed DMA transactions tests/qtest/intel-hda-test: Add reproducer for issue #542 hw/audio/intel-hda: Restrict DMA engine to memories (not MMIO devices) hw/audio/intel-hda: Do not ignore DMA overrun errors softmmu/physmem: Introduce MemTxAttrs::memory field and MEMTX_ACCESS_ERROR softmmu/physmem: Simplify flatview_write and address_space_access_valid Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2022-03-22Merge tag 'fixes-pull-request' of gitlab.com:marcandre.lureau/qemu into stagingPeter Maydell
Fixes and cleanups for 7.0 Hi, A collection of fixes & cleanup patches that should be safe for 7.0 inclusion. # gpg: Signature made Tue 22 Mar 2022 12:11:30 GMT # gpg: using RSA key 87A9BD933F87C606D276F62DDAE8E10975969CE5 # gpg: issuer "marcandre.lureau@redhat.com" # gpg: Good signature from "Marc-André Lureau <marcandre.lureau@redhat.com>" [full] # gpg: aka "Marc-André Lureau <marcandre.lureau@gmail.com>" [full] # Primary key fingerprint: 87A9 BD93 3F87 C606 D276 F62D DAE8 E109 7596 9CE5 * tag 'fixes-pull-request' of gitlab.com:marcandre.lureau/qemu: (21 commits) qapi: remove needless include Remove trailing ; after G_DEFINE_AUTO macro tests: remove needless include error: use GLib to remember the program name qga: remove bswap.h include qapi: remove needless include meson: fix CONFIG_ATOMIC128 check meson: move int128 checks from configure qapi: remove needless include util: remove the net/net.h dependency util: remove needless includes scripts/modinfo-collect: remove unused/dead code Move HOST_LONG_BITS to compiler.h Simplify HOST_LONG_BITS compiler.h: replace QEMU_SENTINEL with G_GNUC_NULL_TERMINATED compiler.h: replace QEMU_WARN_UNUSED_RESULT with G_GNUC_WARN_UNUSED_RESULT Replace GCC_FMT_ATTR with G_GNUC_PRINTF Drop qemu_foo() socket API wrapper m68k/nios2-semi: fix gettimeofday() result check vl: typo fix in a comment ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2022-03-22gitlab: disable accelerated zlib for s390xAlex Bennée
There appears to be a bug in the s390 hardware-accelerated version of zlib distributed with Ubuntu 20.04, which makes our test /i386/migration/multifd/tcp/zlib hit an assertion perhaps one time in 10. Fortunately zlib provides an escape hatch where we can disable the hardware-acceleration entirely by setting the environment variable DFLTCC to 0. Do this on all our CI which runs on s390 hosts, both our custom gitlab runner and also the Travis hosts. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Acked-by: Cornelia Huck <cohuck@redhat.com> Message-id: 20220321161151.3654386-1-alex.bennee@linaro.org Cc: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2022-03-22Merge tag 'pull-block-2022-03-22' of https://gitlab.com/hreitz/qemu into stagingPeter Maydell
Block patches for 7.0-rc1: - iotest fixes: - Fix some iotests for riscv targets - Use GNU sed in more places where required - Meson-related fixes (i.e. to print errors when they occur) - Have qemu-img calls (from Python tests) generally raise nicely formattable exceptions on errors - Fix iotest 207 - Allow RBD images to be growable by writing zeroes past the end of file, fixing qcow2 on rbd # gpg: Signature made Tue 22 Mar 2022 11:51:10 GMT # gpg: using RSA key CB62D7A0EE3829E45F004D34A1FA40D098019CDF # gpg: issuer "hreitz@redhat.com" # gpg: Good signature from "Hanna Reitz <hreitz@redhat.com>" [marginal] # gpg: WARNING: This key is not certified with sufficiently trusted signatures! # gpg: It is not certain that the signature belongs to the owner. # Primary key fingerprint: CB62 D7A0 EE38 29E4 5F00 4D34 A1FA 40D0 9801 9CDF * tag 'pull-block-2022-03-22' of https://gitlab.com/hreitz/qemu: (25 commits) iotests/207: Filter host fingerprint iotests.py: Filters for VM.run_job() iotests: make qemu_img_log and img_info_log raise on error iotests: remove qemu_img_pipe_and_status() iotests: replace qemu_img_log('create', ...) calls iotests: use qemu_img() in has_working_luks() iotests: remove remaining calls to qemu_img_pipe() iotests/149: Remove qemu_img_pipe() call iotests: replace unchecked calls to qemu_img_pipe() iotests: change supports_quorum to use qemu_img iotests: add qemu_img_map() function iotests/remove-bitmap-from-backing: use qemu_img_info() iotests: add qemu_img_info() iotests: use qemu_img_json() when applicable iotests: add qemu_img_json() iotests: fortify compare_images() against crashes iotests: make qemu_img raise on non-zero rc by default iotests: Remove explicit checks for qemu_img() == 0 python/utils: add VerboseProcessError python/utils: add add_visual_margin() text decoration utility ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2022-03-22qapi: remove needless includeMarc-André Lureau
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com>
2022-03-22Remove trailing ; after G_DEFINE_AUTO macroMarc-André Lureau
The macro doesn't need it. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
2022-03-22tests: remove needless includeMarc-André Lureau
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com>
2022-03-22error: use GLib to remember the program nameMarc-André Lureau
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com>
2022-03-22qga: remove bswap.h includeMarc-André Lureau
Apparently not needed anymore. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-03-22qapi: remove needless includeMarc-André Lureau
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com>
2022-03-22meson: fix CONFIG_ATOMIC128 checkMarc-André Lureau
The current testing code isn't correct and matching QEMU usage: testfile.c: In function 'main': testfile.c:5:11: error: incorrect number of arguments to function '__atomic_load' 5 | y = __atomic_load(&x, 0); | ^~~~~~~~~~~~~ testfile.c:6:7: error: argument 2 of '__atomic_store' must be a pointer type 6 | __atomic_store(&x, y, 0); | ^~~~~~~~~~~~~~ testfile.c:7:7: error: argument 3 of '__atomic_compare_exchange' must be a pointer type 7 | __atomic_compare_exchange(&x, &y, x, 0, 0, 0); | ^~~~~~~~~~~~~~~~~~~~~~~~~ Replace the test with common atomics test for u64 and u128 that matches better QEMU needs. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
2022-03-22meson: move int128 checks from configureMarc-André Lureau
(note: the test isn't working as intended, the next patches fixes it) Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
2022-03-22qapi: remove needless includeMarc-André Lureau
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
2022-03-22util: remove the net/net.h dependencyMarc-André Lureau
Move qemu_ether_ntoa() which is only needed in net/. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
2022-03-22util: remove needless includesMarc-André Lureau
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
2022-03-22scripts/modinfo-collect: remove unused/dead codeMarc-André Lureau
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Acked-by: John Snow <jsnow@redhat.com>
2022-03-22Move HOST_LONG_BITS to compiler.hMarc-André Lureau
This will help to make common code independent. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
2022-03-22Simplify HOST_LONG_BITSMarc-André Lureau
Simplify the macro, not depending on headers defines, but compiler predefined __SIZEOF__POINTER__ only. Available since gcc 4.3 and clang 2.8. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Acked-by: Richard Henderson <richard.henderson@linaro.org>
2022-03-22compiler.h: replace QEMU_SENTINEL with G_GNUC_NULL_TERMINATEDMarc-André Lureau
One less qemu-specific macro. It also helps to make some headers/units only depend on glib, and thus moved in standalone projects eventually. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
2022-03-22compiler.h: replace QEMU_WARN_UNUSED_RESULT with G_GNUC_WARN_UNUSED_RESULTMarc-André Lureau
One less qemu-specific macro. It also helps to make some headers/units only depend on glib, and thus moved in standalone projects eventually. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
2022-03-22Replace GCC_FMT_ATTR with G_GNUC_PRINTFMarc-André Lureau
One less qemu-specific macro. It also helps to make some headers/units only depend on glib, and thus moved in standalone projects eventually. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
2022-03-22Drop qemu_foo() socket API wrapperMarc-André Lureau
The socket API wrappers were initially introduced in commit 00aa0040 ("Wrap recv to avoid warnings"), but made redundant with commit a2d96af4 ("osdep: add wrappers for socket functions") which fixes the win32 declarations and thus removed the earlier warnings. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
2022-03-22m68k/nios2-semi: fix gettimeofday() result checkMarc-André Lureau
gettimeofday() returns 0 for success. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
2022-03-22vl: typo fix in a commentMarc-André Lureau
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
2022-03-22qemu-options: define -spice only #ifdef CONFIG_SPICEMarc-André Lureau
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1982600 Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
2022-03-22Merge tag 'pull-nbd-2022-03-21' of https://repo.or.cz/qemu/ericb into stagingPeter Maydell
nbd patches for 2022-03-21 - Rao Lei: fix nbd client hang on server death - Vladimir Sementsov-Ogievskiy: email address update - Eric Blake: qemu-nbd documentation tweak # gpg: Signature made Mon 21 Mar 2022 21:35:50 GMT # gpg: using RSA key 71C2CC22B1C4602927D2F3AAA7A16B4A2527436A # gpg: Good signature from "Eric Blake <eblake@redhat.com>" [full] # gpg: aka "Eric Blake (Free Software Programmer) <ebb9@byu.net>" [full] # gpg: aka "[jpeg image of size 6874]" [full] # Primary key fingerprint: 71C2 CC22 B1C4 6029 27D2 F3AA A7A1 6B4A 2527 436A * tag 'pull-nbd-2022-03-21' of https://repo.or.cz/qemu/ericb: block/nbd.c: Fixed IO request coroutine not being wakeup when kill NBD server docs: Consistent typography for options of qemu-nbd MAINTAINERS: change Vladimir's email address Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2022-03-22iotests/207: Filter host fingerprintHanna Reitz
Commit e3296cc796aeaf319f3ed4e064ec309baf5e4da4 made the ssh block driver's error message for fingerprint mismatches more verbose, so it now prints the actual host key fingerprint and the key type. iotest 207 tests such errors, but was not amended to filter that fingerprint (which is host-specific), so do it now. Filter the key type, too, because I guess this too can differ depending on the host configuration. Fixes: e3296cc796aeaf319f3ed4e064ec309baf5e4da4 ("block: print the server key type and fingerprint on failure") Reported-by: John Snow <jsnow@redhat.com> Signed-off-by: Hanna Reitz <hreitz@redhat.com> Message-Id: <20220318125304.66131-3-hreitz@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com>
2022-03-22iotests.py: Filters for VM.run_job()Hanna Reitz
Allow filters for VM.run_job(), and pass the filters given to VM.blockdev_create() to it. (Use this opportunity to annotate VM.run_job()'s parameter types; unfortunately, for the filter, I could not come up with anything better than Callable[[Any], Any] that would pass mypy's scrutiny.) At one point, a plain string is logged, so the filters passed to it must work fine with plain strings. The only filters passed to it at this point are the ones from VM.blockdev_create(), which are filter_qmp_test_files() (by default) and 207's filter_hash(). Both cannot handle plain strings yet, but we can make them by amending filter_qmp() to treat them as plain values with a None key. Signed-off-by: Hanna Reitz <hreitz@redhat.com> Message-Id: <20220318125304.66131-2-hreitz@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com>
2022-03-22iotests: make qemu_img_log and img_info_log raise on errorJohn Snow
Add a `check: bool = True` parameter to both functions and make their qemu_img() invocations raise on error by default. users of img_info_log: 206, 207, 210, 211, 212, 213, 237, 242, 266, 274, 302 users of qemu_img_log: 044, 209, 274, 302, 304 iotests 242 and 266 need to use check=False for their negative tests. iotests 206, 210, 211, 212, 213, 237, 274 and 302 continue working normally. As of this commit, all calls to QEMU_IMG made from iotests enforce a return code of zero by default unless explicitly disabled or suppressed by passing check=False or with an exception handler. Signed-off-by: John Snow <jsnow@redhat.com> Message-Id: <20220321201618.903471-19-jsnow@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Hanna Reitz <hreitz@redhat.com>
2022-03-22iotests: remove qemu_img_pipe_and_status()John Snow
With the exceptional 'create' calls removed in the prior commit, change qemu_img_log() and img_info_log() to call qemu_img() directly instead. For now, allow these calls to qemu-img to return non-zero on the basis that any unusual output will be logged anyway. The very next commit begins to enforce a successful exit code by default even for the logged functions. Signed-off-by: John Snow <jsnow@redhat.com> Message-Id: <20220321201618.903471-18-jsnow@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Hanna Reitz <hreitz@redhat.com>
2022-03-22iotests: replace qemu_img_log('create', ...) callsJohn Snow
qemu_img_log() calls into qemu_img_pipe(), which always removes output for 'create' commands on success anyway. Replace all of these calls to the simpler qemu_img_create(...) which doesn't log, but raises a detailed exception object on failure instead. Blank lines are removed from output files where appropriate. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Hanna Reitz <hreitz@redhat.com> Message-Id: <20220321201618.903471-17-jsnow@redhat.com> Signed-off-by: Hanna Reitz <hreitz@redhat.com>
2022-03-22iotests: use qemu_img() in has_working_luks()John Snow
Admittedly a mostly lateral move, but qemu_img() is essentially the replacement for qemu_img_pipe_and_status(). It will give slightly better diagnostics on crash. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Hanna Reitz <hreitz@redhat.com> Message-Id: <20220321201618.903471-16-jsnow@redhat.com> Signed-off-by: Hanna Reitz <hreitz@redhat.com>
2022-03-22iotests: remove remaining calls to qemu_img_pipe()John Snow
As part of moving all python iotest invocations of qemu-img onto a single qemu_img() implementation, remove a few lingering uses of qemu_img_pipe() from outside of iotests.py itself. Several cases here rely on the knowledge that qemu_img_pipe() suppresses *all* output on a successful case when the command being issued is 'create'. 065: This call's output is inspected, but it appears as if it's expected to succeed. Replace this call with the checked qemu_img() variant instead to get better diagnostics if/when qemu-img itself fails. 237: "create" call output isn't actually logged. Use qemu_img_create() instead, which checks the return code. Remove the empty lines from the test output. 296: Two calls; -create: Expected to succeed. Like other create calls, the output isn't actually logged. Switch to a checked variant (qemu_img_create) instead. The output for this test is a mixture of both test styles, so actually replace the blank line for readability. -amend: This is expected to fail. Log the output. After this patch, the only uses of qemu_img_pipe are internal to iotests.py and will be removed in subsequent patches. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Hanna Reitz <hreitz@redhat.com> Message-Id: <20220321201618.903471-15-jsnow@redhat.com> Signed-off-by: Hanna Reitz <hreitz@redhat.com>
2022-03-22iotests/149: Remove qemu_img_pipe() callJohn Snow
qemu_img_pipe calls blank their output when the command being run is a 'create' call and the command succeeds. Thus, the normative output for this command in iotest 149 is to print a blank line. We can remove the logging from this invocation and use a checked invocation, but we still need to inspect the actual output to see if we want to retroactively skip the test due to missing cipher support. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Hanna Reitz <hreitz@redhat.com> Message-Id: <20220321201618.903471-14-jsnow@redhat.com> Signed-off-by: Hanna Reitz <hreitz@redhat.com>
2022-03-22iotests: replace unchecked calls to qemu_img_pipe()John Snow
qemu_img_pipe() discards the return code from qemu-img in favor of returning just its output. Some tests using this function don't save, log, or check the output either, though, which is unsafe. Replace all of these calls with a checked version. Tests affected are 194, 202, 203, 234, 262, and 303. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Hanna Reitz <hreitz@redhat.com> Message-Id: <20220321201618.903471-13-jsnow@redhat.com> Signed-off-by: Hanna Reitz <hreitz@redhat.com>
2022-03-22iotests: change supports_quorum to use qemu_imgJohn Snow
Similar to other recent changes: use the qemu_img() invocation that supports throwing loud, nasty exceptions when it fails for surprising reasons. (Why would "--help" ever fail? I don't know, but eliminating *all* calls to qemu-img that do not go through qemu_img() is my goal, so qemu_img_pipe() has to be removed.) Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Hanna Reitz <hreitz@redhat.com> Message-Id: <20220321201618.903471-12-jsnow@redhat.com> Signed-off-by: Hanna Reitz <hreitz@redhat.com>
2022-03-22iotests: add qemu_img_map() functionJohn Snow
Add a qemu_img_map() function by analogy with qemu_img_measure(), qemu_img_check(), and qemu_img_info() that all return JSON information. Replace calls to qemu_img_pipe('map', '--output=json', ...) with this new function, which provides better diagnostic information on failure. Note: The output for iotest 211 changes, because logging JSON after it was deserialized by Python behaves a little differently than logging the raw JSON document string itself. (iotests.log() sorts the keys for Python 3.6 support.) Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20220321201618.903471-11-jsnow@redhat.com> Signed-off-by: Hanna Reitz <hreitz@redhat.com>
2022-03-22iotests/remove-bitmap-from-backing: use qemu_img_info()John Snow
This removes two more usages of qemu_img_pipe() and replaces them with calls to qemu_img(), which provides better diagnostic information on failure. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Hanna Reitz <hreitz@redhat.com> Message-Id: <20220321201618.903471-10-jsnow@redhat.com> Signed-off-by: Hanna Reitz <hreitz@redhat.com>
2022-03-22iotests: add qemu_img_info()John Snow
Add qemu_img_info() by analogy with qemu_img_measure() and qemu_img_check(). Modify image_size() to use this function instead to take advantage of the better diagnostic information on failure provided (ultimately) by qemu_img(). Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Hanna Reitz <hreitz@redhat.com> Message-Id: <20220321201618.903471-9-jsnow@redhat.com> Signed-off-by: Hanna Reitz <hreitz@redhat.com>
2022-03-22iotests: use qemu_img_json() when applicableJohn Snow
qemu_img_json() gives better diagnostic information on failure. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Hanna Reitz <hreitz@redhat.com> Message-Id: <20220321201618.903471-8-jsnow@redhat.com> Signed-off-by: Hanna Reitz <hreitz@redhat.com>
2022-03-22iotests: add qemu_img_json()John Snow
qemu_img_json() is a new helper built on top of qemu_img() that tries to pull a valid JSON document out of the stdout stream. In the event that the return code is negative (the program crashed), or the code is greater than zero and did not produce valid JSON output, the VerboseProcessError raised by qemu_img() is re-raised. In the event that the return code is zero but we can't parse valid JSON, allow the JSON deserialization error to be raised. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20220321201618.903471-7-jsnow@redhat.com> Signed-off-by: Hanna Reitz <hreitz@redhat.com>
2022-03-22iotests: fortify compare_images() against crashesJohn Snow
Fortify compare_images() to be more discerning about the status codes it receives. If qemu_img() returns an exit code that implies it didn't actually perform the comparison, treat that as an exceptional circumstance and force the caller to be aware of the peril. If a negative test is desired (perhaps to test how qemu_img compare behaves on malformed images, for instance), it is still possible to catch the exception in the test and deal with that circumstance manually. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Hanna Reitz <hreitz@redhat.com> Message-Id: <20220321201618.903471-6-jsnow@redhat.com> Signed-off-by: Hanna Reitz <hreitz@redhat.com>
2022-03-22iotests: make qemu_img raise on non-zero rc by defaultJohn Snow
re-write qemu_img() as a function that will by default raise a VerboseProcessException (extended from CalledProcessException) on non-zero return codes. This will produce a stack trace that will show the command line arguments and return code from the failed process run. Users that want something more flexible (there appears to be only one) can use check=False and manage the return themselves. However, when the return code is negative, the Exception will be raised no matter what. This is done under the belief that there's no legitimate reason, even in negative tests, to see a crash from qemu-img. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Hanna Reitz <hreitz@redhat.com> Message-Id: <20220321201618.903471-5-jsnow@redhat.com> Signed-off-by: Hanna Reitz <hreitz@redhat.com>
2022-03-22iotests: Remove explicit checks for qemu_img() == 0John Snow
qemu_img() returning zero ought to be the rule, not the exception. Remove all explicit checks against the condition in preparation for making non-zero returns an Exception. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Hanna Reitz <hreitz@redhat.com> Message-Id: <20220321201618.903471-4-jsnow@redhat.com> Signed-off-by: Hanna Reitz <hreitz@redhat.com>
2022-03-22python/utils: add VerboseProcessErrorJohn Snow
This adds an Exception that extends the Python stdlib subprocess.CalledProcessError. The difference is that the str() method of this exception also adds the stdout/stderr logs. In effect, if this exception goes unhandled, Python will print the output in a visually distinct wrapper to the terminal so that it's easy to spot in a sea of traceback information. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Hanna Reitz <hreitz@redhat.com> Message-Id: <20220321201618.903471-3-jsnow@redhat.com> Signed-off-by: Hanna Reitz <hreitz@redhat.com>
2022-03-22python/utils: add add_visual_margin() text decoration utilityJohn Snow
>>> print(add_visual_margin(msg, width=72, name="Commit Message")) ┏━ Commit Message ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ┃ add_visual_margin() takes a chunk of text and wraps it in a visual ┃ container that force-wraps to a specified width. An optional title ┃ label may be given, and any of the individual glyphs used to draw the ┃ box may be replaced or specified as well. ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Acked-by: Hanna Reitz <hreitz@redhat.com> Message-Id: <20220321201618.903471-2-jsnow@redhat.com> Signed-off-by: Hanna Reitz <hreitz@redhat.com>
2022-03-22tests/qemu-iotests/testrunner: Supply a test plan in TAP modeThomas Huth
Quoting the TAP specification: "The plan tells how many tests will be run [...]. It’s a check that the test file hasn’t stopped prematurely." That's a good idea of course, so let's support that in the iotest testrunner, too. Signed-off-by: Thomas Huth <thuth@redhat.com> Message-Id: <20220223095816.2663005-1-thuth@redhat.com> Signed-off-by: Hanna Reitz <hreitz@redhat.com>
2022-03-22tests: Do not treat the iotests as separate meson test target anymoreThomas Huth
If there is a failing iotest, the output is currently not logged to the console anymore. To get this working again, we need to run the meson test runner with "--print-errorlogs" (and without "--verbose" due to a current meson bug that will be fixed here: https://github.com/mesonbuild/meson/commit/c3f145ca2b9f5.patch ). We could update the "meson test" call in tests/Makefile.include, but actually it's nicer and easier if we simply do not treat the iotests as separate test target anymore and integrate them along with the other test suites. This has the disadvantage of not getting the detailed progress indication there anymore, but since that was only working right in single-threaded "make -j1" mode anyway, it's not a huge loss right now. Signed-off-by: Thomas Huth <thuth@redhat.com> Message-Id: <20220310075048.2303495-1-thuth@redhat.com> Tested-by: Hanna Reitz <hreitz@redhat.com> Signed-off-by: Hanna Reitz <hreitz@redhat.com>
2022-03-22tests/qemu-iotests: Use GNU sed in two more spots where it is necessaryThomas Huth
These two spots have been missed in commit 9086c7639822 ("Rework the checks and spots using GNU sed") - they need GNU sed, too, since they are using the "+" address form. Signed-off-by: Thomas Huth <thuth@redhat.com> Message-Id: <20220309101626.637836-1-thuth@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Hanna Reitz <hreitz@redhat.com>