[Piglit] [PATCH 7/9] framework/exectest.py: move more stuff from run to get_command_result
Ilia Mirkin
imirkin at alum.mit.edu
Wed Apr 9 18:54:27 PDT 2014
On Wed, Apr 9, 2014 at 9:27 PM, Dylan Baker <baker.dylan.c at gmail.com> wrote:
> This patch completely removes argument for Test.get_command_result.
> command was just a copy of self.command, just use self.command
> fullenv was based on self.env and is only used as an argument for
> get_command_result, so there's no reason to pass it as an argument,
> instead compute it inside of get_command_result.
> ---
> framework/exectest.py | 14 ++++++--------
> 1 file changed, 6 insertions(+), 8 deletions(-)
>
> diff --git a/framework/exectest.py b/framework/exectest.py
> index b83536a..72061e0 100644
> --- a/framework/exectest.py
> +++ b/framework/exectest.py
> @@ -138,10 +138,6 @@ class Test(object):
> * For 'returncode', the value will be the numeric exit code/value.
> * For 'command', the value will be command line program and arguments.
> """
> - fullenv = os.environ.copy()
> - for e in self.env:
> - fullenv[e] = str(self.env[e])
> -
> if self.command is not None:
> command = self.command
>
> @@ -157,8 +153,7 @@ class Test(object):
> err = ""
> returncode = None
> else:
> - out, err, returncode = self.get_command_result(command,
> - fullenv)
> + out, err, returncode = self.get_command_result()
What about the valgrind thing?
>
> # https://bugzilla.gnome.org/show_bug.cgi?id=680214 is
> # affecting many developers. If we catch it
> @@ -237,9 +232,12 @@ class Test(object):
> """
> return False
>
> - def get_command_result(self, command, fullenv):
> + def get_command_result(self):
> + fullenv = os.environ.copy()
> + fullenv.update({k: str(v) for k, v in self.env.iteritems()})
Did we move to python3 already? I thought things still ran on python2.
(And in fact, I've had trouble getting it to run with python3, but
perhaps you're working on that.)
> +
> try:
> - proc = subprocess.Popen(command,
> + proc = subprocess.Popen(self.command,
> stdout=subprocess.PIPE,
> stderr=subprocess.PIPE,
> env=fullenv,
> --
> 1.9.1
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
More information about the Piglit
mailing list