intel/compiler tests: rewrite subprocess handling in run-test.py

`subprocess.Popen()` returns immediately, and the subprocess might not
have finished by the time `stdout` is read on the next line, spuriously
failing the tests.

`subprocess.check_output()` makes sure the output is available before
returning, solving this issue; it additionally raises an error if the
subprocess failed, giving a better error than a failed diff later in the
script.

cc: mesa-stable

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34756>
This commit is contained in:
Eric Engestrom 2025-04-29 17:48:51 +02:00 committed by Marge Bot
parent 60796c85d1
commit de6ab1beda
2 changed files with 4 additions and 8 deletions

View file

@ -48,10 +48,8 @@ for asm_file in args.gen_folder.glob('*.asm'):
'--gen', args.gen_name,
asm_file
]
with subprocess.Popen(command,
stdout=subprocess.PIPE,
stderr=subprocess.DEVNULL) as cmd:
lines_after = [line.decode('ascii') for line in cmd.stdout.readlines()]
stdout = subprocess.check_output(command, timeout=1).decode()
lines_after = stdout.splitlines(keepends=True)
except OSError as e:
if e.errno == errno.ENOEXEC:
print('Skipping due to inability to run host binaries.',

View file

@ -48,10 +48,8 @@ for asm_file in args.gen_folder.glob('*.asm'):
'--gen', args.gen_name,
asm_file
]
with subprocess.Popen(command,
stdout=subprocess.PIPE,
stderr=subprocess.DEVNULL) as cmd:
lines_after = [line.decode('ascii') for line in cmd.stdout.readlines()]
stdout = subprocess.check_output(command, timeout=1).decode()
lines_after = stdout.splitlines(keepends=True)
except OSError as e:
if e.errno == errno.ENOEXEC:
print('Skipping due to inability to run host binaries.',