Pillow/winbuild/test.py

47 lines
1.5 KiB
Python
Raw Permalink Normal View History

2014-04-05 01:57:18 +04:00
#!/usr/bin/env python3
import subprocess
import os
import glob
import sys
2014-04-05 01:57:18 +04:00
2015-06-26 10:39:13 +03:00
from config import pythons, VIRT_BASE, X64_EXT
2014-04-05 01:57:18 +04:00
2015-06-20 06:43:14 +03:00
2014-04-05 01:57:18 +04:00
def test_one(params):
python, architecture = params
try:
2015-06-20 06:43:14 +03:00
print("Running: %s, %s" % params)
2015-06-26 10:39:13 +03:00
command = [r'%s\%s%s\Scripts\python.exe' %
(VIRT_BASE, python, architecture),
2014-08-23 08:35:01 +04:00
'test-installed.py',
'--processes=-0',
'--process-timeout=30',
]
command.extend(glob.glob('Tests/test*.py'))
2015-06-20 06:43:14 +03:00
proc = subprocess.Popen(command,
2014-04-05 01:57:18 +04:00
stdin=subprocess.PIPE,
stdout=subprocess.PIPE)
(trace, stderr) = proc.communicate()
status = proc.returncode
2015-06-20 06:43:14 +03:00
print("Done with %s, %s -- %s" % (python, architecture, status))
2014-04-05 01:57:18 +04:00
return (python, architecture, status, trace)
except Exception as msg:
2015-06-20 06:43:14 +03:00
print("Error with %s, %s: %s" % (python, architecture, msg))
2014-04-05 01:57:18 +04:00
return (python, architecture, -1, str(msg))
2015-06-20 06:43:14 +03:00
if __name__ == '__main__':
2014-04-05 01:57:18 +04:00
os.chdir('..')
2015-06-20 06:43:14 +03:00
matrix = [(python, architecture) for python in pythons
for architecture in ('', X64_EXT)]
results = map(test_one, matrix)
2014-04-05 01:57:18 +04:00
for (python, architecture, status, trace) in results:
2015-06-20 06:43:14 +03:00
print("%s%s: %s" % (python, architecture, status and 'ERR' or 'PASS'))
2014-04-05 01:57:18 +04:00
res = all(status for (python, architecture, status, trace) in results)
sys.exit(res)