qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: qemu-block@nongnu.org
Cc: qemu-devel@nongnu.org, Max Reitz <mreitz@redhat.com>,
	Eric Blake <eblake@redhat.com>, Kevin Wolf <kwolf@redhat.com>
Subject: [Qemu-devel] [PATCH v2 4/5] iotests.py: Add qemu_io_silent
Date: Wed,  9 May 2018 21:43:01 +0200	[thread overview]
Message-ID: <20180509194302.21585-5-mreitz@redhat.com> (raw)
In-Reply-To: <20180509194302.21585-1-mreitz@redhat.com>

With qemu-io now returning a useful exit code, some tests may find it
sufficient to just query that instead of logging (and filtering) the
whole output.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
---
 tests/qemu-iotests/iotests.py | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
index b25d48a91b..9747ca9eba 100644
--- a/tests/qemu-iotests/iotests.py
+++ b/tests/qemu-iotests/iotests.py
@@ -119,6 +119,15 @@ def qemu_io(*args):
         sys.stderr.write('qemu-io received signal %i: %s\n' % (-exitcode, ' '.join(args)))
     return subp.communicate()[0]
 
+def qemu_io_silent(*args):
+    '''Run qemu-io and return the exit code, suppressing stdout'''
+    args = qemu_io_args + list(args)
+    exitcode = subprocess.call(args, stdout=open('/dev/null', 'w'))
+    if exitcode < 0:
+        sys.stderr.write('qemu-io received signal %i: %s\n' %
+                         (-exitcode, ' '.join(args)))
+    return exitcode
+
 
 class QemuIoInteractive:
     def __init__(self, *args):
-- 
2.14.3

  parent reply	other threads:[~2018-05-09 19:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-09 19:42 [Qemu-devel] [PATCH v2 0/5] qemu-io: Exit with error when a command failed Max Reitz
2018-05-09 19:42 ` [Qemu-devel] [PATCH v2 1/5] qemu-io: Drop command functions' return values Max Reitz
2018-05-09 19:42 ` [Qemu-devel] [PATCH v2 2/5] qemu-io: Let command functions return error code Max Reitz
2018-05-09 19:43 ` [Qemu-devel] [PATCH v2 3/5] qemu-io: Exit with error when a command failed Max Reitz
2018-05-09 19:43 ` Max Reitz [this message]
2018-05-09 19:43 ` [Qemu-devel] [PATCH v2 5/5] iotests: Let 216 make use of qemu-io's exit code Max Reitz
2018-06-01 11:11 ` [Qemu-devel] [PATCH v2 0/5] qemu-io: Exit with error when a command failed Max Reitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180509194302.21585-5-mreitz@redhat.com \
    --to=mreitz@redhat.com \
    --cc=eblake@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).