Commit 87a575a7 authored by Stefan Behnel's avatar Stefan Behnel

allow opt-in option '--backends=...' in test runner instead of requiring opt-out '--no-...' options

parent ca43ebff
...@@ -204,6 +204,8 @@ COMPILER = None ...@@ -204,6 +204,8 @@ COMPILER = None
INCLUDE_DIRS = [ d for d in os.getenv('INCLUDE', '').split(os.pathsep) if d ] INCLUDE_DIRS = [ d for d in os.getenv('INCLUDE', '').split(os.pathsep) if d ]
CFLAGS = os.getenv('CFLAGS', '').split() CFLAGS = os.getenv('CFLAGS', '').split()
BACKENDS = ['c', 'cpp']
def memoize(f): def memoize(f):
uncomputed = object() uncomputed = object()
f._cache = {} f._cache = {}
...@@ -1248,12 +1250,15 @@ def main(): ...@@ -1248,12 +1250,15 @@ def main():
help="do not run the Cython compiler, only the C compiler") help="do not run the Cython compiler, only the C compiler")
parser.add_option("--compiler", dest="compiler", default=None, parser.add_option("--compiler", dest="compiler", default=None,
help="C compiler type") help="C compiler type")
backend_list = ','.join(BACKENDS)
parser.add_option("--backends", dest="backends", default=backend_list,
help="select backends to test (default: %s)" % backend_list)
parser.add_option("--no-c", dest="use_c", parser.add_option("--no-c", dest="use_c",
action="store_false", default=True, action="store_false", default=True,
help="do not test C compilation") help="do not test C compilation backend")
parser.add_option("--no-cpp", dest="use_cpp", parser.add_option("--no-cpp", dest="use_cpp",
action="store_false", default=True, action="store_false", default=True,
help="do not test C++ compilation") help="do not test C++ compilation backend")
parser.add_option("--no-unit", dest="unittests", parser.add_option("--no-unit", dest="unittests",
action="store_false", default=True, action="store_false", default=True,
help="do not run the unit tests") help="do not run the unit tests")
...@@ -1402,8 +1407,6 @@ def main(): ...@@ -1402,8 +1407,6 @@ def main():
if WITH_CYTHON and options.language_level == 3: if WITH_CYTHON and options.language_level == 3:
sys.stderr.write("Using Cython language level 3.\n") sys.stderr.write("Using Cython language level 3.\n")
sys.stderr.write("\n")
test_bugs = False test_bugs = False
if options.tickets: if options.tickets:
for ticket_number in options.tickets: for ticket_number in options.tickets:
...@@ -1438,11 +1441,23 @@ def main(): ...@@ -1438,11 +1441,23 @@ def main():
global COMPILER global COMPILER
if options.compiler: if options.compiler:
COMPILER = options.compiler COMPILER = options.compiler
languages = []
if options.use_c: selected_backends = [ name.strip() for name in options.backends.split(',') if name.strip() ]
languages.append('c') backends = []
if options.use_cpp: for backend in selected_backends:
languages.append('cpp') if backend == 'c' and not options.use_c:
continue
elif backend == 'cpp' and not options.use_cpp:
continue
elif backend not in BACKENDS:
sys.stderr.write("Unknown backend requested: '%s' not one of [%s]\n" % (
backend, ','.join(BACKENDS)))
sys.exit(1)
backends.append(backend)
sys.stderr.write("Backends: %s\n" % ','.join(backends))
languages = backends
sys.stderr.write("\n")
test_suite = unittest.TestSuite() test_suite = unittest.TestSuite()
......
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