mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 01:00:37 +00:00
meson:validate:test: Properly set paths to run launcher based tests
Adding a --validate-tools-path option to the launcher, allowing to pass it from meson.
This commit is contained in:
parent
3cbaae3090
commit
9c9fe14293
7 changed files with 53 additions and 25 deletions
|
@ -16,8 +16,8 @@
|
|||
# License along with this program; if not, write to the
|
||||
# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
# Boston, MA 02110-1301, USA.
|
||||
import argparse
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
import urlparse
|
||||
import subprocess
|
||||
|
@ -37,13 +37,16 @@ from launcher.utils import path2url, url2path, DEFAULT_TIMEOUT, which, \
|
|||
#
|
||||
|
||||
# definitions of commands to use
|
||||
GST_VALIDATE_COMMAND = "gst-validate-1.0"
|
||||
GST_VALIDATE_TRANSCODING_COMMAND = "gst-validate-transcoding-1.0"
|
||||
G_V_DISCOVERER_COMMAND = "gst-validate-media-check-1.0"
|
||||
if "win32" in sys.platform:
|
||||
GST_VALIDATE_COMMAND += ".exe"
|
||||
GST_VALIDATE_TRANSCODING_COMMAND += ".exe"
|
||||
G_V_DISCOVERER_COMMAND += ".exe"
|
||||
parser = argparse.ArgumentParser(add_help=False)
|
||||
parser.add_argument("--validate-tools-path", dest="validate_tools_path",
|
||||
default="",
|
||||
help="defines the paths to look for GstValidate tools.")
|
||||
options, args = parser.parse_known_args()
|
||||
|
||||
GST_VALIDATE_COMMAND = which("gst-validate-1.0", 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)
|
||||
ScenarioManager.GST_VALIDATE_COMMAND = GST_VALIDATE_COMMAND
|
||||
|
||||
AUDIO_ONLY_FILE_TRANSCODING_RATIO = 5
|
||||
|
||||
|
@ -555,10 +558,16 @@ class GstValidateTestManager(GstValidateBaseTestManager):
|
|||
self._default_generators_registered = False
|
||||
|
||||
def init(self):
|
||||
if which(GST_VALIDATE_COMMAND) and which(GST_VALIDATE_TRANSCODING_COMMAND):
|
||||
return True
|
||||
for command, name in [
|
||||
(GST_VALIDATE_TRANSCODING_COMMAND, "gst-validate-1.0"),
|
||||
(GST_VALIDATE_COMMAND, "gst-validate-transcoding-1.0"),
|
||||
(G_V_DISCOVERER_COMMAND, "gst-validate-media-check-1.0")]:
|
||||
if not command:
|
||||
self.error("%s not found" % command)
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
def add_options(self, parser):
|
||||
group = parser.add_argument_group("GstValidate tools specific options"
|
||||
" and behaviours",
|
||||
|
@ -566,6 +575,8 @@ class GstValidateTestManager(GstValidateBaseTestManager):
|
|||
not been tested and explicitely activated if you set use --wanted-tests ALL""")
|
||||
group.add_argument("--validate-check-uri", dest="validate_uris",
|
||||
action="append", help="defines the uris to run default tests on")
|
||||
group.add_argument("--validate-tools-path", dest="validate_tools_path",
|
||||
action="append", help="defines the paths to look for GstValidate tools.")
|
||||
|
||||
def print_valgrind_bugs(self):
|
||||
# Look for all the 'pending' bugs in our supp file
|
||||
|
|
|
@ -1519,9 +1519,7 @@ class ScenarioManager(Loggable):
|
|||
all_scenarios = []
|
||||
|
||||
FILE_EXTENSION = "scenario"
|
||||
GST_VALIDATE_COMMAND = "gst-validate-1.0"
|
||||
if "win32" in sys.platform:
|
||||
GST_VALIDATE_COMMAND += ".exe"
|
||||
GST_VALIDATE_COMMAND = ""
|
||||
|
||||
def __new__(cls, *args, **kwargs):
|
||||
if not cls._instance:
|
||||
|
|
|
@ -85,21 +85,23 @@ def mkdir(directory):
|
|||
pass
|
||||
|
||||
|
||||
def which(name):
|
||||
result = []
|
||||
def which(name, extra_path=None):
|
||||
exts = filter(None, os.environ.get('PATHEXT', '').split(os.pathsep))
|
||||
path = os.environ.get('PATH', None)
|
||||
if path is None:
|
||||
path = os.environ.get('PATH', '')
|
||||
if extra_path:
|
||||
path = extra_path + os.pathsep + path
|
||||
if not path:
|
||||
return []
|
||||
for p in os.environ.get('PATH', '').split(os.pathsep):
|
||||
|
||||
for p in path.split(os.pathsep):
|
||||
p = os.path.join(p, name)
|
||||
if os.access(p, os.X_OK):
|
||||
result.append(p)
|
||||
return p
|
||||
for e in exts:
|
||||
pext = p + e
|
||||
if os.access(pext, os.X_OK):
|
||||
result.append(pext)
|
||||
return result
|
||||
return pext
|
||||
return None
|
||||
|
||||
|
||||
def get_color_for_result(result):
|
||||
|
|
|
@ -14,7 +14,6 @@ test_defines = [
|
|||
'-DGST_USE_UNSTABLE_API',
|
||||
]
|
||||
|
||||
getpluginsdir = find_program('getpluginsdir')
|
||||
runcmd = run_command(getpluginsdir, 'gstreamer', 'gstreamer-' + apiversion)
|
||||
if runcmd.returncode() == 0
|
||||
needed_plugins_dirs = runcmd.stdout().strip()
|
||||
|
|
|
@ -1,9 +1,26 @@
|
|||
launcher = find_program(meson.build_root() + '/validate/tools/gst-validate-launcher',
|
||||
required : false)
|
||||
|
||||
runcmd = run_command(getpluginsdir, 'gstreamer', 'gstreamer-' + apiversion,
|
||||
'gst-plugins-base', 'gst-plugins-base-' + apiversion)
|
||||
if runcmd.returncode() == 0
|
||||
needed_plugins_dirs = runcmd.stdout().strip()
|
||||
message('Using GStreamer plug-ins in ' + needed_plugins_dirs)
|
||||
else
|
||||
error('Could not determine GStreamer plugins directory for unit tests.')
|
||||
endif
|
||||
|
||||
test_env = [
|
||||
'GST_PLUGIN_SYSTEM_PATH_1_0=',
|
||||
'GST_PLUGIN_PATH_1_0=' + needed_plugins_dirs,
|
||||
'GST_PLUGIN_SCANNER_1_0='+ meson.build_root() + '/libs/gst/helpers/gst-plugin-scanner',
|
||||
]
|
||||
|
||||
if launcher.found()
|
||||
test_name = 'launcher_tests'
|
||||
test(test_name, launcher, args: ['-o', meson.build_root() + '/validate-launcher-output/',
|
||||
meson.current_source_dir() + '/test_validate.py'],
|
||||
env: ['GST_REGISTRY=@0@/@1@.registry'.format(meson.current_build_dir(), test_name)])
|
||||
meson.current_source_dir() + '/test_validate.py', '--validate-tools-path',
|
||||
meson.build_root() + '/validate/tools/'],
|
||||
env: ['GST_REGISTRY=@0@/@1@.registry'.format(meson.current_build_dir(), test_name)] +
|
||||
test_env)
|
||||
endif
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# FIXME: make check work on windows
|
||||
getpluginsdir = find_program('getpluginsdir')
|
||||
if host_machine.system() != 'windows'
|
||||
subdir('check')
|
||||
endif
|
||||
|
|
Loading…
Reference in a new issue