Commit 871c77e2 authored by Denis Bilenko's avatar Denis Bilenko

Merge pull request #432 from surfly/known_failures.py

list of known failures as a python script
parents 2110fe41 5d8dd0fb
......@@ -53,9 +53,9 @@ travistest:
${PYTHON} setup.py install
cd greentest && GEVENT_RESOLVER=thread ${PYTHON} testrunner.py --expected ../known_failures.txt
cd greentest && GEVENT_RESOLVER=ares GEVENTARES_SERVERS=8.8.8.8 ${PYTHON} testrunner.py --expected ../known_failures.txt --ignore tests_that_dont_use_resolver.txt
cd greentest && GEVENT_FILE=thread ${PYTHON} testrunner.py --expected ../known_failures.txt `grep -l subprocess test_*.py`
cd greentest && GEVENT_RESOLVER=thread ${PYTHON} testrunner.py --config ../known_failures.py
cd greentest && GEVENT_RESOLVER=ares GEVENTARES_SERVERS=8.8.8.8 ${PYTHON} testrunner.py --config ../known_failures.py --ignore tests_that_dont_use_resolver.txt
cd greentest && GEVENT_FILE=thread ${PYTHON} testrunner.py --config ../known_failures.py `grep -l subprocess test_*.py`
travis:
make whitespace
......
......@@ -149,17 +149,21 @@ def main():
parser.add_option('--ignore')
parser.add_option('--discover', action='store_true')
parser.add_option('--full', action='store_true')
parser.add_option('--expected')
parser.add_option('--config')
parser.add_option('--failfast', action='store_true')
options, args = parser.parse_args()
options.expected = load_list_from_file(options.expected)
FAILING_TESTS = []
if options.config:
config = {}
six.exec_(open(options.config).read(), config)
FAILING_TESTS = config['FAILING_TESTS']
tests = discover(args, options.ignore)
if options.discover:
for cmd, options in tests:
print(util.getname(cmd, env=options.get('env'), setenv=options.get('setenv')))
print('%s tests found.' % len(tests))
else:
run_many(tests, expected=options.expected, failfast=options.failfast)
run_many(tests, expected=FAILING_TESTS, failfast=options.failfast)
if __name__ == '__main__':
......
import sys
import os
import re
import six
import traceback
import unittest
......@@ -203,114 +202,9 @@ def run(command, **kwargs):
return RunResult(result, out, name)
def parse_command(parts):
if isinstance(parts, six.string_types):
parts = parts.split()
environ = []
if parts[0] == '-':
del parts[0]
elif parts[0] == '*':
del parts[0]
environ = None
elif '=' in parts[0]:
while parts[0].count('='):
environ.append(parts[0])
del parts[0]
exe = parts[0]
del parts[0]
if exe == '*':
exe = None
else:
assert exe
assert not exe.startswith('-'), repr(exe)
return environ, exe, parts
def parse_line(line):
"""
>>> parse_line("* - /usr/bin/python -u test.py")
(None, [], '/usr/bin/python', ['-u', 'test.py'])
>>> parse_line("win32 * C:\\Python27\\python.exe -u -m monkey_test --Event test_subprocess.py")
('win32', None, 'C:\\\\Python27\\\\python.exe', ['-u', '-m', 'monkey_test', '--Event', 'test_subprocess.py'])
>>> parse_line("* GEVENTARES_SERVERS=8.8.8.8 GEVENT_RESOLVER=ares * -u test__socket_dns.py")
(None, ['GEVENTARES_SERVERS=8.8.8.8', 'GEVENT_RESOLVER=ares'], None, ['-u', 'test__socket_dns.py'])
"""
parts = line.split()
if len(parts) < 4:
raise ValueError('Expected "platform environ executable arguments", got %r' % line)
platform = parts[0]
if platform == '*':
platform = None
return (platform, ) + parse_command(parts[1:])
def match_word(pattern, word):
if isinstance(pattern, str) and isinstance(word, str) and '(' in pattern or '*' in pattern or '?' in pattern or '[' in pattern:
return re.match(pattern, word)
return pattern == word
def match_environ(expected_environ, actual_environ):
"""
>>> match_environ('GEVENT_RESOLVER=ares GEVENTARES_SERVERS=8.8.8.8',
... 'GEVENT_RESOLVER=ares GEVENTARES_SERVERS=8.8.8.8 GEVENT_FILE=thread')
True
>>> match_environ('GEVENT_RESOLVER=ares GEVENTARES_SERVERS=8.8.8.7',
... 'GEVENT_RESOLVER=ares GEVENTARES_SERVERS=8.8.8.8 GEVENT_FILE=thread')
False
>>> match_environ('GEVENT_RESOLVER=ares GEVENTARES_SERVERS=8.8.8.8 GEVENT_FILE=',
... 'GEVENT_RESOLVER=ares GEVENTARES_SERVERS=8.8.8.8 GEVENT_FILE=thread')
False
"""
if expected_environ is None:
return True
if isinstance(expected_environ, six.string_types):
expected_environ = expected_environ.split()
if isinstance(actual_environ, six.string_types):
actual_environ = actual_environ.split()
expected_environ = dict(x.split('=') for x in expected_environ)
actual_environ = dict(x.split('=') for x in actual_environ)
for key, expected_value in expected_environ.items():
value = actual_environ.pop(key, None)
if value is not None and value != expected_value:
return False
return True
def match_line(line, command):
expected_platform, expected_environ, expected_exe, expected_arguments = parse_line(line)
if expected_platform is not None and expected_platform != sys.platform:
return
environ, exe, arguments = parse_command(command)
if not match_environ(expected_environ, environ):
return
if expected_exe is not None and not match_word(expected_exe, exe):
return
return expected_arguments == arguments
def matches(expected, command):
"""
>>> matches(["* * C:\Python27\python.exe -u -m monkey_test --Event test_threading.py"],
... "C:\Python27\python.exe -u -m monkey_test --Event test_threading.py")
True
>>> matches(['* * /usr/bin/python2.5(-dbg)? -u -m monkey_test --Event test_urllib2net.py'],
... "/usr/bin/python2.5-dbg -u -m monkey_test --Event test_urllib2net.py")
True
>>> matches(['* * /usr/bin/python2.5(-dbg)? -u -m monkey_test --Event test_urllib2net.py'],
... "/usr/bin/python2.5 -u -m monkey_test --Event test_urllib2net.py")
True
>>> matches(['* * /usr/bin/python2.5(-dbg)? -u -m monkey_test --Event test_urllib2net.py'],
... "/usr/bin/python2.6 -u -m monkey_test --Event test_urllib2net.py")
False
>>> matches(['* GEVENT_RESOLVER=ares GEVENTARES_SERVERS=8.8.8.8 python -u test__subprocess.py'],
... "GEVENT_RESOLVER=ares GEVENTARES_SERVERS=8.8.8.8 GEVENT_FILE=thread python -u test__subprocess.py")
True
"""
for line in expected:
if match_line(line, command):
if command.endswith(' ' + line):
return True
return False
......
# This is a list of known failures (=bugs).
import os
import sys
CPYTHON_DBG = hasattr(sys, 'gettotalrefcount')
PYPY = hasattr(sys, 'pypy_version_info')
FAILING_TESTS = [
# needs investigating
'test__issue6.py',
# bunch of SSLError: [Errno 1] _ssl.c:504: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
# seems to be Python/OpenSSL problem, not gevent's
'monkey_test --Event test_ssl.py',
'monkey_test test_ssl.py',
]
if os.environ.get('GEVENT_RESOLVER') == 'ares':
# XXX fix this
FAILING_TESTS += [
'test__socket_dns.py',
'test__socket_dns6.py',
]
if sys.platform == 'win32':
# currently gevent.core.stat watcher does not implement 'prev' and 'attr' attributes on Windows
FAILING_TESTS += ['test__core_stat.py']
# other Windows-related issues (need investigating)
FAILING_TESTS += [
'monkey_test test_threading.py',
'monkey_test --Event test_threading.py',
'monkey_test test_subprocess.py',
'monkey_test --Event test_subprocess.py'
]
if CPYTHON_DBG:
FAILING_TESTS += ['test__backdoor.py']
if PYPY:
# stat watchers are not implemented on pypy
FAILING_TESTS += ['test__core_stat.py']
if __name__ == '__main__':
import pprint
pprint.pprint(FAILING_TESTS)
# This is a list of known failures (=bugs).
# format: platform environ executable arguments
# A star ("*") can be used instead of platform, environ or executable (means "any").
* GEVENTARES_SERVERS=8.8.8.8 GEVENT_RESOLVER=ares * -u test__socket_dns.py
* GEVENTARES_SERVERS=8.8.8.8 GEVENT_RESOLVER=ares * -u test__socket_dns6.py
# currently gevent.core.stat watcher does not implement 'prev' and 'attr' attributes on Windows
win32 * C:\Python27\python.exe -u test__core_stat.py
# other Windows-related issues (need investigating)
win32 * C:\Python27\python.exe -u -m monkey_test test_threading.py
win32 * C:\Python27\python.exe -u -m monkey_test --Event test_threading.py
win32 * C:\Python27\python.exe -u -m monkey_test test_subprocess.py
win32 * C:\Python27\python.exe -u -m monkey_test --Event test_subprocess.py
# these need investigating:
* * * -u test__issue6.py
# bunch of SSLError: [Errno 1] _ssl.c:504: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
# seems to be Python/OpenSSL problem, not gevent's
* * * -u -m monkey_test --Event test_ssl.py
* * * -u -m monkey_test test_ssl.py
* * /usr/bin/python2.[67]-dbg -u test__backdoor.py
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment