glsl/tests: Use exit code 126 to detect valgrind errors

valgrind returns exit code 126 if it can't write to the file passed to
--log-file. Hopefully it'll be the same for any other invalid valgrind
command line parameters or internal errors as well.

Using a different exit code (31) for this was hiding the fact that the
valgrind test wasn't actually working.

v2:
* Use exit code 126; can't treat any non-0 exit code as failure because
  glcpp is expected to exit with non-0 for some of the input we feed it

Reviewed-by: Dylan Baker <dylan.c.baker@intel.com> # v1
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9528>
This commit is contained in:
Michel Dänzer
2021-03-06 00:24:09 +01:00
committed by Marge Bot
parent 4cc8c25d56
commit 7fedf51b95

View File

@@ -96,12 +96,12 @@ def _valgrind(glcpp, filename):
extra_args = parse_test_file(contents, nl_format='\n')
proc = subprocess.Popen(
['valgrind', '--error-exitcode=31'] + glcpp + extra_args,
['valgrind', '--error-exitcode=126'] + glcpp + extra_args,
stdout=subprocess.DEVNULL,
stderr=subprocess.PIPE,
stdin=subprocess.PIPE)
_, errors = proc.communicate(contents)
if proc.returncode != 31:
if proc.returncode != 126:
return (True, [])
return (False, errors.decode('utf-8'))