runall.py: exclude tests/hubs/reactors that timeout a lot from the default setup unless --all option provided
This commit is contained in:
@@ -2,24 +2,30 @@
|
|||||||
"""Run tests for different configurations (hub/reactor)"""
|
"""Run tests for different configurations (hub/reactor)"""
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
import glob
|
|
||||||
import random
|
import random
|
||||||
|
from glob import glob
|
||||||
from optparse import OptionParser, Option
|
from optparse import OptionParser, Option
|
||||||
from copy import copy
|
from copy import copy
|
||||||
from with_eventlet import import_reactor
|
from with_eventlet import import_reactor
|
||||||
|
|
||||||
COMMAND = './record_results.py ./with_timeout.py ./with_eventlet.py %(setup)s %(test)s'
|
COMMAND = './record_results.py ./with_timeout.py ./with_eventlet.py %(setup)s %(test)s'
|
||||||
NOT_HUBS = ['hub', 'nginx']
|
|
||||||
|
# the following aren't in the default list unless --all option present
|
||||||
|
NOT_HUBS = set(['nginx'])
|
||||||
|
NOT_REACTORS = set(['wxreactor', 'glib2reactor', 'gtk2reactor'])
|
||||||
|
NOT_TESTS = set(['test_threading_green.py', 'httpc_test.py', 'httpd_test.py', 'wsgi_test.py'])
|
||||||
|
|
||||||
def w(s):
|
def w(s):
|
||||||
sys.stderr.write("%s\n" % (s, ))
|
sys.stderr.write("%s\n" % (s, ))
|
||||||
|
|
||||||
def enum_hubs():
|
def enum_hubs():
|
||||||
from eventlet.api import use_hub
|
from eventlet.api import use_hub
|
||||||
hubs = glob.glob('../eventlet/hubs/*.py')
|
hubs = glob('../eventlet/hubs/*.py')
|
||||||
hubs = [os.path.basename(h)[:-3] for h in hubs]
|
hubs = [os.path.basename(h)[:-3] for h in hubs]
|
||||||
hubs = [h for h in hubs if h[:1]!='_']
|
hubs = [h for h in hubs if h[:1]!='_']
|
||||||
hubs = set(hubs) - set(NOT_HUBS)
|
hubs = set(hubs)
|
||||||
|
hubs.discard('hub')
|
||||||
|
hubs -= NOT_HUBS
|
||||||
result = []
|
result = []
|
||||||
for hub in hubs:
|
for hub in hubs:
|
||||||
try:
|
try:
|
||||||
@@ -33,23 +39,25 @@ def enum_hubs():
|
|||||||
def enum_reactors():
|
def enum_reactors():
|
||||||
import twisted
|
import twisted
|
||||||
p = os.path.join(os.path.dirname(twisted.__file__), 'internet', '*?reactor.py')
|
p = os.path.join(os.path.dirname(twisted.__file__), 'internet', '*?reactor.py')
|
||||||
files = glob.glob(p)
|
files = glob(p)
|
||||||
reactors = []
|
all_reactors = [os.path.basename(f[:-3]) for f in files]
|
||||||
for f in files:
|
all_reactors = set(all_reactors) - NOT_REACTORS
|
||||||
reactor = os.path.basename(f[:-3])
|
selected_reactors = []
|
||||||
|
for reactor in all_reactors:
|
||||||
try:
|
try:
|
||||||
import_reactor(reactor)
|
import_reactor(reactor)
|
||||||
except Exception, ex:
|
except Exception, ex:
|
||||||
print 'Skipping reactor %s: %s' % (reactor, ex)
|
print 'Skipping reactor %s: %s' % (reactor, ex)
|
||||||
else:
|
else:
|
||||||
reactors.append(reactor)
|
selected_reactors.append(reactor)
|
||||||
return reactors
|
return selected_reactors
|
||||||
|
|
||||||
def enum_tests():
|
def enum_tests():
|
||||||
tests = []
|
tests = []
|
||||||
tests += glob.glob('test*_green.py')
|
tests += glob('test*_green.py')
|
||||||
tests += glob.glob('test__*.py')
|
tests += glob('test__*.py')
|
||||||
tests += glob.glob('*_test.py')
|
tests += glob('*_test.py')
|
||||||
|
tests = set(tests) - NOT_TESTS
|
||||||
return tests
|
return tests
|
||||||
|
|
||||||
def cmd(program):
|
def cmd(program):
|
||||||
@@ -69,15 +77,19 @@ class MyOption(Option):
|
|||||||
TYPE_CHECKER["stringlist"] = check_stringlist
|
TYPE_CHECKER["stringlist"] = check_stringlist
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
global NOT_HUBS, NOT_REACTORS, NOT_TESTS
|
||||||
parser = OptionParser(option_class=MyOption)
|
parser = OptionParser(option_class=MyOption)
|
||||||
parser.add_option('--hubs', type='stringlist')
|
parser.add_option('-u', '--hubs', type='stringlist')
|
||||||
parser.add_option('--reactors', type='stringlist')
|
parser.add_option('-r', '--reactors', type='stringlist')
|
||||||
parser.add_option('--tests', type='stringlist')
|
parser.add_option('-t', '--tests', type='stringlist')
|
||||||
parser.add_option('--ignore-hubs', type='stringlist', default=[])
|
parser.add_option('--ignore-hubs', type='stringlist', default=[])
|
||||||
parser.add_option('--ignore-reactors', type='stringlist', default=[])
|
parser.add_option('--ignore-reactors', type='stringlist', default=[])
|
||||||
parser.add_option('--ignore-tests', type='stringlist', default=[])
|
parser.add_option('--ignore-tests', type='stringlist', default=[])
|
||||||
parser.add_option('--show', help='show default values and exit', action='store_true', default=False)
|
parser.add_option('-s', '--show', help='show default values and exit', action='store_true', default=False)
|
||||||
|
parser.add_option('-a', '--all', action='store_true', default=False)
|
||||||
options, _args = parser.parse_args()
|
options, _args = parser.parse_args()
|
||||||
|
if options.all:
|
||||||
|
NOT_HUBS = NOT_REACTORS = NOT_TESTS = set()
|
||||||
if options.hubs is None:
|
if options.hubs is None:
|
||||||
options.hubs = enum_hubs()
|
options.hubs = enum_hubs()
|
||||||
if options.reactors is None:
|
if options.reactors is None:
|
||||||
|
Reference in New Issue
Block a user