Author: Maciej Fijalkowski <[email protected]>
Branch: 
Changeset: r65711:3a4776c59dcc
Date: 2013-07-27 15:00 +0200
http://bitbucket.org/pypy/pypy/changeset/3a4776c59dcc/

Log:    skip this test if we can't find objdump (should make it work on OS
        X)

diff --git a/pypy/module/pypyjit/test_pypy_c/test_jitlogparser.py 
b/pypy/module/pypyjit/test_pypy_c/test_jitlogparser.py
--- a/pypy/module/pypyjit/test_pypy_c/test_jitlogparser.py
+++ b/pypy/module/pypyjit/test_pypy_c/test_jitlogparser.py
@@ -1,6 +1,8 @@
+import py
 import re
 
 from rpython.tool.logparser import extract_category
+from rpython.jit.backend.tool.viewcode import ObjdumpNotFound
 
 from pypy.tool.jitlogparser.parser import (import_log, parse_log_counts,
         mangle_descr)
@@ -41,7 +43,10 @@
         lib_re = re.compile("file '.*lib-python.*'")
         for loop in loops:
             if hasattr(loop, 'force_asm'):
-                loop.force_asm()
+                try:
+                    loop.force_asm()
+                except ObjdumpNotFound:
+                    py.test.skip("ObjDump was not found, skipping")
             if lib_re.search(loop.comment) or \
                     lib_re.search(loop.operations[0].repr()):
                 # do not care for _optimize_charset or _mk_bitmap
@@ -60,7 +65,7 @@
         by_count = lambda l: -l.count
         is_prime_loops.sort(key=by_count)
         fn_with_bridges_loops.sort(key=by_count)
-         
+
         # check that we can find bridges corresponding to " % 3" and " % 5"
         mod_bridges = []
         for op in fn_with_bridges_loops[0].operations:
@@ -69,7 +74,7 @@
                 if bridge is not None:
                     mod_bridges.append(bridge)
         assert len(mod_bridges) in (1, 2)
-        
+
         # check that counts are reasonable (precise # may change in the future)
         assert N - 2000 < sum(l.count for l in fn_with_bridges_loops) < N
 
diff --git a/rpython/jit/backend/tool/viewcode.py 
b/rpython/jit/backend/tool/viewcode.py
--- a/rpython/jit/backend/tool/viewcode.py
+++ b/rpython/jit/backend/tool/viewcode.py
@@ -36,6 +36,9 @@
 if sys.platform == "win32":
     pass   # lots more in Psyco
 
+class ObjdumpNotFound(Exception):
+    pass
+
 def find_objdump():
     exe = ('objdump', 'gobjdump')
     path = os.environ['PATH'].split(os.pathsep)
@@ -45,7 +48,7 @@
             if not os.path.exists(path_to):
                 continue
             return e
-    raise AssertionError('(g)objdump was not found in PATH')
+    raise ObjdumpNotFound('(g)objdump was not found in PATH')
 
 def machine_code_dump(data, originaddr, backend_name, label_list=None):
     objdump_backend_option = {
@@ -326,7 +329,7 @@
                         color = "black"
                     else:
                         color = "red"
-                    g1.emit_edge('N_%x' % r.addr, 'N_%x' % targetaddr, 
+                    g1.emit_edge('N_%x' % r.addr, 'N_%x' % targetaddr,
                                  color=color)
         sys.stdout.flush()
         if showgraph:
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to