validate: launcher: Set a hard timeout on GstValidate tests if we know the duration

This commit is contained in:
Thibault Saunier 2014-12-08 15:27:54 +01:00
parent a2abf628dc
commit 5beaf5dfa8
2 changed files with 12 additions and 3 deletions

View file

@ -295,6 +295,7 @@ class GstValidateLaunchTest(GstValidateTest):
duration = scenario.get_duration()
elif media_descriptor:
duration = media_descriptor.get_duration() / GST_SECOND
super(
GstValidateLaunchTest, self).__init__(GST_VALIDATE_COMMAND, classname,
options, reporter,

View file

@ -130,8 +130,8 @@ class Test(Loggable):
pass
def set_result(self, result, message="", error=""):
self.debug("Setting result: %s (message: %s, error: %s", result,
message, error)
self.debug("Setting result: %s (message: %s, error: %s)" % (result,
message, error))
if result is Result.TIMEOUT and self.options.debug is True:
pname = subprocess.check_output(("readlink -e /proc/%s/exe"
% self.process.pid).split(' ')).replace('\n', '')
@ -205,7 +205,7 @@ class Test(Loggable):
break
elif self.hard_timeout and time.time() - start_ts > self.hard_timeout:
self.set_result(
Result.TIMEOUT, "Hard timeout reached: %d", self.hard_timeout)
Result.TIMEOUT, "Hard timeout reached: %d secs" % self.hard_timeout)
break
else:
last_change_ts = time.time()
@ -289,10 +289,18 @@ class GstValidateTest(Test):
findlastseek_regex = re.compile(
'seeking to.*(\d+):(\d+):(\d+).(\d+).*stop.*(\d+):(\d+):(\d+).(\d+).*rate.*(\d+)\.(\d+)')
HARD_TIMEOUT_FACTOR = 5
def __init__(self, application_name, classname,
options, reporter, duration=0,
timeout=DEFAULT_TIMEOUT, scenario=None, hard_timeout=None):
if not hard_timeout and self.HARD_TIMEOUT_FACTOR:
if duration:
hard_timeout = duration * self.HARD_TIMEOUT_FACTOR
else:
hard_timeout = None
super(
GstValidateTest, self).__init__(application_name, classname, options,
reporter, duration=duration,