Pillow/winbuild/test.py

45 lines
1.5 KiB
Python
Raw 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
from config import *
def test_one(params):
python, architecture = params
try:
print ("Running: %s, %s" %params)
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'))
2014-04-05 01:57:18 +04:00
proc = subprocess.Popen(command,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE)
(trace, stderr) = proc.communicate()
status = proc.returncode
2014-04-05 01:57:18 +04:00
print ("Done with %s, %s -- %s" % (python, architecture, status ))
return (python, architecture, status, trace)
except Exception as msg:
print ("Error with %s, %s: %s" % (python, architecture, msg))
return (python, architecture, -1, str(msg))
if __name__=='__main__':
os.chdir('..')
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:
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)