mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
validate: Add the notion of "long" tests so that we can avoid some test to be run if they are too long
This commit is contained in:
parent
ac6e463009
commit
cdb8822ae3
4 changed files with 36 additions and 22 deletions
|
@ -53,7 +53,7 @@ class MediaDescriptor(Loggable):
|
||||||
return self.media_xml.attrib["uri"]
|
return self.media_xml.attrib["uri"]
|
||||||
|
|
||||||
def get_duration(self):
|
def get_duration(self):
|
||||||
return self.media_xml.attrib["duration"]
|
return long(self.media_xml.attrib["duration"])
|
||||||
|
|
||||||
def set_protocol(self, protocol):
|
def set_protocol(self, protocol):
|
||||||
self.media_xml.attrib["protocol"] = protocol
|
self.media_xml.attrib["protocol"] = protocol
|
||||||
|
@ -213,8 +213,14 @@ class GstValidateLaunchTest(GstValidateTest):
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
duration = 0
|
||||||
|
if scenario:
|
||||||
|
duration = scenario.get_duration()
|
||||||
|
elif media_descriptor:
|
||||||
|
duration = media_descriptor.get_duration() / GST_SECOND
|
||||||
super(GstValidateLaunchTest, self).__init__(GST_VALIDATE_COMMAND, classname,
|
super(GstValidateLaunchTest, self).__init__(GST_VALIDATE_COMMAND, classname,
|
||||||
options, reporter,
|
options, reporter,
|
||||||
|
duration=duration,
|
||||||
scenario=scenario,
|
scenario=scenario,
|
||||||
timeout=timeout)
|
timeout=timeout)
|
||||||
|
|
||||||
|
@ -263,32 +269,22 @@ class GstValidateMediaCheckTest(Test):
|
||||||
class GstValidateTranscodingTest(GstValidateTest):
|
class GstValidateTranscodingTest(GstValidateTest):
|
||||||
_scenarios = ScenarioManager()
|
_scenarios = ScenarioManager()
|
||||||
def __init__(self, classname, options, reporter,
|
def __init__(self, classname, options, reporter,
|
||||||
combination, uri, media_descriptor, timeout=DEFAULT_TIMEOUT,
|
combination, uri, media_descriptor,
|
||||||
scenario_name="play_15s"):
|
timeout=DEFAULT_TIMEOUT,
|
||||||
|
scenario=None):
|
||||||
|
|
||||||
Loggable.__init__(self)
|
Loggable.__init__(self)
|
||||||
|
|
||||||
file_dur = long(media_descriptor.get_duration()) / GST_SECOND
|
file_dur = long(media_descriptor.get_duration()) / GST_SECOND
|
||||||
if file_dur < 30:
|
|
||||||
self.debug("%s is short (%ds< 30 secs) playing it all" % (uri, file_dur))
|
|
||||||
scenario = None
|
|
||||||
else:
|
|
||||||
self.debug("%s is long (%ds > 30 secs) playing it all" % (uri, file_dur))
|
|
||||||
scenario = self._scenarios.get_scenario(scenario_name)
|
|
||||||
try:
|
try:
|
||||||
timeout = G_V_PROTOCOL_TIMEOUTS[media_descriptor.get_protocol()]
|
timeout = G_V_PROTOCOL_TIMEOUTS[media_descriptor.get_protocol()]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
try:
|
|
||||||
hard_timeout = 4 * int(scenario.duration) + timeout
|
|
||||||
except AttributeError:
|
|
||||||
hard_timeout = None
|
|
||||||
|
|
||||||
super(GstValidateTranscodingTest, self).__init__(
|
super(GstValidateTranscodingTest, self).__init__(
|
||||||
GST_VALIDATE_TRANSCODING_COMMAND, classname,
|
GST_VALIDATE_TRANSCODING_COMMAND, classname,
|
||||||
options, reporter, scenario=scenario, timeout=timeout,
|
options, reporter, duration=file_dur,
|
||||||
hard_timeout=hard_timeout)
|
timeout=timeout, scenario=scenario)
|
||||||
|
|
||||||
self.media_descriptor = media_descriptor
|
self.media_descriptor = media_descriptor
|
||||||
self.uri = uri
|
self.uri = uri
|
||||||
|
|
|
@ -40,7 +40,8 @@ class Test(Loggable):
|
||||||
""" A class representing a particular test. """
|
""" A class representing a particular test. """
|
||||||
|
|
||||||
def __init__(self, application_name, classname, options,
|
def __init__(self, application_name, classname, options,
|
||||||
reporter, timeout=DEFAULT_TIMEOUT, hard_timeout=None):
|
reporter, duration=0, timeout=DEFAULT_TIMEOUT,
|
||||||
|
hard_timeout=None):
|
||||||
"""
|
"""
|
||||||
@timeout: The timeout during which the value return by get_current_value
|
@timeout: The timeout during which the value return by get_current_value
|
||||||
keeps being exactly equal
|
keeps being exactly equal
|
||||||
|
@ -55,6 +56,7 @@ class Test(Loggable):
|
||||||
self.command = ""
|
self.command = ""
|
||||||
self.reporter = reporter
|
self.reporter = reporter
|
||||||
self.process = None
|
self.process = None
|
||||||
|
self.duration = duration
|
||||||
|
|
||||||
self.clean()
|
self.clean()
|
||||||
|
|
||||||
|
@ -247,11 +249,12 @@ class GstValidateTest(Test):
|
||||||
findlastseek_regex = re.compile('seeking to.*(\d+):(\d+):(\d+).(\d+).*stop.*(\d+):(\d+):(\d+).(\d+).*rate.*(\d+)\.(\d+)')
|
findlastseek_regex = re.compile('seeking to.*(\d+):(\d+):(\d+).(\d+).*stop.*(\d+):(\d+):(\d+).(\d+).*rate.*(\d+)\.(\d+)')
|
||||||
|
|
||||||
def __init__(self, application_name, classname,
|
def __init__(self, application_name, classname,
|
||||||
options, reporter, timeout=DEFAULT_TIMEOUT,
|
options, reporter, duration=0,
|
||||||
scenario=None, hard_timeout=None):
|
timeout=DEFAULT_TIMEOUT, scenario=None, hard_timeout=None):
|
||||||
|
|
||||||
super(GstValidateTest, self).__init__(application_name, classname, options,
|
super(GstValidateTest, self).__init__(application_name, classname, options,
|
||||||
reporter, timeout=timeout, hard_timeout=hard_timeout)
|
reporter, duration=duration,
|
||||||
|
timeout=timeout, hard_timeout=hard_timeout)
|
||||||
|
|
||||||
# defines how much the process can be outside of the configured
|
# defines how much the process can be outside of the configured
|
||||||
# segment / seek
|
# segment / seek
|
||||||
|
@ -504,6 +507,13 @@ class TestsManager(Loggable):
|
||||||
if self._check_blacklisted(test):
|
if self._check_blacklisted(test):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
if test.duration > 0 and int(self.options.long_limit) < int(test.duration):
|
||||||
|
self.info("Not activating test as it duration (%d) is superior"
|
||||||
|
" than the long limit (%d)" % (test.duration,
|
||||||
|
int(self.options.long_limit)))
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
if not self.wanted_tests_patterns:
|
if not self.wanted_tests_patterns:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -672,6 +682,11 @@ class Scenario(object):
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def get_duration(self):
|
||||||
|
try:
|
||||||
|
return float(getattr(self, "duration"))
|
||||||
|
except AttributeError:
|
||||||
|
return 0
|
||||||
|
|
||||||
def get_min_tracks(self, track_type):
|
def get_min_tracks(self, track_type):
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -183,7 +183,9 @@ def main():
|
||||||
parser.add_argument("-g", "--generate-media-info", dest="generate_info",
|
parser.add_argument("-g", "--generate-media-info", dest="generate_info",
|
||||||
action="store_true", default=False,
|
action="store_true", default=False,
|
||||||
help="Set it in order to generate the missing .media_infos files")
|
help="Set it in order to generate the missing .media_infos files")
|
||||||
|
parser.add_argument("-lt", "--long-test-limit", dest="long_limit",
|
||||||
|
default=utils.LONG_TEST, action='store',
|
||||||
|
help="Defines the limite from which a test is concidered as long (is seconds)"),
|
||||||
dir_group = parser.add_argument_group("Directories and files to be used by the launcher")
|
dir_group = parser.add_argument_group("Directories and files to be used by the launcher")
|
||||||
parser.add_argument('--xunit-file', action='store',
|
parser.add_argument('--xunit-file', action='store',
|
||||||
dest='xunit_file', metavar="FILE",
|
dest='xunit_file', metavar="FILE",
|
||||||
|
|
|
@ -35,7 +35,8 @@ DEFAULT_MAIN_DIR = os.path.expanduser("~/gst-validate/")
|
||||||
DEFAULT_GST_QA_ASSETS = os.path.join(DEFAULT_MAIN_DIR, "gst-qa-assets")
|
DEFAULT_GST_QA_ASSETS = os.path.join(DEFAULT_MAIN_DIR, "gst-qa-assets")
|
||||||
DISCOVERER_COMMAND = "gst-discoverer-1.0"
|
DISCOVERER_COMMAND = "gst-discoverer-1.0"
|
||||||
DURATION_TOLERANCE = GST_SECOND / 2
|
DURATION_TOLERANCE = GST_SECOND / 2
|
||||||
|
# Use to set the duration from which a test is concidered as being 'long'
|
||||||
|
LONG_TEST = 40
|
||||||
|
|
||||||
class Result(object):
|
class Result(object):
|
||||||
NOT_RUN = "Not run"
|
NOT_RUN = "Not run"
|
||||||
|
|
Loading…
Reference in a new issue