[Piglit] [PATCH 7/9] framework/exectest.py: move more stuff from run to get_command_result

Dylan Baker baker.dylan.c at gmail.com
Wed Apr 9 19:50:44 PDT 2014


On Wednesday, April 09, 2014 09:54:27 PM Ilia Mirkin wrote:
> 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?

crap, I had a patch for that, but it doesn't work because of module dependency 
looping (core imports exectest which imports core...). I will just pull this 
patch until I can get that sorted, that's another series.

> 
> >                  # 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.)

No we never did move the python3, dict comprehensions were added to 2.7; but 
that breaks 2.6. Like I said I'll send a V2 without this patch tomorrow.

> 
> > +
> > 
> >          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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20140409/9d40c86c/attachment-0001.sig>


More information about the Piglit mailing list