[pypy-svn] r25397 - in pypy/dist/pypy: . translator/c/test translator/tool
mwh at codespeak.net
mwh at codespeak.net
Wed Apr 5 17:21:51 CEST 2006
Author: mwh
Date: Wed Apr 5 17:21:49 2006
New Revision: 25397
Modified:
pypy/dist/pypy/conftest.py
pypy/dist/pypy/translator/c/test/test_genc.py
pypy/dist/pypy/translator/tool/cbuild.py
Log:
(pedronis, mwh)
add a --gc option to pypy's conftest that allows one to select which gc policy
test_genc uses by default (should probably be placed differently...)
poke at the method test_genc uses to build its extensions so that at least
using the boehm gc policy works (the framework doesn't, yet).
Modified: pypy/dist/pypy/conftest.py
==============================================================================
--- pypy/dist/pypy/conftest.py (original)
+++ pypy/dist/pypy/conftest.py Wed Apr 5 17:21:49 2006
@@ -41,6 +41,10 @@
help="""select compiling approach. see pypy/doc/README.compiling"""),
Option('--view', action="store_true", dest="view", default=False,
help="view translation tests' flow graphs with Pygame"),
+ Option('--gc', action="store", default=None,
+ type="choice", dest="gcpolicy",
+ choices=['ref', 'boehm', 'none', 'framework'],
+ help="GcPolicy class to use for genc tests"),
)
_SPACECACHE={}
Modified: pypy/dist/pypy/translator/c/test/test_genc.py
==============================================================================
--- pypy/dist/pypy/translator/c/test/test_genc.py (original)
+++ pypy/dist/pypy/translator/c/test/test_genc.py Wed Apr 5 17:21:49 2006
@@ -26,7 +26,8 @@
targetdir = udir.join(modulename).ensure(dir=1)
gen_source(db, modulename, str(targetdir), defines={'COUNT_OP_MALLOCS': 1})
m = make_module_from_c(targetdir.join(modulename+'.c'),
- include_dirs = [os.path.dirname(autopath.this_dir)])
+ include_dirs = [os.path.dirname(autopath.this_dir)],
+ libraries = db.gcpolicy.gc_libraries())
return m
def compile(fn, argtypes, view=False, gcpolicy=None, backendopt=True):
@@ -36,6 +37,20 @@
t.buildrtyper().specialize()
if backendopt:
backend_optimizations(t)
+ if gcpolicy is None:
+ polname = conftest.option.gcpolicy
+ if polname is not None:
+ from pypy.translator.c import gc
+ if polname == 'boehm':
+ gcpolicy = gc.BoehmGcPolicy
+ elif polname == 'ref':
+ gcpolicy = gc.RefcountingGcPolicy
+ elif polname == 'none':
+ gcpolicy = gc.NoneGcPolicy
+ elif polname == 'framework':
+ gcpolicy = gc.FrameworkGcPolicy
+ else:
+ assert False, "unknown gc policy %r"%polname
db = LowLevelDatabase(t, gcpolicy=gcpolicy)
entrypoint = db.get(pyobjectptr(fn))
db.complete()
Modified: pypy/dist/pypy/translator/tool/cbuild.py
==============================================================================
--- pypy/dist/pypy/translator/tool/cbuild.py (original)
+++ pypy/dist/pypy/translator/tool/cbuild.py Wed Apr 5 17:21:49 2006
@@ -153,10 +153,10 @@
finally:
lastdir.chdir()
-def make_module_from_c(cfile, include_dirs=None):
+def make_module_from_c(cfile, include_dirs=None, libraries=[]):
cfile = py.path.local(cfile)
modname = cfile.purebasename
- compile_c_module([cfile], modname, include_dirs)
+ compile_c_module([cfile], modname, include_dirs, libraries)
return import_module_from_directory(cfile.dirpath(), modname)
def import_module_from_directory(dir, modname):
More information about the Pypy-commit
mailing list