validate: Add a way to use validate configs with scenarios
authorThibault Saunier <tsaunier@igalia.com>
Sun, 23 Jun 2019 17:03:54 +0000 (13:03 -0400)
committerThibault Saunier <tsaunier@igalia.com>
Fri, 5 Jul 2019 22:30:41 +0000 (18:30 -0400)
Config files should have the-scenario-name.scenario.config to be picked automatically

tests/validate/geslaunch.py
tools/ges-validate.c

index a6d2eae..d95fc36 100644 (file)
@@ -311,7 +311,7 @@ Available options:""")
 
     def register_defaults(self, project_paths=None, scenarios_path=None):
         projects = list()
-        all_scenarios = list()
+        all_scenarios = {}
         if not self.args:
             if project_paths == None:
                 path = self.options.projects_paths
@@ -332,7 +332,11 @@ Available options:""")
                     for f in files:
                         if not f.endswith(".scenario"):
                             continue
-                        all_scenarios.append(os.path.join(root, f))
+                        f = os.path.join(root, f)
+                        config = f + ".config"
+                        if not os.path.exists(config):
+                            config = None
+                        all_scenarios[f] = config
         else:
             for proj_uri in self.args:
                 if not utils.isuri(proj_uri):
@@ -387,9 +391,10 @@ Available options:""")
                                             combination=comb)
                                   )
         if all_scenarios:
-            for scenario in self._scenarios.discover_scenarios(all_scenarios):
+            for scenario in self._scenarios.discover_scenarios(list(all_scenarios.keys())):
+                config = all_scenarios[scenario.path]
                 classname = "scenario.%s" % scenario.name
-                self.add_test(GESScenarioTest(classname,
-                                            self.options,
-                                            self.reporter,
-                                            scenario=scenario))
\ No newline at end of file
+                test = GESScenarioTest(classname, self.options, self.reporter, scenario=scenario)
+                if config:
+                    test.add_validate_config(config)
+                self.add_test(test)
\ No newline at end of file
index dd755a7..d6c97a0 100644 (file)
@@ -61,7 +61,6 @@ bin_element_added (GstTracer * runner, GstClockTime ts,
   if (!monitor->is_decoder)
     return;
 
-
   parent = gst_object_get_parent (GST_OBJECT (element));
   do {
     if (GES_IS_TRACK (parent)) {