[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 7/8] VNC Acceptance test: check protocol version
From: |
Daniel P . Berrangé |
Subject: |
Re: [Qemu-devel] [PATCH 7/8] VNC Acceptance test: check protocol version |
Date: |
Fri, 7 Jun 2019 18:29:15 +0100 |
User-agent: |
Mutt/1.11.4 (2019-03-13) |
On Fri, Jun 07, 2019 at 11:22:22AM -0400, Cleber Rosa wrote:
> This goes a bit further than the other tests, and does a basic (read
> only) interaction with the VNC protocol.
>
> This is not a enough to perform a handshake, but enough to make sure
> that the socket is somewhat operational and that the expected initial
> step of the handshake is performed by the server and that the version
> matches.
The GTK-VNC project provides a low level library libgvnc that can
be used to talk the RFB protocol in a fairly fine grained manner.
This is built using GObject, so is accessible from Python thanks
to GObject Introspection.
We could use libgvnc for exercising the VNC server instead of writing
custom RFB code. For your simple test just sending/receiving the
version it won't save much, but if we ever want to test TLS or
SASL integration, it would save alot of work dealing wth the auth
handshake and subsequent encryption needs.
The main limitation it would have is that it would only work well
for sending "well formed" RFB protocol messages. If we ever want to
send intentionally evil/bad RFB data to check QEMU's VNC server
security hardening it would be harder.
As the maintainer of GTK-VNC though, I would be open to adding more
APIs to the low level gvnc library to facilitate QEMU's testing
needs if we want.
>
> Signed-off-by: Cleber Rosa <address@hidden>
> ---
> tests/acceptance/vnc.py | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/tests/acceptance/vnc.py b/tests/acceptance/vnc.py
> index d32ae46685..b000446d7c 100644
> --- a/tests/acceptance/vnc.py
> +++ b/tests/acceptance/vnc.py
> @@ -11,6 +11,7 @@
> import os
> import tempfile
> import shutil
> +import socket
>
> from avocado_qemu import Test
>
> @@ -71,5 +72,16 @@ class VncUnixSocket(Test):
> arg='new_password')
> self.assertEqual(set_password_response['return'], {})
>
> + def test_protocol_version(self):
> + self.vm.add_args('-nodefaults', '-S',
> + '-vnc', 'unix:%s' % self.socket_path)
> + self.vm.launch()
> + self.assertTrue(self.vm.qmp('query-vnc')['return']['enabled'])
> + client = socket.socket(socket.AF_UNIX)
> + client.connect(self.socket_path)
> + expected = b'RFB 003.008'
> + actual = client.recv(len(expected))
> + self.assertEqual(expected, actual, "Wrong protocol version")
> +
> def tearDown(self):
> shutil.rmtree(self.socket_dir)
> --
> 2.21.0
>
>
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
- Re: [Qemu-devel] [PATCH 1/8] Travis: print acceptance tests logs in case of job failure, (continued)
- [Qemu-devel] [PATCH 3/8] Acceptance tests: drop left over usage of ":avocado: enable", Cleber Rosa, 2019/06/07
- [Qemu-devel] [PATCH 2/8] tests/requirements.txt: pin paramiko version requirement, Cleber Rosa, 2019/06/07
- [Qemu-devel] [PATCH 4/8] Boot Linux Console Test: add a test for ppc64 + pseries, Cleber Rosa, 2019/06/07
- [Qemu-devel] [PATCH 7/8] VNC Acceptance test: check protocol version, Cleber Rosa, 2019/06/07
- Re: [Qemu-devel] [PATCH 7/8] VNC Acceptance test: check protocol version,
Daniel P . Berrangé <=
- Re: [Qemu-devel] [PATCH 7/8] VNC Acceptance test: check protocol version, Wainer dos Santos Moschetta, 2019/06/10
- [Qemu-devel] [PATCH 5/8] VNC Acceptance test: use UNIX domain sockets to avoid port collisions, Cleber Rosa, 2019/06/07
- [Qemu-devel] [PATCH 6/8] VNC Acceptance test: simplify test names, Cleber Rosa, 2019/06/07
- [Qemu-devel] [PATCH 8/8] Migration acceptance test: reduce the possibility of port collisions, Cleber Rosa, 2019/06/07
- Re: [Qemu-devel] [PATCH 0/8] Miscellaneous acceptance test and Travis CI improvements, Cleber Rosa, 2019/06/07