Mesa (staging/20.3): intel/tools: Use subprocess.Popen to read output directly from a pipe
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Mar 19 22:19:57 UTC 2021
Module: Mesa
Branch: staging/20.3
Commit: 8e300244d9fc87c7f8b512a57eaa46a614e0a555
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=8e300244d9fc87c7f8b512a57eaa46a614e0a555
Author: Michel Dänzer <mdaenzer at redhat.com>
Date: Fri Mar 5 17:49:03 2021 +0100
intel/tools: Use subprocess.Popen to read output directly from a pipe
Instead of using tempfiles to communicate between child & parent
process. The latter sometimes resulted in hitting the meson timeout if
there was high filesystem pressure.
Fixes: ccaa5b034f48 "intel/tools: rewrite run-test.sh in python"
Reviewed-by: Dylan Baker <dylan.c.baker at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9528>
(cherry picked from commit 05bf12ccb6f290c701ef5b84a7c46e7818bf2c3e)
---
.pick_status.json | 2 +-
src/intel/tools/tests/run-test.py | 11 ++++-------
2 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/.pick_status.json b/.pick_status.json
index b493743ad33..1af45035f6e 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -427,7 +427,7 @@
"description": "intel/tools: Use subprocess.Popen to read output directly from a pipe",
"nominated": true,
"nomination_type": 1,
- "resolution": 0,
+ "resolution": 1,
"master_sha": null,
"because_sha": "ccaa5b034f4845672e22c4bb990a8272a16da15e"
},
diff --git a/src/intel/tools/tests/run-test.py b/src/intel/tools/tests/run-test.py
index 1dfa305661d..221c991bdb9 100755
--- a/src/intel/tools/tests/run-test.py
+++ b/src/intel/tools/tests/run-test.py
@@ -7,7 +7,6 @@ import os
import pathlib
import subprocess
import sys
-import tempfile
# The meson version handles windows paths better, but if it's not available
# fall back to shlex
@@ -37,18 +36,17 @@ success = True
for asm_file in args.gen_folder.glob('*.asm'):
expected_file = asm_file.stem + '.expected'
expected_path = args.gen_folder / expected_file
- out_path = tempfile.NamedTemporaryFile()
try:
command = i965_asm + [
'--type', 'hex',
'--gen', args.gen_name,
- '--output', out_path.name,
asm_file
]
- subprocess.run(command,
- stdout=subprocess.DEVNULL,
- stderr=subprocess.STDOUT)
+ with subprocess.Popen(command,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.DEVNULL) as cmd:
+ lines_after = [line.decode('ascii') for line in cmd.stdout.readlines()]
except OSError as e:
if e.errno == errno.ENOEXEC:
print('Skipping due to inability to run host binaries.',
@@ -58,7 +56,6 @@ for asm_file in args.gen_folder.glob('*.asm'):
with expected_path.open() as f:
lines_before = f.readlines()
- lines_after = [line.decode('ascii') for line in out_path]
diff = ''.join(difflib.unified_diff(lines_before, lines_after,
expected_file, asm_file.stem + '.out'))
More information about the mesa-commit
mailing list