aboutsummaryrefslogtreecommitdiff
path: root/tests/qemu-iotests/nbd-fault-injector.py
diff options
context:
space:
mode:
authorMax Reitz <mreitz@redhat.com>2018-10-22 14:52:59 +0100
committerEduardo Habkost <ehabkost@redhat.com>2018-10-30 21:11:52 -0300
commit6d39db96d23ebe0d4361d108fa202091aa9cbfc1 (patch)
tree06c2a080398414009dfc0e137b885a7367e9be9b /tests/qemu-iotests/nbd-fault-injector.py
parentbb2e16e90bec9fbdd7bd86dfa2e6ca1c894bc3d8 (diff)
iotests: Make nbd-fault-injector flush
When closing a connection, make the nbd-fault-injector flush the socket. Without this, the output is a bit unreliable with Python 3. Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Cleber Rosa <crosa@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20181022135307.14398-2-mreitz@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to 'tests/qemu-iotests/nbd-fault-injector.py')
-rwxr-xr-xtests/qemu-iotests/nbd-fault-injector.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/tests/qemu-iotests/nbd-fault-injector.py b/tests/qemu-iotests/nbd-fault-injector.py
index f9193c0fae..439a090eb6 100755
--- a/tests/qemu-iotests/nbd-fault-injector.py
+++ b/tests/qemu-iotests/nbd-fault-injector.py
@@ -112,6 +112,7 @@ class FaultInjectionSocket(object):
if rule.match(event, io):
if rule.when == 0 or bufsize is None:
print('Closing connection on rule match %s' % rule.name)
+ self.sock.flush()
sys.exit(0)
if rule.when != -1:
return rule.when