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

Dylan Baker baker.dylan.c at gmail.com
Sun Aug 2 09:57:00 PDT 2015


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.

>      except subprocess.CalledProcessError as e:
>          if e.returncode == 1:
>              import contextlib
> --
> 2.1.4
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20150802/d1d80e7f/attachment-0001.html>


More information about the Piglit mailing list