validate:launcher: Allow passing extra env variables to the tests

Summary: Depends on D173

Reviewers: Mathieu_Du, gdesmott

Differential Revision: http://phabricator.freedesktop.org/D174
This commit is contained in:
Thibault Saunier 2015-05-13 15:29:43 +02:00
parent 817ef82bb0
commit 4ada36dbfc
2 changed files with 21 additions and 9 deletions

View file

@ -364,7 +364,8 @@ class GstValidateLaunchTest(GstValidateTest):
def __init__(self, classname, options, reporter, pipeline_desc,
timeout=DEFAULT_TIMEOUT, scenario=None,
media_descriptor=None, duration=0, hard_timeout=None):
media_descriptor=None, duration=0, hard_timeout=None,
extra_env_variables={}):
try:
timeout = GST_VALIDATE_PROTOCOL_TIMEOUTS[
media_descriptor.get_protocol()]
@ -384,7 +385,8 @@ class GstValidateLaunchTest(GstValidateTest):
duration=duration,
scenario=scenario,
timeout=timeout,
hard_timeout=hard_timeout)
hard_timeout=hard_timeout,
extra_env_variables=extra_env_variables)
self.pipeline_desc = pipeline_desc
self.media_descriptor = media_descriptor
@ -400,11 +402,12 @@ class GstValidateLaunchTest(GstValidateTest):
class GstValidateMediaCheckTest(GstValidateTest):
def __init__(self, classname, options, reporter, media_descriptor,
uri, minfo_path, timeout=DEFAULT_TIMEOUT):
uri, minfo_path, timeout=DEFAULT_TIMEOUT, extra_env_variables={}):
super(
GstValidateMediaCheckTest, self).__init__(G_V_DISCOVERER_COMMAND, classname,
options, reporter,
timeout=timeout)
timeout=timeout,
extra_env_variables=extra_env_variables)
self._uri = uri
self.media_descriptor = media_descriptor
self._media_info_path = minfo_path
@ -421,7 +424,7 @@ class GstValidateTranscodingTest(GstValidateTest, GstValidateEncodingTestInterfa
def __init__(self, classname, options, reporter,
combination, uri, media_descriptor,
timeout=DEFAULT_TIMEOUT,
scenario=None):
scenario=None, extra_env_variables={}):
Loggable.__init__(self)
@ -446,7 +449,8 @@ class GstValidateTranscodingTest(GstValidateTest, GstValidateEncodingTestInterfa
reporter,
duration=duration,
timeout=timeout,
scenario=scenario)
scenario=scenario,
extra_env_variables=extra_env_variables)
GstValidateEncodingTestInterface.__init__(
self, combination, media_descriptor)

View file

@ -51,7 +51,7 @@ class Test(Loggable):
def __init__(self, application_name, classname, options,
reporter, duration=0, timeout=DEFAULT_TIMEOUT,
hard_timeout=None):
hard_timeout=None, extra_env_variables={}):
"""
@timeout: The timeout during which the value return by get_current_value
keeps being exactly equal
@ -71,6 +71,8 @@ class Test(Loggable):
self.queue = None
self.duration = duration
self.extra_env_variables = extra_env_variables
self.clean()
def clean(self):
@ -342,6 +344,10 @@ class Test(Loggable):
self.build_arguments()
self.proc_env = self.get_subproc_env()
for var, value in self.extra_env_variables.items():
self.proc_env[var] = self.proc_env.get(var, '') + os.pathsep + value
self.add_env_variable(var, self.proc_env[var])
if self.options.valgrind:
self.use_valgrind()
@ -396,7 +402,8 @@ class GstValidateTest(Test):
def __init__(self, application_name, classname,
options, reporter, duration=0,
timeout=DEFAULT_TIMEOUT, scenario=None, hard_timeout=None):
timeout=DEFAULT_TIMEOUT, scenario=None, hard_timeout=None,
extra_env_variables=[]):
if not hard_timeout and self.HARD_TIMEOUT_FACTOR:
if timeout:
@ -418,7 +425,8 @@ class GstValidateTest(Test):
options, reporter,
duration=duration,
timeout=timeout,
hard_timeout=hard_timeout)
hard_timeout=hard_timeout,
extra_env_variables=extra_env_variables)
# defines how much the process can be outside of the configured
# segment / seek