from __future__ import print_function
import argparse
import difflib
+import errno
+import os
import subprocess
import sys
return difflib.unified_diff(expected.splitlines(), actual.splitlines())
+def get_test_runner(runner):
+ """Wrap the test runner in the exe wrapper if necessary."""
+ wrapper = os.environ.get('MESON_EXE_WRAPPER', None)
+ if wrapper is None:
+ return [runner]
+ return [wrapper, runner]
+
+
def main():
"""Generate each test and report pass or fail."""
args = arg_parser()
total = 0
passes = 0
+ runner = get_test_runner(args.test_runner)
+
for gen in lower_jump_cases.CASES:
for name, opt, source, expected in gen():
total += 1
print('{}: '.format(name), end='')
proc = subprocess.Popen(
- [args.test_runner, 'optpass', '--quiet', '--input-ir', opt],
+ runner + ['optpass', '--quiet', '--input-ir', opt],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
stdin=subprocess.PIPE)
if __name__ == '__main__':
- main()
+ try:
+ main()
+ except OSError as e:
+ if e.errno == errno.ENOEXEC:
+ print('Skipping due to lack of exe_wrapper.', file=sys.stderr)
+ sys.exit(77)
+ else:
+ raise
from __future__ import print_function
import argparse
+import errno
import os
import subprocess
+import sys
def arg_parser():
return parser.parse_args()
+def get_test_runner(runner):
+ """Wrap the test runner in the exe wrapper if necessary."""
+ wrapper = os.environ.get('MESON_EXE_WRAPPER', None)
+ if wrapper is None:
+ return [runner]
+ return [wrapper, runner]
+
+
def main():
args = arg_parser()
files = [f for f in os.listdir(args.test_directory) if f.endswith('.vert')]
print('Could not find any tests')
exit(1)
+ runner = get_test_runner(args.glsl_compiler)
+
print('====== Testing compilation output ======')
for file in files:
print('Testing {} ...'.format(file), end='')
expected = f.read().strip()
actual = subprocess.check_output(
- [args.glsl_compiler, '--just-log', '--version', '150', file]
+ runner + ['--just-log', '--version', '150', file]
).strip()
if actual == expected:
if __name__ == '__main__':
- main()
+ try:
+ main()
+ except OSError as e:
+ if e.errno == errno.ENOEXEC:
+ print('Skipping due to lack of exe_wrapper.', file=sys.stderr)
+ sys.exit(77)
+ else:
+ raise