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