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
INCLUDE_DIRS = [ d for d in os.getenv('INCLUDE', '').split(os.pathsep) if d ]
CFLAGS = os.getenv('CFLAGS', '').split()
BACKENDS = ['c', 'cpp']
def memoize(f):
uncomputed = object()
f._cache = {}
......@@ -1248,12 +1250,15 @@ def main():
help="do not run the Cython compiler, only the C compiler")
parser.add_option("--compiler", dest="compiler", default=None,
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",
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",
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",
action="store_false", default=True,
help="do not run the unit tests")
......@@ -1402,8 +1407,6 @@ def main():
if WITH_CYTHON and options.language_level == 3:
sys.stderr.write("Using Cython language level 3.\n")
sys.stderr.write("\n")
test_bugs = False
if options.tickets:
for ticket_number in options.tickets:
......@@ -1438,11 +1441,23 @@ def main():
global COMPILER
if options.compiler:
COMPILER = options.compiler
languages = []
if options.use_c:
languages.append('c')
if options.use_cpp:
languages.append('cpp')
selected_backends = [ name.strip() for name in options.backends.split(',') if name.strip() ]
backends = []
for backend in selected_backends:
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()
......
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