mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 14:56:36 +00:00
validate: launcher: Set a hard timeout on GstValidate tests if we know the duration
This commit is contained in:
parent
a2abf628dc
commit
5beaf5dfa8
2 changed files with 12 additions and 3 deletions
|
@ -295,6 +295,7 @@ class GstValidateLaunchTest(GstValidateTest):
|
||||||
duration = scenario.get_duration()
|
duration = scenario.get_duration()
|
||||||
elif media_descriptor:
|
elif media_descriptor:
|
||||||
duration = media_descriptor.get_duration() / GST_SECOND
|
duration = media_descriptor.get_duration() / GST_SECOND
|
||||||
|
|
||||||
super(
|
super(
|
||||||
GstValidateLaunchTest, self).__init__(GST_VALIDATE_COMMAND, classname,
|
GstValidateLaunchTest, self).__init__(GST_VALIDATE_COMMAND, classname,
|
||||||
options, reporter,
|
options, reporter,
|
||||||
|
|
|
@ -130,8 +130,8 @@ class Test(Loggable):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def set_result(self, result, message="", error=""):
|
def set_result(self, result, message="", error=""):
|
||||||
self.debug("Setting result: %s (message: %s, error: %s", result,
|
self.debug("Setting result: %s (message: %s, error: %s)" % (result,
|
||||||
message, error)
|
message, error))
|
||||||
if result is Result.TIMEOUT and self.options.debug is True:
|
if result is Result.TIMEOUT and self.options.debug is True:
|
||||||
pname = subprocess.check_output(("readlink -e /proc/%s/exe"
|
pname = subprocess.check_output(("readlink -e /proc/%s/exe"
|
||||||
% self.process.pid).split(' ')).replace('\n', '')
|
% self.process.pid).split(' ')).replace('\n', '')
|
||||||
|
@ -205,7 +205,7 @@ class Test(Loggable):
|
||||||
break
|
break
|
||||||
elif self.hard_timeout and time.time() - start_ts > self.hard_timeout:
|
elif self.hard_timeout and time.time() - start_ts > self.hard_timeout:
|
||||||
self.set_result(
|
self.set_result(
|
||||||
Result.TIMEOUT, "Hard timeout reached: %d", self.hard_timeout)
|
Result.TIMEOUT, "Hard timeout reached: %d secs" % self.hard_timeout)
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
last_change_ts = time.time()
|
last_change_ts = time.time()
|
||||||
|
@ -289,10 +289,18 @@ class GstValidateTest(Test):
|
||||||
findlastseek_regex = re.compile(
|
findlastseek_regex = re.compile(
|
||||||
'seeking to.*(\d+):(\d+):(\d+).(\d+).*stop.*(\d+):(\d+):(\d+).(\d+).*rate.*(\d+)\.(\d+)')
|
'seeking to.*(\d+):(\d+):(\d+).(\d+).*stop.*(\d+):(\d+):(\d+).(\d+).*rate.*(\d+)\.(\d+)')
|
||||||
|
|
||||||
|
HARD_TIMEOUT_FACTOR = 5
|
||||||
|
|
||||||
def __init__(self, application_name, classname,
|
def __init__(self, application_name, classname,
|
||||||
options, reporter, duration=0,
|
options, reporter, duration=0,
|
||||||
timeout=DEFAULT_TIMEOUT, scenario=None, hard_timeout=None):
|
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(
|
super(
|
||||||
GstValidateTest, self).__init__(application_name, classname, options,
|
GstValidateTest, self).__init__(application_name, classname, options,
|
||||||
reporter, duration=duration,
|
reporter, duration=duration,
|
||||||
|
|
Loading…
Reference in a new issue