From d1411cfc6aebb2a578ccdfbe06d79d285c656b26 Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Fri, 13 Mar 2015 17:09:08 +0000 Subject: [PATCH] validate:launcher: Add a way to simply run validate default tests on uris Summary: This allows us to easily run all the scenarios on a particular file doing: $ gst-validate-launcher validate --validate-check-uri file:///some/media/file.webm Reviewers: Mathieu_Du Differential Revision: http://phabricator.freedesktop.org/D36 --- validate/launcher/apps/gstvalidate.py | 25 +++++++++++++++++++------ validate/launcher/baseclasses.py | 3 ++- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/validate/launcher/apps/gstvalidate.py b/validate/launcher/apps/gstvalidate.py index ee48a53..3779b5d 100644 --- a/validate/launcher/apps/gstvalidate.py +++ b/validate/launcher/apps/gstvalidate.py @@ -27,7 +27,7 @@ from launcher.loggable import Loggable from launcher.baseclasses import GstValidateTest, Test, \ ScenarioManager, NamedDic, GstValidateTestsGenerator, \ GstValidateMediaDescriptor, GstValidateEncodingTestInterface, \ - GstValidateBaseTestManager, MediaDescriptor + GstValidateBaseTestManager, MediaDescriptor, MediaFormatCombination from launcher.utils import path2url, DEFAULT_TIMEOUT, which, \ GST_SECOND, Result, Protocols, mkdir, printc, Colors @@ -221,7 +221,7 @@ class GstValidatePipelineTestsGenerator(GstValidateTestsGenerator): videosink = 'autovideosink' pipeline_desc = pipeline % {'videosink': videosink, - 'audiosink': audiosink} + 'audiosink': audiosink} fname = self.get_fname(scenario, protocol=mediainfo.get_protocol(), name=name) @@ -296,6 +296,9 @@ class GstValidateMixerTestsGenerator(GstValidatePipelineTestsGenerator): valid_scenarios=valid_scenarios) def populate_tests(self, uri_minfo_special_scenarios, scenarios): + if self.test_manager.options.validate_uris: + return + wanted_ressources = [] for uri, minfo, special_scenarios in uri_minfo_special_scenarios: protocol = minfo.media_descriptor.get_protocol() @@ -547,10 +550,12 @@ class GstValidateTestManager(GstValidateBaseTestManager): return False def add_options(self, parser): - parser.add_argument_group("GstValidate tools specific options" - " and behaviours", - description="""When using --wanted-tests, all the scenarios can be used, even those which have + group = parser.add_argument_group("GstValidate tools specific options" + " and behaviours", + description="""When using --wanted-tests, all the scenarios can be used, even those which have 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") def populate_testsuite(self): @@ -624,7 +629,7 @@ not been tested and explicitely activated if you set use --wanted-tests ALL""") elif fpath.endswith(GstValidateMediaDescriptor.STREAM_INFO_EXT): self._add_media(fpath) return True - elif not self.options.generate_info and not self.options.update_media_info: + elif not self.options.generate_info and not self.options.update_media_info and not self.options.validate_uris: return True elif self.options.update_media_info and not os.path.isfile(media_info): return True @@ -650,6 +655,11 @@ not been tested and explicitely activated if you set use --wanted-tests ALL""") if self._uris: return self._uris + if self.options.validate_uris: + for uri in self.options.validate_uris: + self._discover_file(uri, uri) + return self._uris + if not self.args: if isinstance(self.options.paths, str): self.options.paths = [os.path.join(self.options.paths)] @@ -692,6 +702,9 @@ not been tested and explicitely activated if you set use --wanted-tests ALL""") except ValueError: pass + if options.validate_uris: + self.check_testslist = False + super(GstValidateTestManager, self).set_settings( options, args, reporter) diff --git a/validate/launcher/baseclasses.py b/validate/launcher/baseclasses.py index 2ed74d5..709bfee 100644 --- a/validate/launcher/baseclasses.py +++ b/validate/launcher/baseclasses.py @@ -685,6 +685,7 @@ class TestsManager(Loggable): self.jobs = [] self.total_num_tests = 0 self.starting_test_num = 0 + self.check_testslist = True def init(self): return False @@ -1049,7 +1050,7 @@ class _TestsLauncher(Loggable): return False def _check_defined_tests(self, tester, tests): - if self.options.blacklisted_tests or self.options.wanted_tests: + if self.options.blacklisted_tests or self.options.wanted_tests and not self.check_testslist: return tests_names = [test.classname for test in tests] -- 2.7.4