suite: Make _processes an empty list during init time

It simplifies the code because we don't need to check if it is a list or
not.

Change-Id: I634901a1f4ba3a6b7294666012ea679ae148ff08
This commit is contained in:
Pau Espin 2019-04-04 17:44:33 +02:00
parent 4c8cd7b9a5
commit 806aae8830
1 changed files with 10 additions and 13 deletions

View File

@ -73,7 +73,7 @@ class SuiteRun(log.Origin):
self._resource_requirements = None
self._resource_modifiers = None
self._config = None
self._processes = None
self._processes = []
self._run_dir = None
self.trial = trial
self.definition = suite_definition
@ -241,8 +241,6 @@ class SuiteRun(log.Origin):
process managed by suite finishes before cleanup time, the current test
will be marked as FAIL and end immediatelly. If respwan=True, then suite
will respawn() the process instead.'''
if self._processes is None:
self._processes = []
self._processes.insert(0, (process, respawn))
def stop_processes(self):
@ -396,16 +394,15 @@ class SuiteRun(log.Origin):
return bvci
def poll(self):
if self._processes:
for proc, respawn in self._processes:
if proc.terminated():
if respawn == True:
proc.respawn()
else:
proc.log_stdout_tail()
proc.log_stderr_tail()
log.ctx(proc)
raise log.Error('Process ended prematurely: %s' % proc.name())
for proc, respawn in self._processes:
if proc.terminated():
if respawn == True:
proc.respawn()
else:
proc.log_stdout_tail()
proc.log_stderr_tail()
log.ctx(proc)
raise log.Error('Process ended prematurely: %s' % proc.name())
def prompt(self, *msgs, **msg_details):
'ask for user interaction. Do not use in tests that should run automatically!'