[pypy-svn] r68326 - pypy/trunk/pypy/rpython/tool/test

fijal at codespeak.net fijal at codespeak.net
Sun Oct 11 23:08:07 CEST 2009


Author: fijal
Date: Sun Oct 11 23:08:06 2009
New Revision: 68326

Modified:
   pypy/trunk/pypy/rpython/tool/test/test_mkrffi.py
Log:
Use our own platform instead of custom distutils hacks imported
from test_c, which is gone


Modified: pypy/trunk/pypy/rpython/tool/test/test_mkrffi.py
==============================================================================
--- pypy/trunk/pypy/rpython/tool/test/test_mkrffi.py	(original)
+++ pypy/trunk/pypy/rpython/tool/test/test_mkrffi.py	Sun Oct 11 23:08:06 2009
@@ -1,7 +1,6 @@
 
 import ctypes
 from pypy.rpython.tool.mkrffi import *
-from pypy.rpython.tool.test.test_c import TestBasic
 import py
 
 class random_structure(ctypes.Structure):
@@ -54,7 +53,30 @@
     """)
     assert rffi_source.source.strip() == _src.strip()
 
-class TestMkrffi(TestBasic):
+class TestMkrffi(object):
+    def setup_class(cls):
+        import ctypes
+        from pypy.tool.udir import udir
+        from pypy.translator.platform import platform
+        from pypy.translator.tool.cbuild import ExternalCompilationInfo
+        
+        c_source = """
+        void *int_to_void_p(int arg) {}
+
+        struct random_strucutre {
+          int one;
+          int *two;
+        };
+
+        struct random_structure* int_int_to_struct_p(int one, int two) {}
+        """
+
+        c_file = udir.join('rffilib.c')
+        c_file.write(c_source)
+        libname = platform.compile([c_file], ExternalCompilationInfo(),
+                                   standalone=False)
+        cls.lib = ctypes.CDLL(str(libname))
+    
     def test_single_func(self):
         func = self.lib.int_to_void_p
         func.argtypes = [ctypes.c_int]



More information about the Pypy-commit mailing list