From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52527) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VGg59-0003sR-Ij for qemu-devel@nongnu.org; Mon, 02 Sep 2013 22:11:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VGg4x-0007uM-Ga for qemu-devel@nongnu.org; Mon, 02 Sep 2013 22:11:03 -0400 Received: from e28smtp05.in.ibm.com ([122.248.162.5]:38713) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VGg4w-0007tW-Sf for qemu-devel@nongnu.org; Mon, 02 Sep 2013 22:10:51 -0400 Received: from /spool/local by e28smtp05.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 3 Sep 2013 07:33:56 +0530 Received: from d28relay01.in.ibm.com (d28relay01.in.ibm.com [9.184.220.58]) by d28dlp01.in.ibm.com (Postfix) with ESMTP id 31E2EE004F for ; Tue, 3 Sep 2013 07:41:23 +0530 (IST) Received: from d28av04.in.ibm.com (d28av04.in.ibm.com [9.184.220.66]) by d28relay01.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r832CRUa33947718 for ; Tue, 3 Sep 2013 07:42:27 +0530 Received: from d28av04.in.ibm.com (localhost [127.0.0.1]) by d28av04.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id r832AdRb021809 for ; Tue, 3 Sep 2013 07:40:39 +0530 Message-ID: <522544F1.2000209@linux.vnet.ibm.com> Date: Tue, 03 Sep 2013 10:09:53 +0800 From: Wenchao Xia MIME-Version: 1.0 References: <1378113493-18915-1-git-send-email-xiawenc@linux.vnet.ibm.com> <1378113493-18915-4-git-send-email-xiawenc@linux.vnet.ibm.com> <20130902145141.GC31868@stefanha-thinkpad.redhat.com> In-Reply-To: <20130902145141.GC31868@stefanha-thinkpad.redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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: Stefan Hajnoczi Cc: kwolf@redhat.com, lcapitulino@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com, armbru@redhat.com 于 2013-9-2 22:51, Stefan Hajnoczi 写道: > 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) > OK, will check all the comments and fix. >> + 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). > OK. I'll wait a few days and respin with fix. -- Best Regards Wenchao Xia