From 4722491124ea84b62761abe0bb6745da03ab7f6e Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sat, 12 Sep 2020 08:53:52 -0700 Subject: [PATCH] glsl/tests: Make the tests skip on Android binary execution failures. We don't have a suitable exe wrapper for running them, and the missing linker is throwing return code 255 instead of an ENOEXEC. Catch it and return skip from the tests. Reviewed-by: Kristian H. Kristensen Part-of: --- src/compiler/glsl/glcpp/tests/glcpp_test.py | 4 ++++ src/compiler/glsl/tests/optimization_test.py | 5 +++++ src/compiler/glsl/tests/warnings_test.py | 14 +++++++++++--- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/compiler/glsl/glcpp/tests/glcpp_test.py b/src/compiler/glsl/glcpp/tests/glcpp_test.py index c11a7c2105b..457bf823612 100644 --- a/src/compiler/glsl/glcpp/tests/glcpp_test.py +++ b/src/compiler/glsl/glcpp/tests/glcpp_test.py @@ -76,6 +76,10 @@ def test_output(glcpp, filename, expfile, nl_format='\n'): actual, _ = proc.communicate(f.read()) actual = actual.decode('utf-8') + if proc.returncode == 255: + print("Test returned general error, possibly missing linker") + sys.exit(77) + with open(expfile, 'r') as f: expected = f.read() diff --git a/src/compiler/glsl/tests/optimization_test.py b/src/compiler/glsl/tests/optimization_test.py index a413370a5e7..06627283474 100644 --- a/src/compiler/glsl/tests/optimization_test.py +++ b/src/compiler/glsl/tests/optimization_test.py @@ -92,6 +92,11 @@ def main(): out, err = proc.communicate(source.encode('utf-8')) out = out.decode('utf-8') err = err.decode('utf-8') + + if proc.returncode == 255: + print("Test returned general error, possibly missing linker") + sys.exit(77) + if err: print('FAIL') print('Unexpected output on stderr: {}'.format(err), diff --git a/src/compiler/glsl/tests/warnings_test.py b/src/compiler/glsl/tests/warnings_test.py index e587bc9ba2d..61a1413b917 100644 --- a/src/compiler/glsl/tests/warnings_test.py +++ b/src/compiler/glsl/tests/warnings_test.py @@ -74,9 +74,17 @@ def main(): with open('{}.expected'.format(file), 'rb') as f: expected = f.read().splitlines() - actual = subprocess.check_output( - runner + ['--just-log', '--version', '150', file] - ).splitlines() + proc= subprocess.run( + runner + ['--just-log', '--version', '150', file], + stdout=subprocess.PIPE + ) + if proc.returncode == 255: + print("Test returned general error, possibly missing linker") + sys.exit(77) + elif proc.returncode != 0: + print("Test returned error: {}, output:\n{}\n".format(proc.returncode, proc.stdout)) + + actual = proc.stdout.splitlines() if actual == expected: print('PASS')