diff options
author | Fam Zheng <famz@redhat.com> | 2013-11-20 10:01:56 +0800 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2013-11-29 13:40:37 +0100 |
commit | b59b3d57737a0d40450f8232abd89e8986387402 (patch) | |
tree | 74fb1ebaa4d95c0e5c3cbab2aaad04e8d5f7259b /tests/qemu-iotests/055 | |
parent | 3cf53c771406ad360117f30e61b24635df0e9b50 (diff) |
qemu-iotests: Make test case 030, 040 and 055 deterministic
Pause the drive and start the block job, so we won't miss the block job.
Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'tests/qemu-iotests/055')
-rwxr-xr-x | tests/qemu-iotests/055 | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/tests/qemu-iotests/055 b/tests/qemu-iotests/055 index 44bb025687..451b67ddfb 100755 --- a/tests/qemu-iotests/055 +++ b/tests/qemu-iotests/055 @@ -63,6 +63,7 @@ class TestSingleDrive(iotests.QMPTestCase): def test_pause(self): self.assert_no_active_block_jobs() + self.vm.pause_drive('drive0') result = self.vm.qmp('drive-backup', device='drive0', target=target_img, sync='full') self.assert_qmp(result, 'return', {}) @@ -70,6 +71,7 @@ class TestSingleDrive(iotests.QMPTestCase): result = self.vm.qmp('block-job-pause', device='drive0') self.assert_qmp(result, 'return', {}) + self.vm.resume_drive('drive0') time.sleep(1) result = self.vm.qmp('query-block-jobs') offset = self.dictpath(result, 'return[0]/offset') @@ -113,6 +115,7 @@ class TestSetSpeed(iotests.QMPTestCase): def setUp(self): qemu_img('create', '-f', iotests.imgfmt, test_img, str(TestSetSpeed.image_len)) + qemu_io('-c', 'write -P1 0 512', test_img) self.vm = iotests.VM().add_drive(test_img) self.vm.launch() @@ -124,6 +127,7 @@ class TestSetSpeed(iotests.QMPTestCase): def test_set_speed(self): self.assert_no_active_block_jobs() + self.vm.pause_drive('drive0') result = self.vm.qmp('drive-backup', device='drive0', target=target_img, sync='full') self.assert_qmp(result, 'return', {}) @@ -141,10 +145,11 @@ class TestSetSpeed(iotests.QMPTestCase): self.assert_qmp(result, 'return[0]/device', 'drive0') self.assert_qmp(result, 'return[0]/speed', 8 * 1024 * 1024) - event = self.cancel_and_wait() + event = self.cancel_and_wait(resume=True) self.assert_qmp(event, 'data/type', 'backup') # Check setting speed in drive-backup works + self.vm.pause_drive('drive0') result = self.vm.qmp('drive-backup', device='drive0', target=target_img, sync='full', speed=4*1024*1024) self.assert_qmp(result, 'return', {}) @@ -153,7 +158,7 @@ class TestSetSpeed(iotests.QMPTestCase): self.assert_qmp(result, 'return[0]/device', 'drive0') self.assert_qmp(result, 'return[0]/speed', 4 * 1024 * 1024) - event = self.cancel_and_wait() + event = self.cancel_and_wait(resume=True) self.assert_qmp(event, 'data/type', 'backup') def test_set_speed_invalid(self): @@ -165,6 +170,7 @@ class TestSetSpeed(iotests.QMPTestCase): self.assert_no_active_block_jobs() + self.vm.pause_drive('drive0') result = self.vm.qmp('drive-backup', device='drive0', target=target_img, sync='full') self.assert_qmp(result, 'return', {}) @@ -172,7 +178,7 @@ class TestSetSpeed(iotests.QMPTestCase): result = self.vm.qmp('block-job-set-speed', device='drive0', speed=-1) self.assert_qmp(result, 'error/class', 'GenericError') - event = self.cancel_and_wait() + event = self.cancel_and_wait(resume=True) self.assert_qmp(event, 'data/type', 'backup') class TestSingleTransaction(iotests.QMPTestCase): @@ -214,6 +220,7 @@ class TestSingleTransaction(iotests.QMPTestCase): def test_pause(self): self.assert_no_active_block_jobs() + self.vm.pause_drive('drive0') result = self.vm.qmp('transaction', actions=[{ 'type': 'drive-backup', 'data': { 'device': 'drive0', @@ -226,6 +233,7 @@ class TestSingleTransaction(iotests.QMPTestCase): result = self.vm.qmp('block-job-pause', device='drive0') self.assert_qmp(result, 'return', {}) + self.vm.resume_drive('drive0') time.sleep(1) result = self.vm.qmp('query-block-jobs') offset = self.dictpath(result, 'return[0]/offset') |