mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-20 23:36:38 +00:00
validate: launcher: Use a Queue to test for test completion
TestManager will use a Queue to track progress for all tests. This commit implements a queue inside Test to simplify the transition. Patch 3/4 to make TestManager handle waiting for processes instead of expecting each Test to do it. https://bugzilla.gnome.org/show_bug.cgi?id=743063
This commit is contained in:
parent
bd4c221141
commit
0026c2804f
1 changed files with 8 additions and 1 deletions
|
@ -29,6 +29,7 @@ import signal
|
||||||
import urlparse
|
import urlparse
|
||||||
import subprocess
|
import subprocess
|
||||||
import threading
|
import threading
|
||||||
|
import Queue
|
||||||
import reporters
|
import reporters
|
||||||
import ConfigParser
|
import ConfigParser
|
||||||
import loggable
|
import loggable
|
||||||
|
@ -62,6 +63,7 @@ class Test(Loggable):
|
||||||
self.process = None
|
self.process = None
|
||||||
self.proc_env = None
|
self.proc_env = None
|
||||||
self.thread = None
|
self.thread = None
|
||||||
|
self.queue = Queue.Queue()
|
||||||
self.duration = duration
|
self.duration = duration
|
||||||
|
|
||||||
self.clean()
|
self.clean()
|
||||||
|
@ -194,7 +196,10 @@ class Test(Loggable):
|
||||||
def wait_process(self):
|
def wait_process(self):
|
||||||
while True:
|
while True:
|
||||||
# Check process every second for timeout
|
# Check process every second for timeout
|
||||||
self.thread.join(1.0)
|
try:
|
||||||
|
self.queue.get(timeout=1)
|
||||||
|
except Queue.Empty:
|
||||||
|
pass
|
||||||
|
|
||||||
if self.process_update():
|
if self.process_update():
|
||||||
break
|
break
|
||||||
|
@ -272,6 +277,8 @@ class Test(Loggable):
|
||||||
shell=True,
|
shell=True,
|
||||||
env=self.proc_env)
|
env=self.proc_env)
|
||||||
self.process.wait()
|
self.process.wait()
|
||||||
|
if self.result is not Result.TIMEOUT:
|
||||||
|
self.queue.put(None)
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
self.open_logfile()
|
self.open_logfile()
|
||||||
|
|
Loading…
Reference in a new issue