Author: Konstantin Lopuhin <[email protected]>
Branch: bridge-logging
Changeset: r62870:84b2a0aa576e
Date: 2013-03-28 17:46 +0100
http://bitbucket.org/pypy/pypy/changeset/84b2a0aa576e/
Log: move test to tests_pypy_c
diff --git a/pypy/module/pypyjit/test_pypy_c/test_jitlogparser.py
b/pypy/module/pypyjit/test_pypy_c/test_jitlogparser.py
new file mode 100644
--- /dev/null
+++ b/pypy/module/pypyjit/test_pypy_c/test_jitlogparser.py
@@ -0,0 +1,44 @@
+from rpython.tool.logparser import extract_category
+
+from pypy.tool.jitlogparser.parser import import_log, parse_log_counts
+from pypy.module.pypyjit.test_pypy_c.test_00_model import BaseTestPyPyC
+
+
+class TestLogParser(BaseTestPyPyC):
+
+ def test(self):
+ def fn_with_bridges(N):
+ def is_prime(x):
+ for y in xrange(2, x):
+ if x % y == 0:
+ return False
+ return True
+ result = 0
+ for x in xrange(N):
+ if x % 3 == 0:
+ result += 5
+ elif x % 5 == 0:
+ result += 3
+ elif is_prime(x):
+ result += x
+ elif x == 99:
+ result *= 2
+ return result
+ #
+ log = self.run(fn_with_bridges, [10000])
+ print log
+ import pdb; pdb.set_trace()
+ # TODO
+ log, loops = import_log(log_filename)
+ parse_log_counts(extract_category(log, 'jit-backend-count'), loops)
+ lib_re = re.compile("file '.*lib-python.*'")
+ for loop in loops:
+ loop.force_asm()
+ if lib_re.search(loop.comment) or \
+ lib_re.search(loop.operations[0].repr()):
+ # do not care for _optimize_charset or _mk_bitmap
+ continue
+ else:
+ import pdb; pdb.set_trace()
+
+
diff --git a/pypy/tool/jitlogparser/test/test_parser.py
b/pypy/tool/jitlogparser/test/test_parser.py
--- a/pypy/tool/jitlogparser/test/test_parser.py
+++ b/pypy/tool/jitlogparser/test/test_parser.py
@@ -1,8 +1,3 @@
-import re
-import os.path
-import tempfile
-import subprocess
-
from pypy.tool.jitlogparser.parser import (SimpleParser, TraceForOpcode,
Function, adjust_bridges,
import_log, split_trace, Op,
@@ -10,7 +5,6 @@
from pypy.tool.jitlogparser.storage import LoopStorage
import py, sys
from rpython.jit.backend.detect_cpu import autodetect_main_model
-from rpython.tool.logparser import extract_category
def parse(input, **kwds):
@@ -378,24 +372,3 @@
""")
f = Function.from_operations(loop.operations, LoopStorage())
assert len(f.chunks) == 2
-
-def test_import_log_on_pypy():
- ''' Test import_log and parse_log_counts on a log from actual pypy run
- '''
- log_filename = tempfile.mktemp()
- pypy = '/Users/kostia/programming/pypy/pypy-c' # FIXME
- subprocess.check_call([pypy,
- os.path.join(os.path.dirname(__file__), 'y.py')],
- env={'PYPYLOG': 'jit-log-opt,jit-backend:%s' % log_filename})
- log, loops = import_log(log_filename)
- parse_log_counts(extract_category(log, 'jit-backend-count'), loops)
- lib_re = re.compile("file '.*lib-python.*'")
- for loop in loops:
- loop.force_asm()
- if lib_re.search(loop.comment) or \
- lib_re.search(loop.operations[0].repr()):
- # do not care for _optimize_charset or _mk_bitmap
- continue
- else:
- import pdb; pdb.set_trace()
-
diff --git a/pypy/tool/jitlogparser/test/y.py b/pypy/tool/jitlogparser/test/y.py
deleted file mode 100644
--- a/pypy/tool/jitlogparser/test/y.py
+++ /dev/null
@@ -1,24 +0,0 @@
-
-def fn_with_bridges(N):
- result = 0
- for x in xrange(N):
- if x % 3 == 0:
- result += 5
- elif x % 5 == 0:
- result += 3
- elif is_prime(x):
- result += x
- elif x == 99:
- result *= 2
- return result
-
-
-def is_prime(x):
- for y in xrange(2, x):
- if x % y == 0:
- return False
- return True
-
-
-fn_with_bridges(10000)
-
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit