aboutsummaryrefslogtreecommitdiff
path: root/tests/qemu-iotests/118
diff options
context:
space:
mode:
authorMax Reitz <mreitz@redhat.com>2016-01-29 20:49:12 +0100
committerMax Reitz <mreitz@redhat.com>2016-02-02 17:47:04 +0100
commitabb3e55b5b718d6392441f56ba0729a62105ac56 (patch)
tree0ad6175829f45cb7a7095ef5fcc373a5a8b52f73 /tests/qemu-iotests/118
parent12c7ec87a7d88919b23736176eba3118d1521372 (diff)
Revert "hw/block/fdc: Implement tray status"
This reverts the changes that commit 2e1280e8ff95b3145bc6262accc9d447718e5318 applied to hw/block/fdc.c; also, an additional case of drv->media_inserted use has crept in since, which is replaced by a call to blk_is_inserted(). That commit changed tests/fdc-test.c, too, because after it, one less TRAY_MOVED event would be emitted when executing 'change' on an empty drive. However, now, no TRAY_MOVED events will be emitted at all, and the tray_open status returned by query-block will always be false, necessitating (different) changes to tests/fdc-test.c and iotest 118, which is why this patch is not a pure revert of said commit. Signed-off-by: Max Reitz <mreitz@redhat.com> Message-id: 1454096953-31773-4-git-send-email-mreitz@redhat.com Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'tests/qemu-iotests/118')
-rwxr-xr-xtests/qemu-iotests/118117
1 files changed, 36 insertions, 81 deletions
diff --git a/tests/qemu-iotests/118 b/tests/qemu-iotests/118
index 114d0e2dea..7caa38cbe9 100755
--- a/tests/qemu-iotests/118
+++ b/tests/qemu-iotests/118
@@ -42,6 +42,9 @@ class ChangeBaseClass(iotests.QMPTestCase):
self.has_opened = True
def wait_for_open(self):
+ if not self.has_real_tray:
+ return
+
timeout = time.clock() + 3
while not self.has_opened and time.clock() < timeout:
self.process_events()
@@ -49,6 +52,9 @@ class ChangeBaseClass(iotests.QMPTestCase):
self.fail('Timeout while waiting for the tray to open')
def wait_for_close(self):
+ if not self.has_real_tray:
+ return
+
timeout = time.clock() + 3
while not self.has_closed and time.clock() < timeout:
self.process_events()
@@ -65,7 +71,8 @@ class GeneralChangeTestsBaseClass(ChangeBaseClass):
self.wait_for_close()
result = self.vm.qmp('query-block')
- self.assert_qmp(result, 'return[0]/tray_open', False)
+ if self.has_real_tray:
+ self.assert_qmp(result, 'return[0]/tray_open', False)
self.assert_qmp(result, 'return[0]/inserted/image/filename', new_img)
def test_blockdev_change_medium(self):
@@ -78,7 +85,8 @@ class GeneralChangeTestsBaseClass(ChangeBaseClass):
self.wait_for_close()
result = self.vm.qmp('query-block')
- self.assert_qmp(result, 'return[0]/tray_open', False)
+ if self.has_real_tray:
+ self.assert_qmp(result, 'return[0]/tray_open', False)
self.assert_qmp(result, 'return[0]/inserted/image/filename', new_img)
def test_eject(self):
@@ -88,7 +96,8 @@ class GeneralChangeTestsBaseClass(ChangeBaseClass):
self.wait_for_open()
result = self.vm.qmp('query-block')
- self.assert_qmp(result, 'return[0]/tray_open', True)
+ if self.has_real_tray:
+ self.assert_qmp(result, 'return[0]/tray_open', True)
self.assert_qmp_absent(result, 'return[0]/inserted')
def test_tray_eject_change(self):
@@ -98,7 +107,8 @@ class GeneralChangeTestsBaseClass(ChangeBaseClass):
self.wait_for_open()
result = self.vm.qmp('query-block')
- self.assert_qmp(result, 'return[0]/tray_open', True)
+ if self.has_real_tray:
+ self.assert_qmp(result, 'return[0]/tray_open', True)
self.assert_qmp_absent(result, 'return[0]/inserted')
result = self.vm.qmp('blockdev-change-medium', device='drive0',
@@ -109,7 +119,8 @@ class GeneralChangeTestsBaseClass(ChangeBaseClass):
self.wait_for_close()
result = self.vm.qmp('query-block')
- self.assert_qmp(result, 'return[0]/tray_open', False)
+ if self.has_real_tray:
+ self.assert_qmp(result, 'return[0]/tray_open', False)
self.assert_qmp(result, 'return[0]/inserted/image/filename', new_img)
def test_tray_open_close(self):
@@ -119,7 +130,8 @@ class GeneralChangeTestsBaseClass(ChangeBaseClass):
self.wait_for_open()
result = self.vm.qmp('query-block')
- self.assert_qmp(result, 'return[0]/tray_open', True)
+ if self.has_real_tray:
+ self.assert_qmp(result, 'return[0]/tray_open', True)
if self.was_empty == True:
self.assert_qmp_absent(result, 'return[0]/inserted')
else:
@@ -132,10 +144,8 @@ class GeneralChangeTestsBaseClass(ChangeBaseClass):
self.wait_for_close()
result = self.vm.qmp('query-block')
- if self.has_real_tray or not self.was_empty:
+ if self.has_real_tray:
self.assert_qmp(result, 'return[0]/tray_open', False)
- else:
- self.assert_qmp(result, 'return[0]/tray_open', True)
if self.was_empty == True:
self.assert_qmp_absent(result, 'return[0]/inserted')
else:
@@ -148,20 +158,18 @@ class GeneralChangeTestsBaseClass(ChangeBaseClass):
self.wait_for_open()
result = self.vm.qmp('query-block')
- self.assert_qmp(result, 'return[0]/tray_open', True)
+ if self.has_real_tray:
+ self.assert_qmp(result, 'return[0]/tray_open', True)
self.assert_qmp_absent(result, 'return[0]/inserted')
result = self.vm.qmp('blockdev-close-tray', device='drive0')
self.assert_qmp(result, 'return', {})
- if self.has_real_tray:
- self.wait_for_close()
+ self.wait_for_close()
result = self.vm.qmp('query-block')
if self.has_real_tray:
self.assert_qmp(result, 'return[0]/tray_open', False)
- else:
- self.assert_qmp(result, 'return[0]/tray_open', True)
self.assert_qmp_absent(result, 'return[0]/inserted')
def test_tray_open_change(self):
@@ -171,7 +179,8 @@ class GeneralChangeTestsBaseClass(ChangeBaseClass):
self.wait_for_open()
result = self.vm.qmp('query-block')
- self.assert_qmp(result, 'return[0]/tray_open', True)
+ if self.has_real_tray:
+ self.assert_qmp(result, 'return[0]/tray_open', True)
if self.was_empty == True:
self.assert_qmp_absent(result, 'return[0]/inserted')
else:
@@ -185,7 +194,8 @@ class GeneralChangeTestsBaseClass(ChangeBaseClass):
self.wait_for_close()
result = self.vm.qmp('query-block')
- self.assert_qmp(result, 'return[0]/tray_open', False)
+ if self.has_real_tray:
+ self.assert_qmp(result, 'return[0]/tray_open', False)
self.assert_qmp(result, 'return[0]/inserted/image/filename', new_img)
def test_cycle(self):
@@ -202,7 +212,8 @@ class GeneralChangeTestsBaseClass(ChangeBaseClass):
self.wait_for_open()
result = self.vm.qmp('query-block')
- self.assert_qmp(result, 'return[0]/tray_open', True)
+ if self.has_real_tray:
+ self.assert_qmp(result, 'return[0]/tray_open', True)
if self.was_empty == True:
self.assert_qmp_absent(result, 'return[0]/inserted')
else:
@@ -212,7 +223,8 @@ class GeneralChangeTestsBaseClass(ChangeBaseClass):
self.assert_qmp(result, 'return', {})
result = self.vm.qmp('query-block')
- self.assert_qmp(result, 'return[0]/tray_open', True)
+ if self.has_real_tray:
+ self.assert_qmp(result, 'return[0]/tray_open', True)
self.assert_qmp_absent(result, 'return[0]/inserted')
result = self.vm.qmp('x-blockdev-insert-medium', device='drive0',
@@ -220,7 +232,8 @@ class GeneralChangeTestsBaseClass(ChangeBaseClass):
self.assert_qmp(result, 'return', {})
result = self.vm.qmp('query-block')
- self.assert_qmp(result, 'return[0]/tray_open', True)
+ if self.has_real_tray:
+ self.assert_qmp(result, 'return[0]/tray_open', True)
self.assert_qmp(result, 'return[0]/inserted/image/filename', new_img)
result = self.vm.qmp('blockdev-close-tray', device='drive0')
@@ -229,7 +242,8 @@ class GeneralChangeTestsBaseClass(ChangeBaseClass):
self.wait_for_close()
result = self.vm.qmp('query-block')
- self.assert_qmp(result, 'return[0]/tray_open', False)
+ if self.has_real_tray:
+ self.assert_qmp(result, 'return[0]/tray_open', False)
self.assert_qmp(result, 'return[0]/inserted/image/filename', new_img)
def test_close_on_closed(self):
@@ -239,16 +253,14 @@ class GeneralChangeTestsBaseClass(ChangeBaseClass):
self.assertEquals(self.vm.get_qmp_events(wait=False), [])
def test_remove_on_closed(self):
- if self.has_opened:
- # Empty floppy drive
+ if not self.has_real_tray:
return
result = self.vm.qmp('x-blockdev-remove-medium', device='drive0')
self.assert_qmp(result, 'error/class', 'GenericError')
def test_insert_on_closed(self):
- if self.has_opened:
- # Empty floppy drive
+ if not self.has_real_tray:
return
result = self.vm.qmp('blockdev-add',
@@ -366,7 +378,6 @@ class TestChangeReadOnly(ChangeBaseClass):
self.vm.launch()
result = self.vm.qmp('query-block')
- self.assert_qmp(result, 'return[0]/tray_open', False)
self.assert_qmp(result, 'return[0]/inserted/ro', True)
self.assert_qmp(result, 'return[0]/inserted/image/filename', old_img)
@@ -376,11 +387,7 @@ class TestChangeReadOnly(ChangeBaseClass):
read_only_mode='retain')
self.assert_qmp(result, 'return', {})
- self.wait_for_open()
- self.wait_for_close()
-
result = self.vm.qmp('query-block')
- self.assert_qmp(result, 'return[0]/tray_open', False)
self.assert_qmp(result, 'return[0]/inserted/ro', True)
self.assert_qmp(result, 'return[0]/inserted/image/filename', new_img)
@@ -390,7 +397,6 @@ class TestChangeReadOnly(ChangeBaseClass):
self.vm.launch()
result = self.vm.qmp('query-block')
- self.assert_qmp(result, 'return[0]/tray_open', False)
self.assert_qmp(result, 'return[0]/inserted/ro', True)
self.assert_qmp(result, 'return[0]/inserted/image/filename', old_img)
@@ -400,11 +406,7 @@ class TestChangeReadOnly(ChangeBaseClass):
read_only_mode='retain')
self.assert_qmp(result, 'return', {})
- self.wait_for_open()
- self.wait_for_close()
-
result = self.vm.qmp('query-block')
- self.assert_qmp(result, 'return[0]/tray_open', False)
self.assert_qmp(result, 'return[0]/inserted/ro', True)
self.assert_qmp(result, 'return[0]/inserted/image/filename', new_img)
@@ -414,7 +416,6 @@ class TestChangeReadOnly(ChangeBaseClass):
self.vm.launch()
result = self.vm.qmp('query-block')
- self.assert_qmp(result, 'return[0]/tray_open', False)
self.assert_qmp(result, 'return[0]/inserted/ro', False)
self.assert_qmp(result, 'return[0]/inserted/image/filename', old_img)
@@ -427,7 +428,6 @@ class TestChangeReadOnly(ChangeBaseClass):
self.assertEquals(self.vm.get_qmp_events(wait=False), [])
result = self.vm.qmp('query-block')
- self.assert_qmp(result, 'return[0]/tray_open', False)
self.assert_qmp(result, 'return[0]/inserted/ro', False)
self.assert_qmp(result, 'return[0]/inserted/image/filename', old_img)
@@ -437,7 +437,6 @@ class TestChangeReadOnly(ChangeBaseClass):
self.vm.launch()
result = self.vm.qmp('query-block')
- self.assert_qmp(result, 'return[0]/tray_open', False)
self.assert_qmp(result, 'return[0]/inserted/ro', True)
self.assert_qmp(result, 'return[0]/inserted/image/filename', old_img)
@@ -448,11 +447,7 @@ class TestChangeReadOnly(ChangeBaseClass):
read_only_mode='read-write')
self.assert_qmp(result, 'return', {})
- self.wait_for_open()
- self.wait_for_close()
-
result = self.vm.qmp('query-block')
- self.assert_qmp(result, 'return[0]/tray_open', False)
self.assert_qmp(result, 'return[0]/inserted/ro', False)
self.assert_qmp(result, 'return[0]/inserted/image/filename', new_img)
@@ -462,7 +457,6 @@ class TestChangeReadOnly(ChangeBaseClass):
self.vm.launch()
result = self.vm.qmp('query-block')
- self.assert_qmp(result, 'return[0]/tray_open', False)
self.assert_qmp(result, 'return[0]/inserted/ro', False)
self.assert_qmp(result, 'return[0]/inserted/image/filename', old_img)
@@ -473,11 +467,7 @@ class TestChangeReadOnly(ChangeBaseClass):
read_only_mode='read-only')
self.assert_qmp(result, 'return', {})
- self.wait_for_open()
- self.wait_for_close()
-
result = self.vm.qmp('query-block')
- self.assert_qmp(result, 'return[0]/tray_open', False)
self.assert_qmp(result, 'return[0]/inserted/ro', True)
self.assert_qmp(result, 'return[0]/inserted/image/filename', new_img)
@@ -486,7 +476,6 @@ class TestChangeReadOnly(ChangeBaseClass):
self.vm.launch()
result = self.vm.qmp('query-block')
- self.assert_qmp(result, 'return[0]/tray_open', False)
self.assert_qmp(result, 'return[0]/inserted/ro', False)
self.assert_qmp(result, 'return[0]/inserted/image/filename', old_img)
@@ -497,11 +486,7 @@ class TestChangeReadOnly(ChangeBaseClass):
read_only_mode='read-only')
self.assert_qmp(result, 'return', {})
- self.wait_for_open()
- self.wait_for_close()
-
result = self.vm.qmp('query-block')
- self.assert_qmp(result, 'return[0]/tray_open', False)
self.assert_qmp(result, 'return[0]/inserted/ro', True)
self.assert_qmp(result, 'return[0]/inserted/image/filename', new_img)
@@ -511,7 +496,6 @@ class TestChangeReadOnly(ChangeBaseClass):
self.vm.launch()
result = self.vm.qmp('query-block')
- self.assert_qmp(result, 'return[0]/tray_open', False)
self.assert_qmp(result, 'return[0]/inserted/ro', False)
self.assert_qmp(result, 'return[0]/inserted/image/filename', old_img)
@@ -522,10 +506,7 @@ class TestChangeReadOnly(ChangeBaseClass):
read_only_mode='read-write')
self.assert_qmp(result, 'error/class', 'GenericError')
- self.assertEquals(self.vm.get_qmp_events(wait=False), [])
-
result = self.vm.qmp('query-block')
- self.assert_qmp(result, 'return[0]/tray_open', False)
self.assert_qmp(result, 'return[0]/inserted/ro', False)
self.assert_qmp(result, 'return[0]/inserted/image/filename', old_img)
@@ -535,7 +516,6 @@ class TestChangeReadOnly(ChangeBaseClass):
self.vm.launch()
result = self.vm.qmp('query-block')
- self.assert_qmp(result, 'return[0]/tray_open', False)
self.assert_qmp(result, 'return[0]/inserted/ro', True)
self.assert_qmp(result, 'return[0]/inserted/image/filename', old_img)
@@ -545,11 +525,7 @@ class TestChangeReadOnly(ChangeBaseClass):
read_only_mode='retain')
self.assert_qmp(result, 'return', {})
- self.wait_for_open()
- self.wait_for_close()
-
result = self.vm.qmp('query-block')
- self.assert_qmp(result, 'return[0]/tray_open', False)
self.assert_qmp(result, 'return[0]/inserted/ro', True)
self.assert_qmp(result, 'return[0]/inserted/image/filename', new_img)
@@ -559,7 +535,6 @@ class TestChangeReadOnly(ChangeBaseClass):
self.vm.launch()
result = self.vm.qmp('query-block')
- self.assert_qmp(result, 'return[0]/tray_open', False)
self.assert_qmp(result, 'return[0]/inserted/ro', False)
self.assert_qmp(result, 'return[0]/inserted/image/filename', old_img)
@@ -569,10 +544,7 @@ class TestChangeReadOnly(ChangeBaseClass):
read_only_mode='retain')
self.assert_qmp(result, 'error/class', 'GenericError')
- self.assertEquals(self.vm.get_qmp_events(wait=False), [])
-
result = self.vm.qmp('query-block')
- self.assert_qmp(result, 'return[0]/tray_open', False)
self.assert_qmp(result, 'return[0]/inserted/ro', False)
self.assert_qmp(result, 'return[0]/inserted/image/filename', old_img)
@@ -582,7 +554,6 @@ class TestChangeReadOnly(ChangeBaseClass):
self.vm.launch()
result = self.vm.qmp('query-block')
- self.assert_qmp(result, 'return[0]/tray_open', False)
self.assert_qmp(result, 'return[0]/inserted/ro', False)
self.assert_qmp(result, 'return[0]/inserted/image/filename', old_img)
@@ -594,13 +565,7 @@ class TestChangeReadOnly(ChangeBaseClass):
'driver': 'file'}})
self.assert_qmp(result, 'return', {})
- result = self.vm.qmp('blockdev-open-tray', device='drive0', force=True)
- self.assert_qmp(result, 'return', {})
-
- self.wait_for_open()
-
result = self.vm.qmp('query-block')
- self.assert_qmp(result, 'return[0]/tray_open', True)
self.assert_qmp(result, 'return[0]/inserted/ro', False)
self.assert_qmp(result, 'return[0]/inserted/image/filename', old_img)
@@ -608,7 +573,6 @@ class TestChangeReadOnly(ChangeBaseClass):
self.assert_qmp(result, 'return', {})
result = self.vm.qmp('query-block')
- self.assert_qmp(result, 'return[0]/tray_open', True)
self.assert_qmp_absent(result, 'return[0]/inserted')
result = self.vm.qmp('x-blockdev-insert-medium', device='drive0',
@@ -616,17 +580,10 @@ class TestChangeReadOnly(ChangeBaseClass):
self.assert_qmp(result, 'return', {})
result = self.vm.qmp('query-block')
- self.assert_qmp(result, 'return[0]/tray_open', True)
self.assert_qmp(result, 'return[0]/inserted/ro', True)
self.assert_qmp(result, 'return[0]/inserted/image/filename', new_img)
- result = self.vm.qmp('blockdev-close-tray', device='drive0')
- self.assert_qmp(result, 'return', {})
-
- self.wait_for_close()
-
result = self.vm.qmp('query-block')
- self.assert_qmp(result, 'return[0]/tray_open', False)
self.assert_qmp(result, 'return[0]/inserted/ro', True)
self.assert_qmp(result, 'return[0]/inserted/image/filename', new_img)
@@ -648,7 +605,6 @@ class TestBlockJobsAfterCycle(ChangeBaseClass):
self.assert_qmp(result, 'return', {})
result = self.vm.qmp('query-block')
- self.assert_qmp(result, 'return[0]/tray_open', False)
self.assert_qmp(result, 'return[0]/inserted/image/format', 'null-co')
# For device-less BBs, calling blockdev-open-tray or blockdev-close-tray
@@ -671,7 +627,6 @@ class TestBlockJobsAfterCycle(ChangeBaseClass):
self.assert_qmp(result, 'return', {})
result = self.vm.qmp('query-block')
- self.assert_qmp(result, 'return[0]/tray_open', False)
self.assert_qmp(result, 'return[0]/inserted/image/filename', old_img)
def tearDown(self):