Commit fd6fcfbe authored by Dag Sverre Seljebotn's avatar Dag Sverre Seljebotn

Added --refnanny option to runtests.py

parent 026931cf
......@@ -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]))
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