launcher: Handle override files for media files

And make sure to create a new dict for extra_env_vars when instanciating
GstValidateTest
This commit is contained in:
Thibault Saunier 2015-08-15 16:40:11 +02:00
parent 367e6cc4f4
commit bb2532aa54
2 changed files with 38 additions and 7 deletions

View file

@ -365,7 +365,10 @@ class GstValidateLaunchTest(GstValidateTest):
def __init__(self, classname, options, reporter, pipeline_desc,
timeout=DEFAULT_TIMEOUT, scenario=None,
media_descriptor=None, duration=0, hard_timeout=None,
extra_env_variables={}):
extra_env_variables=None):
extra_env_variables = extra_env_variables or {}
try:
timeout = GST_VALIDATE_PROTOCOL_TIMEOUTS[
media_descriptor.get_protocol()]
@ -403,7 +406,10 @@ class GstValidateLaunchTest(GstValidateTest):
class GstValidateMediaCheckTest(GstValidateTest):
def __init__(self, classname, options, reporter, media_descriptor,
uri, minfo_path, timeout=DEFAULT_TIMEOUT, extra_env_variables={}):
uri, minfo_path, timeout=DEFAULT_TIMEOUT,
extra_env_variables=None):
extra_env_variables = extra_env_variables or {}
super(
GstValidateMediaCheckTest, self).__init__(G_V_DISCOVERER_COMMAND, classname,
options, reporter,
@ -425,10 +431,12 @@ class GstValidateTranscodingTest(GstValidateTest, GstValidateEncodingTestInterfa
def __init__(self, classname, options, reporter,
combination, uri, media_descriptor,
timeout=DEFAULT_TIMEOUT,
scenario=None, extra_env_variables={}):
scenario=None,
extra_env_variables=None):
Loggable.__init__(self)
extra_env_variables = extra_env_variables or {}
file_dur = long(media_descriptor.get_duration()) / GST_SECOND
if not media_descriptor.get_num_tracks("video"):
self.debug("%s audio only file applying transcoding ratio."
@ -452,7 +460,8 @@ class GstValidateTranscodingTest(GstValidateTest, GstValidateEncodingTestInterfa
timeout=timeout,
scenario=scenario,
media_descriptor=media_descriptor,
extra_env_variables=extra_env_variables)
extra_env_variables=None)
extra_env_variables = extra_env_variables or {}
GstValidateEncodingTestInterface.__init__(
self, combination, media_descriptor)

View file

@ -44,6 +44,8 @@ VALGRIND_TIMEOUT_FACTOR = 20
# The error reported by valgrind when detecting errors
VALGRIND_ERROR_CODE = 20
VALIDATE_OVERRIDE_EXTENSION = ".override"
class Test(Loggable):
@ -51,7 +53,7 @@ class Test(Loggable):
def __init__(self, application_name, classname, options,
reporter, duration=0, timeout=DEFAULT_TIMEOUT,
hard_timeout=None, extra_env_variables={}):
hard_timeout=None, extra_env_variables=None):
"""
@timeout: The timeout during which the value return by get_current_value
keeps being exactly equal
@ -71,6 +73,7 @@ class Test(Loggable):
self.queue = None
self.duration = duration
extra_env_variables = extra_env_variables or {}
self.extra_env_variables = extra_env_variables
self.clean()
@ -413,7 +416,9 @@ class GstValidateTest(Test):
def __init__(self, application_name, classname,
options, reporter, duration=0,
timeout=DEFAULT_TIMEOUT, scenario=None, hard_timeout=None,
media_descriptor=None, extra_env_variables={}):
media_descriptor=None, extra_env_variables=None):
extra_env_variables = extra_env_variables or {}
if not hard_timeout and self.HARD_TIMEOUT_FACTOR:
if timeout:
@ -433,6 +438,14 @@ class GstValidateTest(Test):
self.media_descriptor = media_descriptor
override_path = self.get_override_file(media_descriptor)
if override_path:
if extra_env_variables:
if extra_env_variables.get("GST_VALIDATE_OVERRIDE", ""):
extra_env_variables["GST_VALIDATE_OVERRIDE"] += os.path.pathsep
extra_env_variables["GST_VALIDATE_OVERRIDE"] = override_path
super(GstValidateTest, self).__init__(application_name, classname,
options, reporter,
duration=duration,
@ -450,6 +463,15 @@ class GstValidateTest(Test):
else:
self.scenario = scenario
def get_override_file(self, media_descriptor):
if media_descriptor:
if media_descriptor.get_path():
override_path = os.path.splitext(media_descriptor.get_path())[0] + VALIDATE_OVERRIDE_EXTENSION
if os.path.exists(override_path):
return override_path
return None
def get_current_value(self):
if self.scenario:
sent_eos = self.sent_eos_position()