qemu-devel
[Top][All Lists]
Advanced

[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: Wainer dos Santos Moschetta
Subject: Re: [Qemu-devel] [PATCH 7/8] VNC Acceptance test: check protocol version
Date: Mon, 10 Jun 2019 17:43:15 -0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2


On 06/07/2019 12:22 PM, 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.

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'])

I will advocate for the use QEMUMachine.command() instead of qmp(). The former do some checks on the qmp response and raises a more gently exception if something went wrong. This patch looks good to me though.

Reviewed-by: Wainer dos Santos Moschetta <address@hidden>

+        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)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]