[pypy-svn] r64285 - in pypy/trunk/pypy/module/pyexpat: . test

afa at codespeak.net afa at codespeak.net
Fri Apr 17 16:52:20 CEST 2009


Author: afa
Date: Fri Apr 17 16:52:19 2009
New Revision: 64285

Added:
   pypy/trunk/pypy/module/pyexpat/test/   (props changed)
   pypy/trunk/pypy/module/pyexpat/test/test_build.py   (contents, props changed)
Modified:
   pypy/trunk/pypy/module/pyexpat/interp_pyexpat.py
Log:
Revert to the DLL version of libexpat

AND add a very basic unit test for module compilation and linkage. At last.


Modified: pypy/trunk/pypy/module/pyexpat/interp_pyexpat.py
==============================================================================
--- pypy/trunk/pypy/module/pyexpat/interp_pyexpat.py	(original)
+++ pypy/trunk/pypy/module/pyexpat/interp_pyexpat.py	Fri Apr 17 16:52:19 2009
@@ -14,7 +14,7 @@
 import py
 
 if sys.platform == "win32":
-    libname = 'libexpatMT'
+    libname = 'libexpat'
 else:
     libname = 'expat'
 eci = ExternalCompilationInfo(

Added: pypy/trunk/pypy/module/pyexpat/test/test_build.py
==============================================================================
--- (empty file)
+++ pypy/trunk/pypy/module/pyexpat/test/test_build.py	Fri Apr 17 16:52:19 2009
@@ -0,0 +1,29 @@
+from pypy.translator.translator import TranslationContext
+from pypy.translator.c.genc import CStandaloneBuilder
+from pypy.annotation.listdef import s_list_of_strings
+from pypy.rpython.lltypesystem import rffi, lltype
+from pypy.rpython.tool.rffi_platform import CompilationError
+
+import os, pyexpat
+import py
+
+try:
+   from pypy.module.pyexpat import interp_pyexpat
+except (ImportError, CompilationError):
+    py.test.skip("Expat not installed")
+
+def test_build():
+    def entry_point(argv):
+        res = interp_pyexpat.XML_ErrorString(3)
+        os.write(1, rffi.charp2str(res))
+        return 0
+
+    t = TranslationContext()
+    t.buildannotator().build_types(entry_point, [s_list_of_strings])
+    t.buildrtyper().specialize()
+
+    builder = CStandaloneBuilder(t, entry_point, t.config)
+    builder.generate_source()
+    builder.compile()
+    data = builder.cmdexec()
+    assert data == pyexpat.ErrorString(3)



More information about the Pypy-commit mailing list