mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-01 21:18:52 +00:00
validate:launcher: Cleanup the way we find where -validate tools are
This commit is contained in:
parent
c1f89b4acb
commit
b00ab02254
2 changed files with 27 additions and 27 deletions
|
@ -48,15 +48,7 @@ parser.add_argument("--validate-tools-path", dest="validate_tools_path",
|
||||||
help="defines the paths to look for GstValidate tools.")
|
help="defines the paths to look for GstValidate tools.")
|
||||||
options, args = parser.parse_known_args()
|
options, args = parser.parse_known_args()
|
||||||
|
|
||||||
GST_VALIDATE_COMMAND = which("gst-validate-1.0", options.validate_tools_path)
|
GstValidateBaseTestManager.update_commands(options.validate_tools_path)
|
||||||
GST_VALIDATE_TRANSCODING_COMMAND = which("gst-validate-transcoding-1.0",
|
|
||||||
options.validate_tools_path)
|
|
||||||
G_V_DISCOVERER_COMMAND = which("gst-validate-media-check-1.0",
|
|
||||||
options.validate_tools_path)
|
|
||||||
GST_VALIDATE_RTSP_SERVER_COMMAND = which("gst-validate-rtsp-server-1.0",
|
|
||||||
options.validate_tools_path)
|
|
||||||
|
|
||||||
ScenarioManager.GST_VALIDATE_COMMAND = GST_VALIDATE_COMMAND
|
|
||||||
AUDIO_ONLY_FILE_TRANSCODING_RATIO = 5
|
AUDIO_ONLY_FILE_TRANSCODING_RATIO = 5
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -283,10 +275,10 @@ class GstValidatePlaybinTestsGenerator(GstValidatePipelineTestsGenerator):
|
||||||
os.path.basename(minfo.media_descriptor.get_clean_name()))
|
os.path.basename(minfo.media_descriptor.get_clean_name()))
|
||||||
|
|
||||||
def populate_tests(self, uri_minfo_special_scenarios, scenarios):
|
def populate_tests(self, uri_minfo_special_scenarios, scenarios):
|
||||||
test_rtsp = GST_VALIDATE_RTSP_SERVER_COMMAND
|
test_rtsp = GstValidateBaseTestManager.RTSP_SERVER_COMMAND
|
||||||
if not test_rtsp:
|
if not test_rtsp:
|
||||||
printc("\n\nRTSP server not available, you should make sure"
|
printc("\n\nRTSP server not available, you should make sure"
|
||||||
" that %s is available in your $PATH." % GST_VALIDATE_RTSP_SERVER_COMMAND,
|
" that %s is available in your $PATH." % GstValidateBaseTestManager.RTSP_SERVER_COMMAND,
|
||||||
Colors.FAIL)
|
Colors.FAIL)
|
||||||
elif self.test_manager.options.disable_rtsp:
|
elif self.test_manager.options.disable_rtsp:
|
||||||
printc("\n\nRTSP tests are disabled")
|
printc("\n\nRTSP tests are disabled")
|
||||||
|
@ -446,7 +438,8 @@ class GstValidateLaunchTest(GstValidateTest):
|
||||||
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__(GstValidateBaseTestManager.COMMAND,
|
||||||
|
classname,
|
||||||
options, reporter,
|
options, reporter,
|
||||||
duration=duration,
|
duration=duration,
|
||||||
scenario=scenario,
|
scenario=scenario,
|
||||||
|
@ -476,7 +469,7 @@ class GstValidateMediaCheckTest(GstValidateTest):
|
||||||
extra_env_variables = extra_env_variables or {}
|
extra_env_variables = extra_env_variables or {}
|
||||||
|
|
||||||
super(
|
super(
|
||||||
GstValidateMediaCheckTest, self).__init__(G_V_DISCOVERER_COMMAND, classname,
|
GstValidateMediaCheckTest, self).__init__(GstValidateBaseTestManager.MEDIA_CHECK_COMMAND, classname,
|
||||||
options, reporter,
|
options, reporter,
|
||||||
timeout=timeout,
|
timeout=timeout,
|
||||||
media_descriptor=media_descriptor,
|
media_descriptor=media_descriptor,
|
||||||
|
@ -513,7 +506,7 @@ class GstValidateTranscodingTest(GstValidateTest, GstValidateEncodingTestInterfa
|
||||||
duration = file_dur
|
duration = file_dur
|
||||||
|
|
||||||
super(
|
super(
|
||||||
GstValidateTranscodingTest, self).__init__(GST_VALIDATE_TRANSCODING_COMMAND,
|
GstValidateTranscodingTest, self).__init__(GstValidateBaseTestManager.TRANSCODING_COMMAND,
|
||||||
classname,
|
classname,
|
||||||
options,
|
options,
|
||||||
reporter,
|
reporter,
|
||||||
|
@ -617,7 +610,7 @@ class GstValidateBaseRTSPTest:
|
||||||
self.rtspserver_logs = sys.stderr
|
self.rtspserver_logs = sys.stderr
|
||||||
|
|
||||||
self.server_port = self.__get_open_port()
|
self.server_port = self.__get_open_port()
|
||||||
command = [GST_VALIDATE_RTSP_SERVER_COMMAND, self._local_uri, '--port', str(self.server_port)]
|
command = [GstValidateBaseTestManager.RTSP_SERVER_COMMAND, self._local_uri, '--port', str(self.server_port)]
|
||||||
|
|
||||||
if self.options.validate_gdb_server:
|
if self.options.validate_gdb_server:
|
||||||
command = self.use_gdb(command)
|
command = self.use_gdb(command)
|
||||||
|
@ -724,9 +717,9 @@ class GstValidateTestManager(GstValidateBaseTestManager):
|
||||||
|
|
||||||
def init(self):
|
def init(self):
|
||||||
for command, name in [
|
for command, name in [
|
||||||
(GST_VALIDATE_TRANSCODING_COMMAND, "gst-validate-1.0"),
|
(GstValidateBaseTestManager.TRANSCODING_COMMAND, "gst-validate-1.0"),
|
||||||
(GST_VALIDATE_COMMAND, "gst-validate-transcoding-1.0"),
|
(GstValidateBaseTestManager.COMMAND, "gst-validate-transcoding-1.0"),
|
||||||
(G_V_DISCOVERER_COMMAND, "gst-validate-media-check-1.0")]:
|
(GstValidateBaseTestManager.MEDIA_CHECK_COMMAND, "gst-validate-media-check-1.0")]:
|
||||||
if not command:
|
if not command:
|
||||||
self.error("%s not found" % command)
|
self.error("%s not found" % command)
|
||||||
return False
|
return False
|
||||||
|
@ -840,7 +833,7 @@ not been tested and explicitely activated if you set use --wanted-tests ALL""")
|
||||||
try:
|
try:
|
||||||
media_info = "%s.%s" % (
|
media_info = "%s.%s" % (
|
||||||
fpath, GstValidateMediaDescriptor.MEDIA_INFO_EXT)
|
fpath, GstValidateMediaDescriptor.MEDIA_INFO_EXT)
|
||||||
args = G_V_DISCOVERER_COMMAND.split(" ")
|
args = GstValidateBaseTestManager.MEDIA_CHECK_COMMAND.split(" ")
|
||||||
args.append(uri)
|
args.append(uri)
|
||||||
if os.path.isfile(media_info) and not self.options.update_media_info:
|
if os.path.isfile(media_info) and not self.options.update_media_info:
|
||||||
self._add_media(media_info, uri)
|
self._add_media(media_info, uri)
|
||||||
|
|
|
@ -39,6 +39,7 @@ import xml
|
||||||
import random
|
import random
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
|
from .utils import which
|
||||||
from . import reporters
|
from . import reporters
|
||||||
from . import loggable
|
from . import loggable
|
||||||
from .loggable import Loggable
|
from .loggable import Loggable
|
||||||
|
@ -1023,7 +1024,7 @@ class GstValidateEncodingTestInterface(object):
|
||||||
""" % (reference_file_uri, self.dest_file)
|
""" % (reference_file_uri, self.dest_file)
|
||||||
pipeline_desc = pipeline_desc.replace("\n", "")
|
pipeline_desc = pipeline_desc.replace("\n", "")
|
||||||
|
|
||||||
command = [ScenarioManager.GST_VALIDATE_COMMAND] + \
|
command = [GstValidateBaseTestManager.COMMAND] + \
|
||||||
shlex.split(pipeline_desc)
|
shlex.split(pipeline_desc)
|
||||||
if not self.options.redirect_logs:
|
if not self.options.redirect_logs:
|
||||||
self.out.write(
|
self.out.write(
|
||||||
|
@ -1854,7 +1855,6 @@ class ScenarioManager(Loggable):
|
||||||
all_scenarios = []
|
all_scenarios = []
|
||||||
|
|
||||||
FILE_EXTENSION = "scenario"
|
FILE_EXTENSION = "scenario"
|
||||||
GST_VALIDATE_COMMAND = ""
|
|
||||||
|
|
||||||
def __new__(cls, *args, **kwargs):
|
def __new__(cls, *args, **kwargs):
|
||||||
if not cls._instance:
|
if not cls._instance:
|
||||||
|
@ -1890,7 +1890,7 @@ class ScenarioManager(Loggable):
|
||||||
"scenarios_discovery.log"), 'w')
|
"scenarios_discovery.log"), 'w')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
command = [self.GST_VALIDATE_COMMAND,
|
command = [GstValidateBaseTestManager.COMMAND,
|
||||||
"--scenarios-defs-output-file", scenario_defs]
|
"--scenarios-defs-output-file", scenario_defs]
|
||||||
command.extend(scenario_paths)
|
command.extend(scenario_paths)
|
||||||
subprocess.check_call(command, stdout=logs, stderr=logs)
|
subprocess.check_call(command, stdout=logs, stderr=logs)
|
||||||
|
@ -1954,6 +1954,14 @@ class GstValidateBaseTestManager(TestsManager):
|
||||||
self._scenarios = []
|
self._scenarios = []
|
||||||
self._encoding_formats = []
|
self._encoding_formats = []
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def update_commands(cls, extra_paths=None):
|
||||||
|
for varname, cmd in {'': 'gst-validate',
|
||||||
|
'TRANSCODING_': 'gst-validate-transcoding',
|
||||||
|
'MEDIA_CHECK_': 'gst-validate-media-check',
|
||||||
|
'RTSP_SERVER_': 'gst-validate-rtsp-server'}.items():
|
||||||
|
setattr(cls, varname + 'COMMAND', which(cmd + '-1.0', extra_paths))
|
||||||
|
|
||||||
def add_scenarios(self, scenarios):
|
def add_scenarios(self, scenarios):
|
||||||
"""
|
"""
|
||||||
@scenarios A list or a unic scenario name(s) to be run on the tests.
|
@scenarios A list or a unic scenario name(s) to be run on the tests.
|
||||||
|
@ -1997,6 +2005,9 @@ class GstValidateBaseTestManager(TestsManager):
|
||||||
return self._encoding_formats
|
return self._encoding_formats
|
||||||
|
|
||||||
|
|
||||||
|
GstValidateBaseTestManager.update_commands()
|
||||||
|
|
||||||
|
|
||||||
class MediaDescriptor(Loggable):
|
class MediaDescriptor(Loggable):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -2092,10 +2103,6 @@ class GstValidateMediaDescriptor(MediaDescriptor):
|
||||||
MEDIA_INFO_EXT = "media_info"
|
MEDIA_INFO_EXT = "media_info"
|
||||||
STREAM_INFO_EXT = "stream_info"
|
STREAM_INFO_EXT = "stream_info"
|
||||||
|
|
||||||
DISCOVERER_COMMAND = "gst-validate-media-check-1.0"
|
|
||||||
if "win32" in sys.platform:
|
|
||||||
DISCOVERER_COMMAND += ".exe"
|
|
||||||
|
|
||||||
def __init__(self, xml_path):
|
def __init__(self, xml_path):
|
||||||
super(GstValidateMediaDescriptor, self).__init__()
|
super(GstValidateMediaDescriptor, self).__init__()
|
||||||
|
|
||||||
|
@ -2159,7 +2166,7 @@ class GstValidateMediaDescriptor(MediaDescriptor):
|
||||||
else:
|
else:
|
||||||
include_frames = bool(include_frames)
|
include_frames = bool(include_frames)
|
||||||
|
|
||||||
args = GstValidateMediaDescriptor.DISCOVERER_COMMAND.split(" ")
|
args = GstValidateBaseTestManager.MEDIA_CHECK_COMMAND.split(" ")
|
||||||
args.append(uri)
|
args.append(uri)
|
||||||
|
|
||||||
args.extend(["--output-file", descriptor_path])
|
args.extend(["--output-file", descriptor_path])
|
||||||
|
|
Loading…
Reference in a new issue