[Piglit] [PATCH] xz: Use --help when detecting xz presence

Dylan Baker baker.dylan.c at gmail.com
Mon Aug 3 13:58:31 PDT 2015


On Sun, Aug 02, 2015 at 12:32:29PM -0700, Jordan Justen wrote:
> On 2015-08-02 09:57:00, Dylan Baker wrote:
> >    On Aug 2, 2015 00:45, "Jordan Justen" <jordan.l.justen at intel.com> wrote:
> >    >
> >    > If xz is present, and the piglit command's output is redirected, then
> >    > xz will think its output is redirected. This will cause xz to try to
> >    > read data from stdin to compress.
> >    >
> >    > Instead we can run xz with --help to cause it to print help
> >    > information if the xz executable is present, and prevent xz from
> >    > trying to compress data from stdin.
> >    >
> >    > Since we don't want to see 'xz --help' output from piglit, we now need
> >    > to redirect both stdout and stderr to /dev/null.
> >    >
> >    > Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
> >    > Cc: Dylan Baker <baker.dylan.c at gmail.com>
> >    > ---
> >    >  framework/backends/compression.py | 2 +-
> >    >  1 file changed, 1 insertion(+), 1 deletion(-)
> >    >
> >    > diff --git a/framework/backends/compression.py
> >    b/framework/backends/compression.py
> >    > index 88bde2a..97b0f32 100644
> >    > --- a/framework/backends/compression.py
> >    > +++ b/framework/backends/compression.py
> >    > @@ -95,7 +95,7 @@ try:
> >    >  except ImportError:
> >    >      try:
> >    >          with open(os.devnull, 'w') as d:
> >    > -            subprocess.check_call(['xz'], stderr=d)
> >    > +            subprocess.check_call(['xz', '--help'], stdout=d,
> >    stderr=subprocess.STDOUT)
> > 
> >    Based on you're commit message I don't think this sides what you want. I
> >    think you should set stderr=d to hide both stderr and stdout.
> 
> stderr=subprocess.STDOUT should send stderr to the same file as
> stdout, and stdout is sent to /dev/null.
> 
> -Jordan

I think it would be clearer to direct both directly to /dev/null.
With that change:
Reviewed-by: Dylan Baker <baker.dylan.c at gmail.com>

> 
> > 
> >    >      except subprocess.CalledProcessError as e:
> >    >          if e.returncode == 1:
> >    >              import contextlib
> >    > --
> >    > 2.1.4
> >    >
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20150803/851ae0fc/attachment.sig>


More information about the Piglit mailing list