From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:58390) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SwWOr-0006s9-0x for qemu-devel@nongnu.org; Wed, 01 Aug 2012 06:43:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SwWOm-0000pu-AT for qemu-devel@nongnu.org; Wed, 01 Aug 2012 06:43:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37723) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SwWOm-0000pj-2Q for qemu-devel@nongnu.org; Wed, 01 Aug 2012 06:43:28 -0400 Message-ID: <5019084A.3000902@redhat.com> Date: Wed, 01 Aug 2012 12:43:22 +0200 From: Kevin Wolf MIME-Version: 1.0 References: <1343127865-16608-1-git-send-email-pbonzini@redhat.com> <1343127865-16608-18-git-send-email-pbonzini@redhat.com> In-Reply-To: <1343127865-16608-18-git-send-email-pbonzini@redhat.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 17/47] qemu-iotests: add tests for streaming error handling List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: jcody@redhat.com, eblake@redhat.com, qemu-devel@nongnu.org, stefanha@linux.vnet.ibm.com Am 24.07.2012 13:03, schrieb Paolo Bonzini: > Add a test for each of report/ignore/stop. The tests use blkdebug > to generate an error in the middle of a script. The error is > recoverable (once = "on") so that we can test resuming a job after > stopping for an error. > > Signed-off-by: Paolo Bonzini > --- > tests/qemu-iotests/030 | 138 +++++++++++++++++++++++++++++++++++++++++ > tests/qemu-iotests/group | 2 +- > tests/qemu-iotests/iotests.py | 7 +++ > 3 files changed, 146 insertions(+), 1 deletion(-) > > diff --git a/tests/qemu-iotests/030 b/tests/qemu-iotests/030 > index 0163945..c65bf5e 100755 > --- a/tests/qemu-iotests/030 > +++ b/tests/qemu-iotests/030 > @@ -163,6 +163,144 @@ class TestSingleDrive(ImageStreamingTestCase): > result = self.vm.qmp('block-stream', device='nonexistent') > self.assert_qmp(result, 'error/class', 'DeviceNotFound') > > +class TestErrors(ImageStreamingTestCase): > + image_len = 2 * 1024 * 1024 # MB > + > + # this should match STREAM_BUFFER_SIZE/512 in block/stream.c > + STREAM_BUFFER_SIZE = 512 * 1024 > + > + def create_blkdebug_file(self, name, event, errno): > + file = open(name, 'w') > + file.write(''' > +[inject-error] > +state = "1" > +event = "%s" > +errno = "%d" > +immediately = "off" > +once = "on" > +sector = "%d" > + > +[set-state] > +state = "1" > +event = "%s" > +new_state = "2" > + > +[set-state] > +state = "2" > +event = "%s" > +new_state = "1" > +''' % (event, errno, self.STREAM_BUFFER_SIZE / 512, event, event)) > + file.close() > + > + def setUp(self): > + self.blkdebug_file = backing_img + ".blkdebug" > + self.create_image(backing_img, TestErrors.image_len) > + self.create_blkdebug_file(self.blkdebug_file, "read_aio", 5) > + qemu_img('create', '-f', iotests.imgfmt, > + '-o', 'backing_file=blkdebug:%s:%s,backing_fmt=raw' > + % (self.blkdebug_file, backing_img), > + test_img) > + self.vm = iotests.VM().add_drive(test_img) > + self.vm.launch() > + > + def tearDown(self): > + self.vm.shutdown() > + os.remove(test_img) > + os.remove(backing_img) > + os.remove(self.blkdebug_file) > + > + def test_report(self): > + self.assert_no_active_streams() > + > + result = self.vm.qmp('block-stream', device='drive0') > + self.assert_qmp(result, 'return', {}) > + > + completed = False > + error = False > + while not completed: > + for event in self.vm.get_qmp_events(wait=True): > + if event['event'] == 'BLOCK_JOB_ERROR': > + self.assert_qmp(event, 'data/device', 'drive0') > + self.assert_qmp(event, 'data/operation', 'read') data/action should be asserted as well (same in the other tests). What about adding an enospc test as well, once with EIO and once with ENOSPC? Kevin