mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 14:56:36 +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"]
|
||||
|
||||
def get_duration(self):
|
||||
return self.media_xml.attrib["duration"]
|
||||
return long(self.media_xml.attrib["duration"])
|
||||
|
||||
def set_protocol(self, protocol):
|
||||
self.media_xml.attrib["protocol"] = protocol
|
||||
|
@ -213,8 +213,14 @@ class GstValidateLaunchTest(GstValidateTest):
|
|||
except KeyError:
|
||||
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,
|
||||
options, reporter,
|
||||
duration=duration,
|
||||
scenario=scenario,
|
||||
timeout=timeout)
|
||||
|
||||
|
@ -263,32 +269,22 @@ class GstValidateMediaCheckTest(Test):
|
|||
class GstValidateTranscodingTest(GstValidateTest):
|
||||
_scenarios = ScenarioManager()
|
||||
def __init__(self, classname, options, reporter,
|
||||
combination, uri, media_descriptor, timeout=DEFAULT_TIMEOUT,
|
||||
scenario_name="play_15s"):
|
||||
combination, uri, media_descriptor,
|
||||
timeout=DEFAULT_TIMEOUT,
|
||||
scenario=None):
|
||||
|
||||
Loggable.__init__(self)
|
||||
|
||||
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:
|
||||
timeout = G_V_PROTOCOL_TIMEOUTS[media_descriptor.get_protocol()]
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
try:
|
||||
hard_timeout = 4 * int(scenario.duration) + timeout
|
||||
except AttributeError:
|
||||
hard_timeout = None
|
||||
|
||||
super(GstValidateTranscodingTest, self).__init__(
|
||||
GST_VALIDATE_TRANSCODING_COMMAND, classname,
|
||||
options, reporter, scenario=scenario, timeout=timeout,
|
||||
hard_timeout=hard_timeout)
|
||||
options, reporter, duration=file_dur,
|
||||
timeout=timeout, scenario=scenario)
|
||||
|
||||
self.media_descriptor = media_descriptor
|
||||
self.uri = uri
|
||||
|
|
|
@ -40,7 +40,8 @@ class Test(Loggable):
|
|||
""" A class representing a particular test. """
|
||||
|
||||
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
|
||||
keeps being exactly equal
|
||||
|
@ -55,6 +56,7 @@ class Test(Loggable):
|
|||
self.command = ""
|
||||
self.reporter = reporter
|
||||
self.process = None
|
||||
self.duration = duration
|
||||
|
||||
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+)')
|
||||
|
||||
def __init__(self, application_name, classname,
|
||||
options, reporter, timeout=DEFAULT_TIMEOUT,
|
||||
scenario=None, hard_timeout=None):
|
||||
options, reporter, duration=0,
|
||||
timeout=DEFAULT_TIMEOUT, scenario=None, hard_timeout=None):
|
||||
|
||||
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
|
||||
# segment / seek
|
||||
|
@ -504,6 +507,13 @@ class TestsManager(Loggable):
|
|||
if self._check_blacklisted(test):
|
||||
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:
|
||||
return True
|
||||
|
||||
|
@ -672,6 +682,11 @@ class Scenario(object):
|
|||
|
||||
return False
|
||||
|
||||
def get_duration(self):
|
||||
try:
|
||||
return float(getattr(self, "duration"))
|
||||
except AttributeError:
|
||||
return 0
|
||||
|
||||
def get_min_tracks(self, track_type):
|
||||
try:
|
||||
|
|
|
@ -183,7 +183,9 @@ def main():
|
|||
parser.add_argument("-g", "--generate-media-info", dest="generate_info",
|
||||
action="store_true", default=False,
|
||||
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")
|
||||
parser.add_argument('--xunit-file', action='store',
|
||||
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")
|
||||
DISCOVERER_COMMAND = "gst-discoverer-1.0"
|
||||
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):
|
||||
NOT_RUN = "Not run"
|
||||
|
|
Loading…
Reference in a new issue