On 04/28/2018 09:41 AM, Max Reitz wrote:
As a showcase of how you can use qemu-io's exit code to determine
success or failure (same for qemu-img), this test is changed to use
qemu_io_silent() instead of qemu_io(), and to assert the exit code
instead of logging the filtered result.

One real advantage of this is that in case of an error, you get a
backtrace that helps you locate the issue in the test file quickly.

Signed-off-by: Max Reitz <mre...@redhat.com>
---
  tests/qemu-iotests/216     | 23 ++++++++++++-----------
  tests/qemu-iotests/216.out | 17 ++---------------
  2 files changed, 14 insertions(+), 26 deletions(-)

-    qemu_img_pipe('create', '-f', iotests.imgfmt, base_img_path, '64M')
+    assert qemu_img('create', '-f', iotests.imgfmt, base_img_path, '64M') == 0

Yeah, I can see how writing the setup for a test gets simpler when you don't have to worry about logging and filtering the stuff that isn't the heart of the test.

Reviewed-by: Eric Blake <ebl...@redhat.com>

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

Reply via email to