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
This commit is contained in:
parent
7c759d9a89
commit
a9bc93da99
|
@ -125,11 +125,14 @@ class ParallelTerminationStrategy(TerminationStrategy):
|
|||
|
||||
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 @@ class Process(log.Origin):
|
|||
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 @@ class Process(log.Origin):
|
|||
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):
|
||||
|
|
|
@ -247,9 +247,11 @@ class IPerf3Client(log.Origin):
|
|||
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())
|
||||
|
|
Loading…
Reference in New Issue