validate: tools: Use the new scenario discovering fearure in the launcher
This commit is contained in:
parent
ba717f6237
commit
90d9a686d7
@ -23,7 +23,7 @@ import subprocess
|
|||||||
import utils
|
import utils
|
||||||
from urllib import unquote
|
from urllib import unquote
|
||||||
import xml.etree.ElementTree as ET
|
import xml.etree.ElementTree as ET
|
||||||
from baseclasses import GstValidateTest, TestsManager, Scenario
|
from baseclasses import GstValidateTest, TestsManager, ScenarioManager
|
||||||
|
|
||||||
GES_DURATION_TOLERANCE = utils.GST_SECOND / 2
|
GES_DURATION_TOLERANCE = utils.GST_SECOND / 2
|
||||||
GES_LAUNCH_COMMAND = "ges-launch-1.0"
|
GES_LAUNCH_COMMAND = "ges-launch-1.0"
|
||||||
@ -156,6 +156,8 @@ class GESRenderTest(GESTest):
|
|||||||
class GESTestsManager(TestsManager):
|
class GESTestsManager(TestsManager):
|
||||||
name = "ges"
|
name = "ges"
|
||||||
|
|
||||||
|
_scenarios = ScenarioManager()
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(GESTestsManager, self).__init__()
|
super(GESTestsManager, self).__init__()
|
||||||
|
|
||||||
@ -206,13 +208,14 @@ class GESTestsManager(TestsManager):
|
|||||||
else:
|
else:
|
||||||
projects.append(utils.path2url(proj))
|
projects.append(utils.path2url(proj))
|
||||||
|
|
||||||
SCENARIOS = [Scenario.get_scenario("play_15s"),
|
SCENARIOS = ["play_15s",
|
||||||
Scenario.get_scenario("seek_forward"),
|
"seek_forward",
|
||||||
Scenario.get_scenario("seek_backward"),
|
"seek_backward",
|
||||||
Scenario.get_scenario("scrub_forward_seeking")]
|
"scrub_forward_seeking"]
|
||||||
for proj in projects:
|
for proj in projects:
|
||||||
# First playback casses
|
# First playback casses
|
||||||
for scenario in SCENARIOS:
|
for scenario_name in SCENARIOS:
|
||||||
|
scenario = self._scenarios.get_scenario(scenario_name)
|
||||||
classname = "ges.playback.%s.%s" % (scenario.name,
|
classname = "ges.playback.%s.%s" % (scenario.name,
|
||||||
os.path.basename(proj).replace(".xges", ""))
|
os.path.basename(proj).replace(".xges", ""))
|
||||||
self.add_test(GESPlaybackTest(classname,
|
self.add_test(GESPlaybackTest(classname,
|
||||||
|
@ -22,7 +22,7 @@ import subprocess
|
|||||||
import ConfigParser
|
import ConfigParser
|
||||||
from loggable import Loggable
|
from loggable import Loggable
|
||||||
|
|
||||||
from baseclasses import GstValidateTest, TestsManager, Test, Scenario, NamedDic
|
from baseclasses import GstValidateTest, TestsManager, Test, ScenarioManager, NamedDic
|
||||||
from utils import MediaFormatCombination, get_profile,\
|
from utils import MediaFormatCombination, get_profile,\
|
||||||
path2url, DEFAULT_TIMEOUT, which, GST_SECOND, Result, \
|
path2url, DEFAULT_TIMEOUT, which, GST_SECOND, Result, \
|
||||||
compare_rendered_with_original, Protocols
|
compare_rendered_with_original, Protocols
|
||||||
@ -51,13 +51,16 @@ class PlaybinDescriptor(PipelineDescriptor):
|
|||||||
pipe = self._pipeline
|
pipe = self._pipeline
|
||||||
if options.mute:
|
if options.mute:
|
||||||
fakesink = "fakesink"
|
fakesink = "fakesink"
|
||||||
if scenario and scenario.seeks:
|
try:
|
||||||
fakesink = "'" + fakesink + " sync=true'"
|
if scenario and bool(scenario.seek) == True:
|
||||||
|
fakesink = "'" + fakesink + " sync=true'"
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
pipe += " audio-sink=%s video-sink=%s" %(fakesink, fakesink)
|
pipe += " audio-sink=%s video-sink=%s" %(fakesink, fakesink)
|
||||||
|
|
||||||
pipe += " uri=%s" % uri
|
pipe += " uri=%s" % uri
|
||||||
|
|
||||||
if scenario.reverse and protocol == Protocols.HTTP:
|
if hasattr(scenario, "reverse-playback") and protocol == Protocols.HTTP:
|
||||||
# 10MB so we can reverse playbacl
|
# 10MB so we can reverse playbacl
|
||||||
pipe += " ring-buffer-max-size=10240"
|
pipe += " ring-buffer-max-size=10240"
|
||||||
|
|
||||||
@ -89,24 +92,24 @@ G_V_ENCODING_TARGET_COMBINATIONS = [
|
|||||||
|
|
||||||
|
|
||||||
# List of scenarios to run depending on the protocol in use
|
# List of scenarios to run depending on the protocol in use
|
||||||
G_V_SCENARIOS = {Protocols.FILE: [Scenario.get_scenario("play_15s"),
|
G_V_SCENARIOS = {Protocols.FILE: ["play_15s",
|
||||||
Scenario.get_scenario("reverse_playback"),
|
"reverse_playback",
|
||||||
Scenario.get_scenario("fast_forward"),
|
"fast_forward",
|
||||||
Scenario.get_scenario("seek_forward"),
|
"seek_forward",
|
||||||
Scenario.get_scenario("seek_backward"),
|
"seek_backward",
|
||||||
Scenario.get_scenario("seek_with_stop"),
|
"seek_with_stop",
|
||||||
Scenario.get_scenario("scrub_forward_seeking")],
|
"scrub_forward_seeking"],
|
||||||
Protocols.HTTP: [Scenario.get_scenario("play_15s"),
|
Protocols.HTTP: ["play_15s",
|
||||||
Scenario.get_scenario("fast_forward"),
|
"fast_forward",
|
||||||
Scenario.get_scenario("seek_forward"),
|
"seek_forward",
|
||||||
Scenario.get_scenario("seek_backward"),
|
"seek_backward",
|
||||||
Scenario.get_scenario("seek_with_stop"),
|
"seek_with_stop",
|
||||||
Scenario.get_scenario("reverse_playback")],
|
"reverse_playback"],
|
||||||
Protocols.HLS: [Scenario.get_scenario("play_15s"),
|
Protocols.HLS: ["play_15s",
|
||||||
Scenario.get_scenario("fast_forward"),
|
"fast_forward",
|
||||||
Scenario.get_scenario("seek_forward"),
|
"seek_forward",
|
||||||
Scenario.get_scenario("seek_with_stop"),
|
"seek_with_stop",
|
||||||
Scenario.get_scenario("seek_backward")],
|
"seek_backward"],
|
||||||
}
|
}
|
||||||
|
|
||||||
G_V_BLACKLISTED_TESTS = \
|
G_V_BLACKLISTED_TESTS = \
|
||||||
@ -160,18 +163,20 @@ class GstValidateMediaCheckTest(Test):
|
|||||||
|
|
||||||
|
|
||||||
class GstValidateTranscodingTest(GstValidateTest):
|
class GstValidateTranscodingTest(GstValidateTest):
|
||||||
|
_scenarios = ScenarioManager()
|
||||||
def __init__(self, classname, options, reporter,
|
def __init__(self, classname, options, reporter,
|
||||||
combination, uri, file_infos, timeout=DEFAULT_TIMEOUT,
|
combination, uri, file_infos, timeout=DEFAULT_TIMEOUT,
|
||||||
scenario=Scenario.get_scenario("play_15s")):
|
scenario_name="play_15s"):
|
||||||
|
|
||||||
|
scenario = self._scenarios.get_scenario(scenario_name)
|
||||||
try:
|
try:
|
||||||
timeout = G_V_PROTOCOL_TIMEOUTS[file_infos.get("file-info", "protocol")]
|
timeout = G_V_PROTOCOL_TIMEOUTS[file_infos.get("file-info", "protocol")]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if scenario.max_duration is not None:
|
try:
|
||||||
hard_timeout = 4 * scenario.max_duration + timeout
|
hard_timeout = 4 * int(scenario.duration) + timeout
|
||||||
else:
|
except AttributeError:
|
||||||
hard_timeout = None
|
hard_timeout = None
|
||||||
|
|
||||||
super(GstValidateTranscodingTest, self).__init__(
|
super(GstValidateTranscodingTest, self).__init__(
|
||||||
@ -215,6 +220,8 @@ class GstValidateTranscodingTest(GstValidateTest):
|
|||||||
class GstValidateManager(TestsManager, Loggable):
|
class GstValidateManager(TestsManager, Loggable):
|
||||||
|
|
||||||
name = "validate"
|
name = "validate"
|
||||||
|
_scenarios = ScenarioManager()
|
||||||
|
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
TestsManager.__init__(self)
|
TestsManager.__init__(self)
|
||||||
@ -338,10 +345,12 @@ class GstValidateManager(TestsManager, Loggable):
|
|||||||
if pipe_descriptor.needs_uri():
|
if pipe_descriptor.needs_uri():
|
||||||
for uri, minfo in self._list_uris():
|
for uri, minfo in self._list_uris():
|
||||||
protocol = minfo.config.get("file-info", "protocol")
|
protocol = minfo.config.get("file-info", "protocol")
|
||||||
for scenario in G_V_SCENARIOS[protocol]:
|
for scenario_name in G_V_SCENARIOS[protocol]:
|
||||||
|
scenario = self._scenarios.get_scenario(scenario_name)
|
||||||
npipe = pipe_descriptor.get_pipeline(self.options,
|
npipe = pipe_descriptor.get_pipeline(self.options,
|
||||||
protocol,
|
protocol,
|
||||||
scenario, uri)
|
scenario,
|
||||||
|
uri)
|
||||||
if minfo.config.getboolean("media-info", "seekable") is False:
|
if minfo.config.getboolean("media-info", "seekable") is False:
|
||||||
self.debug("Do not run %s as %s does not support seeking",
|
self.debug("Do not run %s as %s does not support seeking",
|
||||||
scenario, uri)
|
scenario, uri)
|
||||||
|
@ -26,6 +26,7 @@ import utils
|
|||||||
import urlparse
|
import urlparse
|
||||||
import subprocess
|
import subprocess
|
||||||
import reporters
|
import reporters
|
||||||
|
import ConfigParser
|
||||||
from loggable import Loggable
|
from loggable import Loggable
|
||||||
from optparse import OptionGroup
|
from optparse import OptionGroup
|
||||||
|
|
||||||
@ -568,25 +569,42 @@ class NamedDic(object):
|
|||||||
for name, value in props.iteritems():
|
for name, value in props.iteritems():
|
||||||
setattr(self, name, value)
|
setattr(self, name, value)
|
||||||
|
|
||||||
|
|
||||||
class Scenario(object):
|
class Scenario(object):
|
||||||
|
def __init__(self, name, props):
|
||||||
def __init__(self, name, max_duration=None, seeks=True, reverse=False):
|
|
||||||
self.name = name
|
self.name = name
|
||||||
self.max_duration = max_duration
|
|
||||||
self.seeks = seeks
|
|
||||||
self.reverse = reverse
|
|
||||||
|
|
||||||
@classmethod
|
for prop, value in props:
|
||||||
def get_scenario(cls, name):
|
setattr(self, prop, value)
|
||||||
return [scenario for scenario in ALL_SCENARIOS if scenario.name == name][0]
|
|
||||||
|
class ScenarioManager(object):
|
||||||
|
_instance = None
|
||||||
|
all_scenarios = []
|
||||||
|
GST_VALIDATE_COMMAND = "gst-validate-1.0"
|
||||||
|
|
||||||
|
def __new__(cls, *args, **kwargs):
|
||||||
|
if not cls._instance:
|
||||||
|
cls._instance = super(ScenarioManager, cls).__new__(
|
||||||
|
cls, *args, **kwargs)
|
||||||
|
cls._instance.config = None
|
||||||
|
return cls._instance
|
||||||
|
|
||||||
|
def get_scenario(self, name):
|
||||||
|
if self.all_scenarios:
|
||||||
|
return [scenario for scenario in self.all_scenarios if scenario.name == name][0]
|
||||||
|
|
||||||
|
scenario_defs = os.path.join(self.config.main_dir, "scenarios.def")
|
||||||
|
try:
|
||||||
|
subprocess.check_output([self.GST_VALIDATE_COMMAND,
|
||||||
|
"--scenarios-defs-output-file",
|
||||||
|
scenario_defs])
|
||||||
|
except subprocess.CalledProcessError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
config = ConfigParser.ConfigParser()
|
||||||
|
f = open(scenario_defs)
|
||||||
|
config.readfp(f)
|
||||||
|
|
||||||
|
for section in config.sections():
|
||||||
|
self.all_scenarios.append(Scenario(section,
|
||||||
|
config.items(section)))
|
||||||
|
|
||||||
ALL_SCENARIOS = [
|
|
||||||
Scenario("play_15s", seeks=False, max_duration=15),
|
|
||||||
Scenario("reverse_playback", reverse=True),
|
|
||||||
Scenario("fast_forward", seeks=True),
|
|
||||||
Scenario("seek_forward", seeks=True),
|
|
||||||
Scenario("seek_backward", seeks=True),
|
|
||||||
Scenario("scrub_forward_seeking", seeks=True),
|
|
||||||
Scenario("seek_with_stop", seeks=True),
|
|
||||||
]
|
|
||||||
|
@ -24,7 +24,7 @@ import loggable
|
|||||||
from optparse import OptionParser, OptionGroup
|
from optparse import OptionParser, OptionGroup
|
||||||
|
|
||||||
from httpserver import HTTPServer
|
from httpserver import HTTPServer
|
||||||
from baseclasses import _TestsLauncher
|
from baseclasses import _TestsLauncher, ScenarioManager
|
||||||
from utils import printc, path2url, DEFAULT_MAIN_DIR, launch_command, Colors
|
from utils import printc, path2url, DEFAULT_MAIN_DIR, launch_command, Colors
|
||||||
|
|
||||||
|
|
||||||
@ -169,6 +169,8 @@ def main():
|
|||||||
options.remote_assets_url,
|
options.remote_assets_url,
|
||||||
options.clone_dir))
|
options.clone_dir))
|
||||||
|
|
||||||
|
# Ensure that the scenario manager singleton is ready to be used
|
||||||
|
ScenarioManager().config = options
|
||||||
tests_launcher.list_tests()
|
tests_launcher.list_tests()
|
||||||
|
|
||||||
httpsrv = HTTPServer(options)
|
httpsrv = HTTPServer(options)
|
||||||
|
@ -238,3 +238,9 @@ def compare_rendered_with_original(orig_duration, dest_file, tolerance=DURATION_
|
|||||||
"wrong-duration")
|
"wrong-duration")
|
||||||
else:
|
else:
|
||||||
return (Result.PASSED, "")
|
return (Result.PASSED, "")
|
||||||
|
|
||||||
|
|
||||||
|
def get_scenarios():
|
||||||
|
GST_VALIDATE_COMMAND = "gst-validate-1.0"
|
||||||
|
os.system("%s --scenarios-defs-output-file %s" % (GST_VALIDATE_COMMAND,
|
||||||
|
))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user