From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38700) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VGVTu-00013X-CT for qemu-devel@nongnu.org; Mon, 02 Sep 2013 10:52:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VGVTl-0005g9-Ml for qemu-devel@nongnu.org; Mon, 02 Sep 2013 10:51:54 -0400 Received: from mail-ee0-x230.google.com ([2a00:1450:4013:c00::230]:61074) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VGVTl-0005fu-9g for qemu-devel@nongnu.org; Mon, 02 Sep 2013 10:51:45 -0400 Received: by mail-ee0-f48.google.com with SMTP id l10so2396970eei.21 for ; Mon, 02 Sep 2013 07:51:44 -0700 (PDT) Date: Mon, 2 Sep 2013 16:51:41 +0200 From: Stefan Hajnoczi Message-ID: <20130902145141.GC31868@stefanha-thinkpad.redhat.com> References: <1378113493-18915-1-git-send-email-xiawenc@linux.vnet.ibm.com> <1378113493-18915-4-git-send-email-xiawenc@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1378113493-18915-4-git-send-email-xiawenc@linux.vnet.ibm.com> Subject: Re: [Qemu-devel] [PATCH V3 3/3] qemu-iotests: add tests for runtime fd passing via SCM rights List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Wenchao Xia Cc: kwolf@redhat.com, lcapitulino@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com, armbru@redhat.com On Mon, Sep 02, 2013 at 05:18:13PM +0800, Wenchao Xia wrote: > @@ -125,5 +125,39 @@ class TestFdSets(iotests.QMPTestCase): > 'No file descriptor supplied via SCM_RIGHTS') > self.vm.shutdown() > > +#Add fd at runtime, there are two ways: monitor related or fdset related > +class TestSCMFd(iotests.QMPTestCase): > + def setUp(self): > + self.vm = iotests.VM() > + qemu_img('create', '-f', iotests.imgfmt, image0, '128K') > + #Add a unused monitor, to verify it works fine when two minitor present > + self.vm.add_monitor_telnet("0",4445) Sorry to be picky: please use the same whitespace style as the existing code in these patches. # Comments have a space after the hash function(args, have, space) > + self.vm.launch() > + > + def tearDown(self): > + self.vm.shutdown() > + os.remove(image0) > + > + def _send_fd_by_SCM(self): > + ret = self.vm.send_fd_scm(image0) > + self.assertEqual(ret, 0, 'Failed to send fd with UNIX SCM') > + > + def test_add_fd(self): > + self._send_fd_by_SCM() > + result = self.vm.qmp('add-fd', fdset_id=2, opaque='image0:r') > + self.assert_qmp(result, 'return/fdset-id', 2) > + > + def test_getfd(self): > + self._send_fd_by_SCM() > + result = self.vm.qmp('getfd', fdname='image0:r') > + self.assert_qmp(result, 'return', {}) > + > + def test_closefd(self): > + self._send_fd_by_SCM() > + result = self.vm.qmp('getfd', fdname='image0:r') > + self.assert_qmp(result, 'return', {}) > + result = self.vm.qmp('closefd', fdname='image0:r') > + self.assert_qmp(result, 'return', {}) It would be good to also check the error cases like the existing tests do (e.g. getfd fdname=asdf -> error).