Fix: tests: live: listen on python < 3.5 needs backlog parameter
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Wed, 25 Sep 2019 21:13:39 +0000 (17:13 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Thu, 26 Sep 2019 00:44:56 +0000 (20:44 -0400)
The backlog parameter is required on python version smaller then 3.5.

On sles12sp2:

 Traceback (most recent call last):
   File "/home/jenkins/workspace/babeltrace_master_slesbuild/arch/sles12sp2/build/std/conf/prod/src/babeltrace/tests/data/plugins/src.ctf.lttng-live/lttng_live_server.py", line 1447, in <module>
     args.port_filename, args.sessions, args.max_query_data_response_size
   File "/home/jenkins/workspace/babeltrace_master_slesbuild/arch/sles12sp2/build/std/conf/prod/src/babeltrace/tests/data/plugins/src.ctf.lttng-live/lttng_live_server.py", line 1232, in __init__
     self._listen()
   File "/home/jenkins/workspace/babeltrace_master_slesbuild/arch/sles12sp2/build/std/conf/prod/src/babeltrace/tests/data/plugins/src.ctf.lttng-live/lttng_live_server.py", line 1323, in _listen
     self._sock.listen()
 TypeError: listen() takes exactly one argument (0 given)

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Change-Id: Ib923beb9eadf929714b3270aaa7a57ff6c52407e
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2096
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
tests/data/plugins/src.ctf.lttng-live/lttng_live_server.py

index 4c3c9ff45c0088d23f67e197fbcc6b6a4e925764..416f9bca1eda60c8d9362b91c7566057f230a7b2 100644 (file)
@@ -1320,7 +1320,9 @@ class LttngLiveServer:
 
     def _listen(self):
         logging.info('Listening: port={}'.format(self._server_port))
 
     def _listen(self):
         logging.info('Listening: port={}'.format(self._server_port))
-        self._sock.listen()
+        # Backlog must be present for Python version < 3.5.
+        # 128 is an arbitrary number since we expect only 1 connection anyway.
+        self._sock.listen(128)
         self._conn, viewer_addr = self._sock.accept()
         logging.info(
             'Accepted viewer: addr={}:{}'.format(viewer_addr[0], viewer_addr[1])
         self._conn, viewer_addr = self._sock.accept()
         logging.info(
             'Accepted viewer: addr={}:{}'.format(viewer_addr[0], viewer_addr[1])
This page took 0.02802 seconds and 4 git commands to generate.