[pypy-svn] r45684 - in pypy/branch/pypy-more-rtti-inprogress/rpython/tool: . test

fijal at codespeak.net fijal at codespeak.net
Wed Aug 15 16:44:28 CEST 2007


Author: fijal
Date: Wed Aug 15 16:44:27 2007
New Revision: 45684

Removed:
   pypy/branch/pypy-more-rtti-inprogress/rpython/tool/genrffi.py
   pypy/branch/pypy-more-rtti-inprogress/rpython/tool/test/test_genrffi.py
Modified:
   pypy/branch/pypy-more-rtti-inprogress/rpython/tool/mkrffi.py
   pypy/branch/pypy-more-rtti-inprogress/rpython/tool/test/test_mkrffi.py
Log:
Cleanup of the tool. We don't need two slightly different sources
by now, just one should be fine


Modified: pypy/branch/pypy-more-rtti-inprogress/rpython/tool/mkrffi.py
==============================================================================
--- pypy/branch/pypy-more-rtti-inprogress/rpython/tool/mkrffi.py	(original)
+++ pypy/branch/pypy-more-rtti-inprogress/rpython/tool/mkrffi.py	Wed Aug 15 16:44:27 2007
@@ -1,5 +1,3 @@
-#!/usr/bin/env python
-
 import ctypes
 
 import py
@@ -21,8 +19,6 @@
     ctypes.c_uint      : 'rffi.UINT',
     ctypes.c_int32     : 'rffi.INT',
     ctypes.c_uint32    : 'rffi.UINT',
-    #ctypes.c_long      : 'rffi.LONG', # same as c_int..
-    #ctypes.c_ulong     : 'rffi.ULONG',
     ctypes.c_longlong  : 'rffi.LONGLONG',
     ctypes.c_ulonglong : 'rffi.ULONGLONG',
     ctypes.c_int64     : 'rffi.LONGLONG',
@@ -114,7 +110,12 @@
                     print "skipped:", value
             #print value, value.__class__.__name__
 
-
-
-
-
+    def compiled(self):
+        # not caching!
+        globs = {}
+        src = py.code.Source("""
+        from pypy.rpython.lltypesystem import lltype
+        from pypy.rpython.lltypesystem import rffi
+        """, self.source)
+        exec src.compile() in globs
+        return globs

Modified: pypy/branch/pypy-more-rtti-inprogress/rpython/tool/test/test_mkrffi.py
==============================================================================
--- pypy/branch/pypy-more-rtti-inprogress/rpython/tool/test/test_mkrffi.py	(original)
+++ pypy/branch/pypy-more-rtti-inprogress/rpython/tool/test/test_mkrffi.py	Wed Aug 15 16:44:27 2007
@@ -19,6 +19,7 @@
     rffi_source = RffiSource()
     assert rffi_source.proc_tp(ctypes.c_int) == 'rffi.INT'
     assert rffi_source.proc_tp(ctypes.c_void_p) == 'rffi.VOIDP'
+    assert rffi_source.compiled()
 
 def test_proc_tp_complicated():
     rffi_source = RffiSource()    
@@ -30,6 +31,7 @@
     """)
     src = rffi_source.source
     assert src.strip() == _src.strip(), str(src) + "\n" + str(_src)
+    assert rffi_source.compiled()
 
 class TestMkrffi(TestBasic):
     def test_single_func(self):
@@ -44,6 +46,7 @@
         """)
 
         assert src.source == _src, str(src) + "\n" + str(_src)
+        assert src.compiled()
 
     def test_struct_return(self):
         func = self.lib.int_int_to_struct_p
@@ -59,3 +62,4 @@
         """)
         src = rffi_source.source
         assert src.strip() == _src.strip(), str(src) + "\n" + str(_src)
+        assert rffi_source.compiled()



More information about the Pypy-commit mailing list