# 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
#
# 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
self._default_generators_registered = False
def init(self):
- if which(GST_VALIDATE_COMMAND) and which(GST_VALIDATE_TRANSCODING_COMMAND):
- return True
- return False
+ 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"
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
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:
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):
'-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()
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
# FIXME: make check work on windows
+getpluginsdir = find_program('getpluginsdir')
if host_machine.system() != 'windows'
subdir('check')
endif