diff --git a/greentest/runall.py b/greentest/runall.py index 012022b..dc6cfbf 100755 --- a/greentest/runall.py +++ b/greentest/runall.py @@ -2,24 +2,30 @@ """Run tests for different configurations (hub/reactor)""" import sys import os -import glob import random +from glob import glob from optparse import OptionParser, Option from copy import copy from with_eventlet import import_reactor 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): sys.stderr.write("%s\n" % (s, )) def enum_hubs(): 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 = [h for h in hubs if h[:1]!='_'] - hubs = set(hubs) - set(NOT_HUBS) + hubs = set(hubs) + hubs.discard('hub') + hubs -= NOT_HUBS result = [] for hub in hubs: try: @@ -33,23 +39,25 @@ def enum_hubs(): def enum_reactors(): import twisted p = os.path.join(os.path.dirname(twisted.__file__), 'internet', '*?reactor.py') - files = glob.glob(p) - reactors = [] - for f in files: - reactor = os.path.basename(f[:-3]) + files = glob(p) + all_reactors = [os.path.basename(f[:-3]) for f in files] + all_reactors = set(all_reactors) - NOT_REACTORS + selected_reactors = [] + for reactor in all_reactors: try: import_reactor(reactor) except Exception, ex: print 'Skipping reactor %s: %s' % (reactor, ex) else: - reactors.append(reactor) - return reactors + selected_reactors.append(reactor) + return selected_reactors def enum_tests(): tests = [] - tests += glob.glob('test*_green.py') - tests += glob.glob('test__*.py') - tests += glob.glob('*_test.py') + tests += glob('test*_green.py') + tests += glob('test__*.py') + tests += glob('*_test.py') + tests = set(tests) - NOT_TESTS return tests def cmd(program): @@ -69,15 +77,19 @@ class MyOption(Option): TYPE_CHECKER["stringlist"] = check_stringlist def main(): + global NOT_HUBS, NOT_REACTORS, NOT_TESTS parser = OptionParser(option_class=MyOption) - parser.add_option('--hubs', type='stringlist') - parser.add_option('--reactors', type='stringlist') - parser.add_option('--tests', type='stringlist') + parser.add_option('-u', '--hubs', type='stringlist') + parser.add_option('-r', '--reactors', type='stringlist') + parser.add_option('-t', '--tests', type='stringlist') parser.add_option('--ignore-hubs', type='stringlist', default=[]) parser.add_option('--ignore-reactors', 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() + if options.all: + NOT_HUBS = NOT_REACTORS = NOT_TESTS = set() if options.hubs is None: options.hubs = enum_hubs() if options.reactors is None: