aboutsummaryrefslogtreecommitdiff
path: root/tests/qemu-iotests/iotests.py
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2016-04-12 18:09:16 +0200
committerKevin Wolf <kwolf@redhat.com>2016-04-12 18:09:16 +0200
commit5158ac58306b3e8644fc020730f651fe74aa6674 (patch)
treee65d377bcc840ab4d3ce660b5b659f06822e1125 /tests/qemu-iotests/iotests.py
parentc4189d85bcdaa27a9ec892146a652092fec704d0 (diff)
parent3ef3dcef563e231a13543264975b9ef75080f9b3 (diff)
Merge remote-tracking branch 'mreitz/tags/pull-block-for-kevin-2016-04-12' into queue-block
Block patches for 2.6-rc2. # gpg: Signature made Tue Apr 12 18:08:20 2016 CEST using RSA key ID E838ACAD # gpg: Good signature from "Max Reitz <mreitz@redhat.com>" * mreitz/tags/pull-block-for-kevin-2016-04-12: qemu-iotests: iotests.py: get rid of __all__ qemu-iotests: 068: don't require KVM qemu-iotests: 148: properly skip test if quorum support is missing qemu-iotests: iotests.VM: remove qtest socket on error qemu-iotests: fix 051 on non-PC architectures qemu-iotests: check: don't place files with predictable names in /tmp Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'tests/qemu-iotests/iotests.py')
-rw-r--r--tests/qemu-iotests/iotests.py22
1 files changed, 17 insertions, 5 deletions
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
index 8499e1b611..0c0b5334b3 100644
--- a/tests/qemu-iotests/iotests.py
+++ b/tests/qemu-iotests/iotests.py
@@ -16,6 +16,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
+import errno
import os
import re
import subprocess
@@ -28,10 +29,6 @@ import qmp
import qtest
import struct
-__all__ = ['imgfmt', 'imgproto', 'test_dir' 'qemu_img', 'qemu_io',
- 'VM', 'QMPTestCase', 'notrun', 'main', 'verify_image_format',
- 'verify_platform', 'filter_test_dir', 'filter_win32',
- 'filter_qemu_io', 'filter_chown', 'log']
# This will not work if arguments contain spaces but is necessary if we
# want to support the override options that ./check supports.
@@ -247,7 +244,8 @@ class VM(object):
self._qmp.accept()
self._qtest.accept()
except:
- os.remove(self._monitor_path)
+ _remove_if_exists(self._monitor_path)
+ _remove_if_exists(self._qtest_path)
raise
def shutdown(self):
@@ -409,6 +407,15 @@ class QMPTestCase(unittest.TestCase):
event = self.wait_until_completed(drive=drive)
self.assert_qmp(event, 'data/type', 'mirror')
+def _remove_if_exists(path):
+ '''Remove file object at path if it exists'''
+ try:
+ os.remove(path)
+ except OSError as exception:
+ if exception.errno == errno.ENOENT:
+ return
+ raise
+
def notrun(reason):
'''Skip this test suite'''
# Each test in qemu-iotests has a number ("seq")
@@ -426,6 +433,11 @@ def verify_platform(supported_oses=['linux']):
if True not in [sys.platform.startswith(x) for x in supported_oses]:
notrun('not suitable for this OS: %s' % sys.platform)
+def verify_quorum():
+ '''Skip test suite if quorum support is not available'''
+ if 'quorum' not in qemu_img_pipe('--help'):
+ notrun('quorum support missing')
+
def main(supported_fmts=[], supported_oses=['linux']):
'''Run tests'''