Change in osmo-gsm-tester[master]: iperf3: Fix iperf3cli.launch_sync() when configured to run more than ...

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

pespin gerrit-no-reply at lists.osmocom.org
Fri Jun 12 14:02:05 UTC 2020


pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-gsm-tester/+/18792 )

Change subject: iperf3: Fix iperf3cli.launch_sync() when configured to run more than 300 sec
......................................................................

iperf3: Fix iperf3cli.launch_sync() when configured to run more than 300 sec

process object always used timeout=300 while runnig wth launch_sync().
Let's allow replacing that value beforehand so that iperf3 can
pre-configure the process object and caller doesn't need to care about
calculating expected time.

Change-Id: I7f6c5078f648013515919aa35ebcdb3ef157b5e4
---
M src/osmo_gsm_tester/core/process.py
M src/osmo_gsm_tester/obj/iperf3.py
2 files changed, 14 insertions(+), 3 deletions(-)

Approvals:
  Jenkins Builder: Verified
  pespin: Looks good to me, approved



diff --git a/src/osmo_gsm_tester/core/process.py b/src/osmo_gsm_tester/core/process.py
index 8954674..1823a20 100644
--- a/src/osmo_gsm_tester/core/process.py
+++ b/src/osmo_gsm_tester/core/process.py
@@ -125,11 +125,14 @@
 
 class Process(log.Origin):
 
+    DEFAULT_WAIT_TIMEOUT = 300 # seconds
+
     def __init__(self, name, run_dir, popen_args, **popen_kwargs):
         super().__init__(log.C_RUN, name)
         self.process_obj = None
         self.result = None
         self.killed = None
+        self.default_wait_timeout = Process.DEFAULT_WAIT_TIMEOUT
         self.name_str = name
         self.run_dir = run_dir
         self.popen_args = popen_args
@@ -143,6 +146,10 @@
         env[key] = value
         self.popen_kwargs['env'] = env
 
+    def set_default_wait_timeout(self, timeout):
+        assert timeout
+        self.default_wait_timeout = timeout
+
     def make_output_log(self, name):
         '''
         create a non-existing log output file in run_dir to pipe stdout and
@@ -346,7 +353,9 @@
             self.poll()
         return self.result is not None
 
-    def wait(self, timeout=300):
+    def wait(self, timeout=None):
+        if timeout is None:
+            timeout = self.default_wait_timeout
         MainLoop.wait(self.terminated, timeout=timeout)
 
     def stdin_write(self, cmd):
diff --git a/src/osmo_gsm_tester/obj/iperf3.py b/src/osmo_gsm_tester/obj/iperf3.py
index 70fceff..ee62159 100644
--- a/src/osmo_gsm_tester/obj/iperf3.py
+++ b/src/osmo_gsm_tester/obj/iperf3.py
@@ -247,9 +247,11 @@
         self.run_dir = util.Dir(self.testenv.test().get_run_dir().new_dir(self.name()))
         self.log_file = self.run_dir.new_file(IPerf3Client.LOGFILE)
         if self.runs_locally():
-            return self.prepare_test_proc_locally(dir, netns, time_sec, proto == IPerf3Client.PROTO_UDP, bitrate)
+            proc = self.prepare_test_proc_locally(dir, netns, time_sec, proto == IPerf3Client.PROTO_UDP, bitrate)
         else:
-            return self.prepare_test_proc_remotely(dir, netns, time_sec, proto == IPerf3Client.PROTO_UDP, bitrate)
+            proc = self.prepare_test_proc_remotely(dir, netns, time_sec, proto == IPerf3Client.PROTO_UDP, bitrate)
+        proc.set_default_wait_timeout(time_sec + 10) # leave 10 extra sec for remote run, ctrl conn establishment, etc.
+        return proc
 
     def prepare_test_proc_remotely(self, dir, netns, time_sec, use_udp, bitrate):
         self.rem_host = remote.RemoteHost(self.run_dir, self._run_node.ssh_user(), self._run_node.ssh_addr())

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-gsm-tester/+/18792
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Change-Id: I7f6c5078f648013515919aa35ebcdb3ef157b5e4
Gerrit-Change-Number: 18792
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200612/e4b4a63e/attachment.htm>


More information about the gerrit-log mailing list