From: Stefan Hajnoczi <stefanha@gmail.com>
To: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Cc: kwolf@redhat.com, lcapitulino@redhat.com, qemu-devel@nongnu.org,
stefanha@redhat.com, armbru@redhat.com
Subject: Re: [Qemu-devel] [PATCH V3 3/3] qemu-iotests: add tests for runtime fd passing via SCM rights
Date: Mon, 2 Sep 2013 16:51:41 +0200 [thread overview]
Message-ID: <20130902145141.GC31868@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <1378113493-18915-4-git-send-email-xiawenc@linux.vnet.ibm.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).
next prev parent reply other threads:[~2013-09-02 14:52 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-02 9:18 [Qemu-devel] [PATCH V3 0/3] qemu-iotests: add test for fd passing via SCM rights Wenchao Xia
2013-09-02 9:18 ` [Qemu-devel] [PATCH V3 1/3] qemu-iotests: add unix socket help program Wenchao Xia
2013-09-02 9:18 ` [Qemu-devel] [PATCH V3 2/3] qemu-iotests: add infrastructure of fd passing via SCM Wenchao Xia
2013-09-02 9:18 ` [Qemu-devel] [PATCH V3 3/3] qemu-iotests: add tests for runtime fd passing via SCM rights Wenchao Xia
2013-09-02 14:51 ` Stefan Hajnoczi [this message]
2013-09-03 2:09 ` Wenchao Xia
2013-09-02 14:56 ` [Qemu-devel] [PATCH V3 0/3] qemu-iotests: add test for " Stefan Hajnoczi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130902145141.GC31868@stefanha-thinkpad.redhat.com \
--to=stefanha@gmail.com \
--cc=armbru@redhat.com \
--cc=kwolf@redhat.com \
--cc=lcapitulino@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=xiawenc@linux.vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).