Commit 4c2ba9fe authored by Alexandru Băluț's avatar Alexandru Băluț

validate: Allow running the integration tests with make validate

Had to pass the path to the `bin/pitivi` executable from `runtests`
because `__file__` in `pitivivalidate.py` was returning the value for
gst-validate-launcher's `baseclasses.py`.
Reviewed-by: Thibault Saunier's avatarThibault Saunier <tsaunier@gnome.org>
Differential Revision: https://phabricator.freedesktop.org/D1425
parent 13b0a02e
......@@ -536,6 +536,7 @@ class PitiviFlatpak: # pylint: disable=too-many-instance-attributes
("GST_PRESET_PATH",
"/app/share/gstreamer-1.0/presets/:/app/share/pitivi/gstpresets/"),
"GST_VALIDATE",
"GST_VALIDATE_APPS_DIR",
"GST_VALIDATE_LAUNCHER_DEBUG",
"GTK_DEBUG",
"GTK_THEME",
......
......@@ -18,6 +18,9 @@ install:
check:
\tcd %(build_dir)s && %(ninja)s test
validate:
\tcd %(build_dir)s && %(ninja)s validate
dist:
\tcd %(build_dir)s && %(ninja)s dist
......
......@@ -72,6 +72,7 @@ if not get_option('disable-help')
subdir('help')
endif
subdir('tests')
subdir('tests/validate-tests')
archiver = find_program('git-archive-all', required : false)
if archiver.found()
......
......@@ -38,6 +38,6 @@ if runtests.found()
args = args + ['--plugin', 'nose2.plugins.junitxml', '--config', meson.current_build_dir() + '/' + xunitfile + '.cfg']
endif
test(i.get(0), runtests, args: args + ['tests.' + i.get(1)])
test(i.get(0), runtests, args : args + ['tests.' + i.get(1)])
endforeach
endif
\ No newline at end of file
gstvalidate = find_program('gst-validate-launcher', required : false)
if gstvalidate.found()
run_target('validate', command : [meson.current_source_dir() + '/runtests'])
endif
......@@ -17,9 +17,7 @@
# License along with this program; if not, write to the
# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301, USA.
"""
The GES GstValidate default testsuite
"""
"""The Pitivi GstValidate testsuite."""
import os
......@@ -27,10 +25,10 @@ TEST_MANAGER = "pitivi"
def setup_tests(test_manager, options):
print("Setting up Pitivi default tests")
options.pitivi_scenario_paths = [os.path.join(os.path.abspath(os.path.join(os.path.dirname(__file__))),
"scenarios")]
options.add_paths(os.path.abspath(os.path.join(os.path.dirname(__file__),
"..", "samples")))
path = os.path.abspath(os.path.dirname(__file__))
print("Setting up Pitivi integration tests in %s" % path)
options.pitivi_scenario_paths = [os.path.join(path, "scenarios")]
options.add_paths(os.path.join(path, os.path.pardir, "samples"))
options.pitivi_executable = os.path.join(path, "..", "..", "bin", "pitivi")
test_manager.register_defaults()
return True
......@@ -18,7 +18,6 @@
# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301, USA.
import os
import sys
from urllib import unquote
import urlparse
......@@ -29,10 +28,6 @@ from baseclasses import TestsManager
Pitivi_DURATION_TOLERANCE = utils.GST_SECOND / 2
PITIVI_COMMAND = "pitivi"
if "win32" in sys.platform:
PITIVI_COMMAND += ".exe"
def quote_uri(uri):
"""
......@@ -47,9 +42,8 @@ def quote_uri(uri):
class PitiviTest(GstValidateTest):
def __init__(self, classname, options, reporter, scenario,
combination=None):
super(PitiviTest, self).__init__(PITIVI_COMMAND, classname, options, reporter,
def __init__(self, executable, classname, options, reporter, scenario):
super(PitiviTest, self).__init__(executable, classname, options, reporter,
scenario=None)
self._scenario = scenario
......@@ -88,10 +82,10 @@ class PitiviTestsManager(TestsManager):
group = parser.add_argument_group("Pitivi specific option group"
" and behaviours",
description="")
group.add_argument("--pitivi-executable", dest="pitivi_executable",
default=os.path.join("..", "..", "bin", "pitivi"),
help="Path to the pitivi executable")
group.add_argument("--pitivi-scenarios-paths", dest="pitivi_scenario_paths",
default=os.path.join(os.path.basename(__file__),
"pitivi",
"pitivi scenarios"),
help="Paths in which to look for scenario files")
def set_settings(self, options, args, reporter):
......@@ -106,23 +100,23 @@ class PitiviTestsManager(TestsManager):
def list_tests(self):
return self.tests
def register_defaults(self):
scenarios = list()
def find_scenarios(self):
for path in self.options.pitivi_scenario_paths:
for root, dirs, files in os.walk(path):
for f in files:
if not f.endswith(".scenario"):
for file in files:
if not file.endswith(".scenario"):
continue
scenarios.append(os.path.join(path, root, f))
yield os.path.join(path, root, file)
for scenario_name in scenarios:
def register_defaults(self):
for scenario_name in self.find_scenarios():
scenario = self._scenarios.get_scenario(scenario_name)
if scenario is None:
continue
classname = "pitivi.%s" % (scenario.name)
self.add_test(PitiviTest(classname,
classname = "pitivi.%s" % scenario.name
self.add_test(PitiviTest(self.options.pitivi_executable,
classname,
self.options,
self.reporter,
scenario=scenario)
)
scenario=scenario))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment