mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-07 15:02:40 +00:00
validate:tools: Add namespace in apps global variables
Avoiding conflicts
This commit is contained in:
parent
932fcaf9b8
commit
1ecd26eef6
2 changed files with 36 additions and 34 deletions
|
@ -25,11 +25,11 @@ 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, Scenario
|
||||||
|
|
||||||
DURATION_TOLERANCE = utils.GST_SECOND / 2
|
GES_DURATION_TOLERANCE = utils.GST_SECOND / 2
|
||||||
DEFAULT_GES_LAUNCH = "ges-launch-1.0"
|
GES_LAUNCH_COMMAND = "ges-launch-1.0"
|
||||||
|
|
||||||
|
|
||||||
COMBINATIONS = [
|
GES_ENCODING_TARGET_COMBINATIONS = [
|
||||||
utils.MediaFormatCombination("ogg", "vorbis", "theora"),
|
utils.MediaFormatCombination("ogg", "vorbis", "theora"),
|
||||||
utils.MediaFormatCombination("webm", "vorbis", "vp8"),
|
utils.MediaFormatCombination("webm", "vorbis", "vp8"),
|
||||||
utils.MediaFormatCombination("mp4", "mp3", "h264"),
|
utils.MediaFormatCombination("mp4", "mp3", "h264"),
|
||||||
|
@ -59,7 +59,7 @@ def find_xges_duration(path):
|
||||||
class GESTest(GstValidateTest):
|
class GESTest(GstValidateTest):
|
||||||
def __init__(self, classname, options, reporter, project_uri, scenario=None,
|
def __init__(self, classname, options, reporter, project_uri, scenario=None,
|
||||||
combination=None):
|
combination=None):
|
||||||
super(GESTest, self).__init__(DEFAULT_GES_LAUNCH, classname, options, reporter,
|
super(GESTest, self).__init__(GES_LAUNCH_COMMAND, classname, options, reporter,
|
||||||
scenario=scenario)
|
scenario=scenario)
|
||||||
self.project_uri = project_uri
|
self.project_uri = project_uri
|
||||||
self.duration = find_xges_duration(utils.url2path(project_uri))
|
self.duration = find_xges_duration(utils.url2path(project_uri))
|
||||||
|
@ -162,7 +162,7 @@ class GESTestsManager(TestsManager):
|
||||||
|
|
||||||
def init(self):
|
def init(self):
|
||||||
try:
|
try:
|
||||||
if "--set-scenario=" in subprocess.check_output([DEFAULT_GES_LAUNCH, "--help"]):
|
if "--set-scenario=" in subprocess.check_output([GES_LAUNCH_COMMAND, "--help"]):
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
self.warning("Can not use ges-launch, it seems not to be compiled against"
|
self.warning("Can not use ges-launch, it seems not to be compiled against"
|
||||||
|
@ -224,7 +224,7 @@ class GESTestsManager(TestsManager):
|
||||||
)
|
)
|
||||||
|
|
||||||
# And now rendering casses
|
# And now rendering casses
|
||||||
for comb in COMBINATIONS:
|
for comb in GES_ENCODING_TARGET_COMBINATIONS:
|
||||||
classname = "ges.render.%s.%s" % (str(comb).replace(' ', '_'),
|
classname = "ges.render.%s.%s" % (str(comb).replace(' ', '_'),
|
||||||
os.path.splitext(os.path.basename(proj))[0])
|
os.path.splitext(os.path.basename(proj))[0])
|
||||||
self.add_test(GESRenderTest(classname, self.options,
|
self.add_test(GESRenderTest(classname, self.options,
|
||||||
|
|
|
@ -28,24 +28,25 @@ from utils import MediaFormatCombination, get_profile,\
|
||||||
compare_rendered_with_original
|
compare_rendered_with_original
|
||||||
|
|
||||||
|
|
||||||
DEFAULT_GST_VALIDATE = "gst-validate-1.0"
|
GST_VALIDATE_COMMAND = "gst-validate-1.0"
|
||||||
DEFAULT_GST_VALIDATE_TRANSCODING = "gst-validate-transcoding-1.0"
|
GST_VALIDATE_TRANSCODING_COMMAND = "gst-validate-transcoding-1.0"
|
||||||
DISCOVERER_COMMAND = "gst-validate-media-check-1.0 --discover-only"
|
G_V_DISCOVERER_COMMAND = "gst-validate-media-check-1.0 --discover-only"
|
||||||
|
|
||||||
MEDIA_INFO_EXT = "media_info"
|
G_V_MEDIA_INFO_EXT = "media_info"
|
||||||
STREAM_INFO = "stream_info"
|
G_V_STREAM_INFO_EXT = "stream_info"
|
||||||
|
|
||||||
SPECIAL_PROTOCOLS = [("application/x-hls", "hls")]
|
G_V_CAPS_TO_PROTOCOL = [("application/x-hls", "hls")]
|
||||||
|
|
||||||
PLAYBACK_TESTS = ["playbin uri=__uri__ audio_sink=autoaudiosink video_sink=autovideosink"]
|
G_V_PLAYBACK_TESTS = ["playbin uri=__uri__ audio_sink=autoaudiosink video_sink=autovideosink"]
|
||||||
COMBINATIONS = [
|
|
||||||
|
G_V_ENCODING_TARGET_COMBINATIONS = [
|
||||||
MediaFormatCombination("ogg", "vorbis", "theora"),
|
MediaFormatCombination("ogg", "vorbis", "theora"),
|
||||||
MediaFormatCombination("webm", "vorbis", "vp8"),
|
MediaFormatCombination("webm", "vorbis", "vp8"),
|
||||||
MediaFormatCombination("mp4", "mp3", "h264"),
|
MediaFormatCombination("mp4", "mp3", "h264"),
|
||||||
MediaFormatCombination("mkv", "vorbis", "h264")]
|
MediaFormatCombination("mkv", "vorbis", "h264")]
|
||||||
|
|
||||||
PROTOCOL_TIMEOUTS = {"http": 60,
|
G_V_PROTOCOL_TIMEOUTS = {"http": 60,
|
||||||
"hls": 60}
|
"hls": 60}
|
||||||
|
|
||||||
G_V_BLACKLISTED_TESTS = [("validate.hls.playback.fast_forward.*", "https://bugzilla.gnome.org/show_bug.cgi?id=698155"),
|
G_V_BLACKLISTED_TESTS = [("validate.hls.playback.fast_forward.*", "https://bugzilla.gnome.org/show_bug.cgi?id=698155"),
|
||||||
("validate.hls.playback.seek_with_stop.*", "https://bugzilla.gnome.org/show_bug.cgi?id=723268"),
|
("validate.hls.playback.seek_with_stop.*", "https://bugzilla.gnome.org/show_bug.cgi?id=723268"),
|
||||||
|
@ -77,16 +78,21 @@ G_V_SCENARIOS = {"file": [Scenario.get_scenario("play_15s"),
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
G_V_TIMEOUT_BY_PROTOCOL = {
|
||||||
|
"http": 60,
|
||||||
|
"hls": 120
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class GstValidateLaunchTest(GstValidateTest):
|
class GstValidateLaunchTest(GstValidateTest):
|
||||||
def __init__(self, classname, options, reporter, pipeline_desc,
|
def __init__(self, classname, options, reporter, pipeline_desc,
|
||||||
timeout=DEFAULT_TIMEOUT, scenario=None, file_infos=None):
|
timeout=DEFAULT_TIMEOUT, scenario=None, file_infos=None):
|
||||||
try:
|
try:
|
||||||
timeout = 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
|
||||||
|
|
||||||
super(GstValidateLaunchTest, self).__init__(DEFAULT_GST_VALIDATE, classname,
|
super(GstValidateLaunchTest, self).__init__(GST_VALIDATE_COMMAND, classname,
|
||||||
options, reporter,
|
options, reporter,
|
||||||
scenario=scenario,
|
scenario=scenario,
|
||||||
timeout=timeout)
|
timeout=timeout)
|
||||||
|
@ -104,7 +110,7 @@ class GstValidateLaunchTest(GstValidateTest):
|
||||||
|
|
||||||
class GstValidateMediaCheckTest(Test):
|
class GstValidateMediaCheckTest(Test):
|
||||||
def __init__(self, classname, options, reporter, media_info_path, uri, timeout=DEFAULT_TIMEOUT):
|
def __init__(self, classname, options, reporter, media_info_path, uri, timeout=DEFAULT_TIMEOUT):
|
||||||
super(GstValidateMediaCheckTest, self).__init__(DISCOVERER_COMMAND, classname,
|
super(GstValidateMediaCheckTest, self).__init__(G_V_DISCOVERER_COMMAND, classname,
|
||||||
options, reporter,
|
options, reporter,
|
||||||
timeout=timeout)
|
timeout=timeout)
|
||||||
self._uri = uri
|
self._uri = uri
|
||||||
|
@ -121,7 +127,7 @@ class GstValidateTranscodingTest(GstValidateTest):
|
||||||
scenario=Scenario.get_scenario("play_15s")):
|
scenario=Scenario.get_scenario("play_15s")):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
timeout = 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
|
||||||
|
|
||||||
|
@ -133,7 +139,7 @@ class GstValidateTranscodingTest(GstValidateTest):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
super(GstValidateTranscodingTest, self).__init__(
|
super(GstValidateTranscodingTest, self).__init__(
|
||||||
DEFAULT_GST_VALIDATE_TRANSCODING, classname,
|
GST_VALIDATE_TRANSCODING_COMMAND, classname,
|
||||||
options, reporter, scenario=scenario, timeout=timeout,
|
options, reporter, scenario=scenario, timeout=timeout,
|
||||||
hard_timeout=hard_timeout)
|
hard_timeout=hard_timeout)
|
||||||
|
|
||||||
|
@ -181,22 +187,18 @@ class GstValidateManager(TestsManager, Loggable):
|
||||||
self._uris = []
|
self._uris = []
|
||||||
|
|
||||||
def init(self):
|
def init(self):
|
||||||
if which(DEFAULT_GST_VALIDATE) and which(DEFAULT_GST_VALIDATE_TRANSCODING):
|
if which(GST_VALIDATE_COMMAND) and which(GST_VALIDATE_TRANSCODING_COMMAND):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def list_tests(self):
|
def list_tests(self):
|
||||||
for test_pipeline in PLAYBACK_TESTS:
|
for test_pipeline in G_V_PLAYBACK_TESTS:
|
||||||
self._add_playback_test(test_pipeline)
|
self._add_playback_test(test_pipeline)
|
||||||
|
|
||||||
TIMEOUT_BY_PROTOCOL = {
|
|
||||||
"http": 60,
|
|
||||||
"hls": 120
|
|
||||||
}
|
|
||||||
for uri, mediainfo in self._list_uris():
|
for uri, mediainfo in self._list_uris():
|
||||||
try:
|
try:
|
||||||
timeout = TIMEOUT_BY_PROTOCOL[mediainfo.config.get("file-info", "protocol")]
|
timeout = G_V_TIMEOUT_BY_PROTOCOL[mediainfo.config.get("file-info", "protocol")]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
timeout = DEFAULT_TIMEOUT
|
timeout = DEFAULT_TIMEOUT
|
||||||
|
|
||||||
|
@ -211,7 +213,7 @@ class GstValidateManager(TestsManager, Loggable):
|
||||||
for uri, mediainfo in self._list_uris():
|
for uri, mediainfo in self._list_uris():
|
||||||
if mediainfo.config.getboolean("media-info", "is-image") is True:
|
if mediainfo.config.getboolean("media-info", "is-image") is True:
|
||||||
continue
|
continue
|
||||||
for comb in COMBINATIONS:
|
for comb in G_V_ENCODING_TARGET_COMBINATIONS:
|
||||||
classname = "validate.%s.transcode.to_%s.%s" % (mediainfo.config.get("file-info", "protocol"),
|
classname = "validate.%s.transcode.to_%s.%s" % (mediainfo.config.get("file-info", "protocol"),
|
||||||
str(comb).replace(' ', '_'),
|
str(comb).replace(' ', '_'),
|
||||||
os.path.splitext(os.path.basename(uri))[0].replace(".", "_"))
|
os.path.splitext(os.path.basename(uri))[0].replace(".", "_"))
|
||||||
|
@ -234,7 +236,7 @@ class GstValidateManager(TestsManager, Loggable):
|
||||||
if uri is None:
|
if uri is None:
|
||||||
uri = config.get("file-info", "uri")
|
uri = config.get("file-info", "uri")
|
||||||
config.set("file-info", "protocol", urlparse.urlparse(uri).scheme)
|
config.set("file-info", "protocol", urlparse.urlparse(uri).scheme)
|
||||||
for caps2, prot in SPECIAL_PROTOCOLS:
|
for caps2, prot in G_V_CAPS_TO_PROTOCOL:
|
||||||
if caps2 == caps:
|
if caps2 == caps:
|
||||||
config.set("file-info", "protocol", prot)
|
config.set("file-info", "protocol", prot)
|
||||||
break
|
break
|
||||||
|
@ -247,13 +249,13 @@ class GstValidateManager(TestsManager, Loggable):
|
||||||
|
|
||||||
def _discover_file(self, uri, fpath):
|
def _discover_file(self, uri, fpath):
|
||||||
try:
|
try:
|
||||||
media_info = "%s.%s" % (fpath, MEDIA_INFO_EXT)
|
media_info = "%s.%s" % (fpath, G_V_MEDIA_INFO_EXT)
|
||||||
args = DISCOVERER_COMMAND.split(" ")
|
args = G_V_DISCOVERER_COMMAND.split(" ")
|
||||||
args.append(uri)
|
args.append(uri)
|
||||||
if os.path.isfile(media_info):
|
if os.path.isfile(media_info):
|
||||||
self._check_discovering_info(media_info, uri)
|
self._check_discovering_info(media_info, uri)
|
||||||
return True
|
return True
|
||||||
elif fpath.endswith(STREAM_INFO):
|
elif fpath.endswith(G_V_STREAM_INFO_EXT):
|
||||||
self._check_discovering_info(fpath)
|
self._check_discovering_info(fpath)
|
||||||
return True
|
return True
|
||||||
elif self.options.generate_info:
|
elif self.options.generate_info:
|
||||||
|
@ -282,7 +284,7 @@ class GstValidateManager(TestsManager, Loggable):
|
||||||
for root, dirs, files in os.walk(path):
|
for root, dirs, files in os.walk(path):
|
||||||
for f in files:
|
for f in files:
|
||||||
fpath = os.path.join(path, root, f)
|
fpath = os.path.join(path, root, f)
|
||||||
if os.path.isdir(fpath) or fpath.endswith(MEDIA_INFO_EXT):
|
if os.path.isdir(fpath) or fpath.endswith(G_V_MEDIA_INFO_EXT):
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
self._discover_file(path2url(fpath), fpath)
|
self._discover_file(path2url(fpath), fpath)
|
||||||
|
|
Loading…
Reference in a new issue