From 2cf082c4bec9c699ac0f436531d24ee9cedfc74a Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Fri, 27 Feb 2015 23:20:43 +0000 Subject: [PATCH] validate:launcher: Set more env variable in the launcher command desc Summary: Adding if present: * LD_PRELOAD * DISPLAY * GST_VALIDATE_CONFIG * GST_VALIDATE_OVERRIDE + enhance the add_env_variable method to more easily set envvar from current value Reviewers: Mathieu_Du Differential Revision: http://phabricator.freedesktop.org/D78 --- validate/launcher/apps/gstvalidate.py | 1 + validate/launcher/baseclasses.py | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/validate/launcher/apps/gstvalidate.py b/validate/launcher/apps/gstvalidate.py index 3611e025ed..8cdfe43f53 100644 --- a/validate/launcher/apps/gstvalidate.py +++ b/validate/launcher/apps/gstvalidate.py @@ -410,6 +410,7 @@ class GstValidateMediaCheckTest(GstValidateTest): self._media_info_path = minfo_path def build_arguments(self): + Test.build_arguments(self) self.add_arguments(self._uri, "--expected-results", self._media_info_path) diff --git a/validate/launcher/baseclasses.py b/validate/launcher/baseclasses.py index 511a1b6b50..fa8dadb097 100644 --- a/validate/launcher/baseclasses.py +++ b/validate/launcher/baseclasses.py @@ -102,11 +102,17 @@ class Test(Loggable): return string - def add_env_variable(self, variable, value): + def add_env_variable(self, variable, value=None): """ Only usefull so that the gst-validate-launcher can print the exact right command line to reproduce the tests """ + if value is None: + value = os.environ.get(variable, None) + + if value is None: + return + if self._env_variable: self._env_variable += " " self._env_variable += "%s=%s" % (variable, value) @@ -160,7 +166,8 @@ class Test(Loggable): self.command += " " + arg def build_arguments(self): - pass + self.add_env_variable("LD_PRELOAD") + self.add_env_variable("DISPLAY") def set_result(self, result, message="", error=""): self.debug("Setting result: %s (message: %s, error: %s)" % (result, @@ -455,6 +462,7 @@ class GstValidateTest(Test): self._sent_eos_pos = None def build_arguments(self): + super(GstValidateTest, self).build_arguments() if "GST_VALIDATE" in os.environ: self.add_env_variable("GST_VALIDATE", os.environ["GST_VALIDATE"]) @@ -466,8 +474,8 @@ class GstValidateTest(Test): self.add_env_variable("GST_VALIDATE_SCENARIO", os.environ["GST_VALIDATE_SCENARIO"]) - if "LD_PRELOAD" in os.environ: - self.add_env_variable("LD_PRELOAD", os.environ["LD_PRELOAD"]) + self.add_env_variable("GST_VALIDATE_CONFIG") + self.add_env_variable("GST_VALIDATE_OVERRIDE") def get_extra_log_content(self, extralog): value = Test.get_extra_log_content(self, extralog)