[pypy-svn] r34006 - in pypy/dist/pypy/jit/codegen/llvm: . lib test

ericvrp at codespeak.net ericvrp at codespeak.net
Wed Nov 1 12:59:21 CET 2006


Author: ericvrp
Date: Wed Nov  1 12:59:19 2006
New Revision: 34006

Modified:
   pypy/dist/pypy/jit/codegen/llvm/lib/llvmjit.cpp
   pypy/dist/pypy/jit/codegen/llvm/llvmjit.py
   pypy/dist/pypy/jit/codegen/llvm/setup.py
   pypy/dist/pypy/jit/codegen/llvm/test/test_llvmjit.py
Log:
(mwh, ericvrp) called a simple function from the library with test and proper skip


Modified: pypy/dist/pypy/jit/codegen/llvm/lib/llvmjit.cpp
==============================================================================
--- pypy/dist/pypy/jit/codegen/llvm/lib/llvmjit.cpp	(original)
+++ pypy/dist/pypy/jit/codegen/llvm/lib/llvmjit.cpp	Wed Nov  1 12:59:19 2006
@@ -1,5 +1,7 @@
 //implementation for using the LLVM JIT
 
+#include "llvmjit.h"
+
 int testme(int n) {
     return n * 2;
 }

Modified: pypy/dist/pypy/jit/codegen/llvm/llvmjit.py
==============================================================================
--- pypy/dist/pypy/jit/codegen/llvm/llvmjit.py	(original)
+++ pypy/dist/pypy/jit/codegen/llvm/llvmjit.py	Wed Nov  1 12:59:19 2006
@@ -7,3 +7,11 @@
     This file contains the ctypes specification to use the llvmjit library!
 '''
 
+import ctypes
+import os
+
+path = os.path.join(os.path.dirname(__file__), 'llvmjit_.so')
+llvmjit = ctypes.cdll.LoadLibrary(os.path.abspath(path))
+
+def testme(n):
+    return llvmjit.testme(n)

Modified: pypy/dist/pypy/jit/codegen/llvm/setup.py
==============================================================================
--- pypy/dist/pypy/jit/codegen/llvm/setup.py	(original)
+++ pypy/dist/pypy/jit/codegen/llvm/setup.py	Wed Nov  1 12:59:19 2006
@@ -6,7 +6,7 @@
 ldflags  = popen('llvm-config --ldflags').readline().split()
 libs     = popen('llvm-config --libs all').readline().split()
 
-opts = dict(name='llvmjit',
+opts = dict(name='llvmjit_',
             sources=['lib/llvmjit.cpp'],
             libraries=[],
             include_dirs =["include"] + [f[2:] for f in cxxflags if f.startswith('-I')],

Modified: pypy/dist/pypy/jit/codegen/llvm/test/test_llvmjit.py
==============================================================================
--- pypy/dist/pypy/jit/codegen/llvm/test/test_llvmjit.py	(original)
+++ pypy/dist/pypy/jit/codegen/llvm/test/test_llvmjit.py	Wed Nov  1 12:59:19 2006
@@ -0,0 +1,9 @@
+import py
+
+try:
+    from pypy.jit.codegen.llvm import llvmjit
+except OSError:
+    py.test.skip("llvmjit library not found (see ../README.TXT)")
+
+def test_testme():
+    assert llvmjit.testme(10) == 20



More information about the Pypy-commit mailing list