[pypy-commit] pypy default: Fix test

arigo noreply at buildbot.pypy.org
Thu Sep 4 14:26:37 CEST 2014


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r73297:b15ac44c3739
Date: 2014-09-04 14:21 +0200
http://bitbucket.org/pypy/pypy/changeset/b15ac44c3739/

Log:	Fix test

diff --git a/pypy/module/pypyjit/test_pypy_c/test_cprofile.py b/pypy/module/pypyjit/test_pypy_c/test_cprofile.py
--- a/pypy/module/pypyjit/test_pypy_c/test_cprofile.py
+++ b/pypy/module/pypyjit/test_pypy_c/test_cprofile.py
@@ -1,4 +1,4 @@
-import py, sys
+import py, sys, re
 from pypy.module.pypyjit.test_pypy_c.test_00_model import BaseTestPyPyC
 
 class TestCProfile(BaseTestPyPyC):
@@ -28,8 +28,18 @@
             print loop.ops_by_id(method)
             # on 32-bit, there is f1=call(read_timestamp); ...;
             # f2=call(read_timestamp); f3=call(llong_sub,f1,f2)
-            # but all calls can be special-cased by the backend if supported
-            if sys.maxint != 2147483647:
-                assert ' call(' not in repr(loop.ops_by_id(method))
+            # but all calls can be special-cased by the backend if
+            # supported.  On 64-bit there is only the two calls to
+            # read_timestamp.
+            r = re.compile(r" call[(]ConstClass[(](.+?)[)]")
+            calls = r.findall(repr(loop.ops_by_id(method)))
+            if sys.maxint == 2147483647:
+                assert len(calls) == 6
+            else:
+                assert len(calls) == 2
+            for x in calls:
+                assert ('ll_read_timestamp' in x or 'llong_sub' in x
+                        or 'llong_add' in x)
+            #
             assert ' call_may_force(' not in repr(loop.ops_by_id(method))
             assert ' cond_call(' in repr(loop.ops_by_id(method))


More information about the pypy-commit mailing list