|
|
26ba25 |
From ff9bd6b6b80a3d97091f95e9df634e583bdada71 Mon Sep 17 00:00:00 2001
|
|
|
26ba25 |
From: Kevin Wolf <kwolf@redhat.com>
|
|
|
26ba25 |
Date: Tue, 26 Jun 2018 09:48:45 +0200
|
|
|
26ba25 |
Subject: [PATCH 137/268] qemu-iotests: iotests.py helper for non-file
|
|
|
26ba25 |
protocols
|
|
|
26ba25 |
|
|
|
26ba25 |
RH-Author: Kevin Wolf <kwolf@redhat.com>
|
|
|
26ba25 |
Message-id: <20180626094856.6924-63-kwolf@redhat.com>
|
|
|
26ba25 |
Patchwork-id: 81081
|
|
|
26ba25 |
O-Subject: [RHV-7.6 qemu-kvm-rhev PATCH v2 62/73] qemu-iotests: iotests.py helper for non-file protocols
|
|
|
26ba25 |
Bugzilla: 1513543
|
|
|
26ba25 |
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
|
|
|
26ba25 |
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
|
|
26ba25 |
RH-Acked-by: Fam Zheng <famz@redhat.com>
|
|
|
26ba25 |
|
|
|
26ba25 |
This adds two helper functions that are useful for test cases that make
|
|
|
26ba25 |
use of a non-file protocol (specifically ssh).
|
|
|
26ba25 |
|
|
|
26ba25 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
26ba25 |
Reviewed-by: Max Reitz <mreitz@redhat.com>
|
|
|
26ba25 |
Reviewed-by: Jeff Cody <jcody@redhat.com>
|
|
|
26ba25 |
(cherry picked from commit 5a259e868b308564de9f2bfaef0606074a4f9028)
|
|
|
26ba25 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
26ba25 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
26ba25 |
---
|
|
|
26ba25 |
tests/qemu-iotests/iotests.py | 17 +++++++++++++++++
|
|
|
26ba25 |
1 file changed, 17 insertions(+)
|
|
|
26ba25 |
|
|
|
26ba25 |
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
|
|
|
26ba25 |
index 2b47062..4461e1d 100644
|
|
|
26ba25 |
--- a/tests/qemu-iotests/iotests.py
|
|
|
26ba25 |
+++ b/tests/qemu-iotests/iotests.py
|
|
|
26ba25 |
@@ -313,6 +313,13 @@ def file_path(*names):
|
|
|
26ba25 |
|
|
|
26ba25 |
return paths[0] if len(paths) == 1 else paths
|
|
|
26ba25 |
|
|
|
26ba25 |
+def remote_filename(path):
|
|
|
26ba25 |
+ if imgproto == 'file':
|
|
|
26ba25 |
+ return path
|
|
|
26ba25 |
+ elif imgproto == 'ssh':
|
|
|
26ba25 |
+ return "ssh://127.0.0.1%s" % (path)
|
|
|
26ba25 |
+ else:
|
|
|
26ba25 |
+ raise Exception("Protocol %s not supported" % (imgproto))
|
|
|
26ba25 |
|
|
|
26ba25 |
class VM(qtest.QEMUQtestMachine):
|
|
|
26ba25 |
'''A QEMU VM'''
|
|
|
26ba25 |
@@ -611,6 +618,16 @@ def verify_image_format(supported_fmts=[], unsupported_fmts=[]):
|
|
|
26ba25 |
if not_sup or (imgfmt in unsupported_fmts):
|
|
|
26ba25 |
notrun('not suitable for this image format: %s' % imgfmt)
|
|
|
26ba25 |
|
|
|
26ba25 |
+def verify_protocol(supported=[], unsupported=[]):
|
|
|
26ba25 |
+ assert not (supported and unsupported)
|
|
|
26ba25 |
+
|
|
|
26ba25 |
+ if 'generic' in supported:
|
|
|
26ba25 |
+ return
|
|
|
26ba25 |
+
|
|
|
26ba25 |
+ not_sup = supported and (imgproto not in supported)
|
|
|
26ba25 |
+ if not_sup or (imgproto in unsupported):
|
|
|
26ba25 |
+ notrun('not suitable for this protocol: %s' % imgproto)
|
|
|
26ba25 |
+
|
|
|
26ba25 |
def verify_platform(supported_oses=['linux']):
|
|
|
26ba25 |
if True not in [sys.platform.startswith(x) for x in supported_oses]:
|
|
|
26ba25 |
notrun('not suitable for this OS: %s' % sys.platform)
|
|
|
26ba25 |
--
|
|
|
26ba25 |
1.8.3.1
|
|
|
26ba25 |
|