[pypy-svn] pypy real-voidp: Fix these tests on Windows

amauryfa commits-noreply at bitbucket.org
Tue Mar 1 01:23:01 CET 2011


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: real-voidp
Changeset: r42354:708c8e2cc10c
Date: 2011-03-01 01:21 +0100
http://bitbucket.org/pypy/pypy/changeset/708c8e2cc10c/

Log:	Fix these tests on Windows

diff --git a/pypy/rlib/test/test_libffi.py b/pypy/rlib/test/test_libffi.py
--- a/pypy/rlib/test/test_libffi.py
+++ b/pypy/rlib/test/test_libffi.py
@@ -77,6 +77,7 @@
         c_file = udir.ensure("test_libffi", dir=1).join("foolib.c")
         # automatically collect the C source from the docstrings of the tests
         snippets = []
+        exports = []
         for name in dir(cls):
             if name.startswith('test_'):
                 meth = getattr(cls, name)
@@ -84,9 +85,12 @@
                 # improved: so far we just check that there is a '{' :-)
                 if meth.__doc__ is not None and '{' in meth.__doc__:
                     snippets.append(meth.__doc__)
+                    import re
+                    for match in re.finditer(" ([a-z_]+)\(", meth.__doc__):
+                        exports.append(match.group(1))
         #
         c_file.write(py.code.Source('\n'.join(snippets)))
-        eci = ExternalCompilationInfo(export_symbols=[])
+        eci = ExternalCompilationInfo(export_symbols=exports)
         cls.libfoo_name = str(platform.compile([c_file], eci, 'x',
                                                standalone=False))
 


More information about the Pypy-commit mailing list