From: Dag Sverre Seljebotn Date: Wed, 7 Jan 2009 12:05:54 +0000 (+0100) Subject: Added --refnanny option to runtests.py X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=fd6fcfbe7ad789d677add32583053ec1cb958625;p=cython.git Added --refnanny option to runtests.py --- diff --git a/runtests.py b/runtests.py index 1e7ef958..e955d6e9 100644 --- a/runtests.py +++ b/runtests.py @@ -26,11 +26,6 @@ VER_DEP_MODULES = { INCLUDE_DIRS = [ d for d in os.getenv('INCLUDE', '').split(os.pathsep) if d ] CFLAGS = os.getenv('CFLAGS', '').split() -ctypes.PyDLL("Cython/Runtime/refnanny.so", mode=ctypes.RTLD_GLOBAL) -sys.path.append("Cython/Runtime") -import refnanny -#CFLAGS.append("-DCYTHON_REFNANNY") - class ErrorWriter(object): match_error = re.compile('(warning:)?(?:.*:)?\s*([-0-9]+)\s*:\s*([-0-9]+)\s*:\s*(.*)').match def __init__(self): @@ -475,6 +470,9 @@ if __name__ == '__main__': parser.add_option("--cython-only", dest="cython_only", action="store_true", default=False, help="only compile pyx to c, do not run C compiler or run the tests") + parser.add_option("--refnanny", dest="with_refnanny", + action="store_true", default=False, + help="also test that Cython-generated code does correct reference counting") parser.add_option("--sys-pyregr", dest="system_pyregr", action="store_true", default=False, help="run the regression tests of the CPython installation") @@ -518,6 +516,13 @@ if __name__ == '__main__': from Cython.Compiler import Errors Errors.LEVEL = 0 # show all warnings + if options.with_refnanny: + ctypes.PyDLL("Cython/Runtime/refnanny.so", mode=ctypes.RTLD_GLOBAL) + sys.path.append("Cython/Runtime") + import refnanny + del sys.path[-1] + CFLAGS.append("-DCYTHON_REFNANNY") + # RUN ALL TESTS! ROOTDIR = os.path.join(os.getcwd(), os.path.dirname(sys.argv[0]), 'tests') WORKDIR = os.path.join(os.getcwd(), 'BUILD') @@ -599,4 +604,5 @@ if __name__ == '__main__': for test in missing_dep_excluder.tests_missing_deps: sys.stderr.write(" %s\n" % test) -print "\n".join([repr(x) for x in refnanny.reflog]) + if options.with_refnanny: + sys.stderr.write("\n".join([repr(x) for x in refnanny.reflog]))