[pypy-commit] pypy win_ffi: fix test

mattip noreply at buildbot.pypy.org
Fri Jun 1 15:49:02 CEST 2012


Author: Matti Picus <matti.picus at gmail.com>
Branch: win_ffi
Changeset: r55258:6af15b871f5e
Date: 2012-06-01 16:48 +0300
http://bitbucket.org/pypy/pypy/changeset/6af15b871f5e/

Log:	fix test

diff --git a/pypy/module/pypyjit/test_pypy_c/test__ffi.py b/pypy/module/pypyjit/test_pypy_c/test__ffi.py
--- a/pypy/module/pypyjit/test_pypy_c/test__ffi.py
+++ b/pypy/module/pypyjit/test_pypy_c/test__ffi.py
@@ -1,4 +1,3 @@
-import py
 import sys
 from pypy.module.pypyjit.test_pypy_c.test_00_model import BaseTestPyPyC
 
@@ -78,12 +77,19 @@
         from pypy.rlib.test.test_libffi import get_libc_name
         def main(libc_name, n):
             import time
+            import os
             from threading import Thread
-            from _ffi import CDLL, types
             #
-            libc = CDLL(libc_name)
-            sleep = libc.getfunc('sleep', [types.uint], types.uint)
-            delays = [0]*n + [1]
+            if os.name == 'nt':
+                from _ffi import WinDLL, types
+                libc = WinDLL(libc_name)
+                sleep = libc.getfunc('Sleep', [types.uint], types.uint)
+                delays = [0]*n + [1000]
+            else:
+                from _ffi import CDLL, types
+                libc = CDLL(libc_name)
+                sleep = libc.getfunc('sleep', [types.uint], types.uint)
+                delays = [0]*n + [1]
             #
             def loop_of_sleeps(i, delays):
                 for delay in delays:
@@ -97,7 +103,6 @@
                 thread.join()
             end = time.time()
             return end - start
-        #
         log = self.run(main, [get_libc_name(), 200], threshold=150,
                        import_site=True)
         assert 1 <= log.result <= 1.5 # at most 0.5 seconds of overhead


More information about the pypy-commit mailing list