Author: Richard Plangger <planri...@gmail.com>
Branch: new-jit-log
Changeset: r83866:2f286840ea99
Date: 2016-04-25 15:21 +0200
http://bitbucket.org/pypy/pypy/changeset/2f286840ea99/

Log:    fixed up tests

diff --git a/rpython/jit/backend/x86/test/test_jitlog.py 
b/rpython/jit/backend/x86/test/test_jitlog.py
--- a/rpython/jit/backend/x86/test/test_jitlog.py
+++ b/rpython/jit/backend/x86/test/test_jitlog.py
@@ -4,8 +4,8 @@
 from rpython.jit.tool.oparser import pure_parse
 from rpython.jit.metainterp import logger
 from rpython.jit.metainterp.typesystem import llhelper
-from rpython.jit.metainterp.jitlog import JITLOG_VERSION_16BIT_LE
-from rpython.jit.metainterp import jitlog
+from rpython.rlib.jitlog import JITLOG_VERSION_16BIT_LE
+from rpython.rlib import jitlog as jl
 from StringIO import StringIO
 from rpython.jit.metainterp.optimizeopt.util import equaloplists
 from rpython.jit.metainterp.history import AbstractDescr, JitCellToken, 
BasicFailDescr, BasicFinalDescr
@@ -30,7 +30,7 @@
         assert os.path.exists(file.strpath)
         with file.open('rb') as f:
             # check the file header
-            assert f.read(3) == '\x23' + JITLOG_VERSION_16BIT_LE
+            assert f.read(3) == chr(jl.MARK_JITLOG_HEADER) + 
JITLOG_VERSION_16BIT_LE
             assert len(f.read()) > 0
 
     def test_env(self, monkeypatch, tmpdir):
@@ -41,31 +41,31 @@
         assert os.path.exists(file.strpath)
         with file.open('rb') as fd:
             # check the file header
-            assert fd.read(3) == '\x23' + JITLOG_VERSION_16BIT_LE
+            assert fd.read(3) == chr(jl.MARK_JITLOG_HEADER) + 
JITLOG_VERSION_16BIT_LE
             assert len(fd.read()) > 0
 
     def test_version(self, monkeypatch, tmpdir):
         file = tmpdir.join('jitlog')
-        monkeypatch.setattr(jitlog, 'JITLOG_VERSION_16BIT_LE', '\xff\xfe')
+        monkeypatch.setattr(jl, 'JITLOG_VERSION_16BIT_LE', '\xff\xfe')
         monkeypatch.setenv("JITLOG", file.strpath)
         f = self.run_sample_loop(None)
         self.meta_interp(f, [10,0])
         assert os.path.exists(file.strpath)
         with file.open('rb') as fd:
             # check the file header
-            assert fd.read(3) == '\x23\xff\xfe'
+            assert fd.read(3) == chr(jl.MARK_JITLOG_HEADER) + '\xff\xfe'
             assert len(fd.read()) > 0
 
     def test_version(self, monkeypatch, tmpdir):
         file = tmpdir.join('jitlog')
-        monkeypatch.setattr(jitlog, 'JITLOG_VERSION_16BIT_LE', '\xff\xfe')
+        monkeypatch.setattr(jl, 'JITLOG_VERSION_16BIT_LE', '\xff\xfe')
         monkeypatch.setenv("JITLOG", file.strpath)
         f = self.run_sample_loop(None)
         self.meta_interp(f, [10,0])
         assert os.path.exists(file.strpath)
         with file.open('rb') as fd:
             # check the file header
-            assert fd.read(3) == '\x23\xff\xfe'
+            assert fd.read(3) == chr(jl.MARK_JITLOG_HEADER) + '\xff\xfe'
             assert len(fd.read()) > 0
 
     def run_sample_loop(self, func, myjitdriver = None):
diff --git a/rpython/rlib/rvmprof/rvmprof.py b/rpython/rlib/rvmprof/rvmprof.py
--- a/rpython/rlib/rvmprof/rvmprof.py
+++ b/rpython/rlib/rvmprof/rvmprof.py
@@ -129,7 +129,7 @@
         if p_error:
             raise VMProfError(rffi.charp2str(p_error))
         blob = jl.assemble_header()
-        self.cintf.jitlog_write_marked(jitlog.MARK_JITLOG_HEADER, blob, 
len(blob))
+        self.cintf.jitlog_write_marked(jl.MARK_JITLOG_HEADER, blob, len(blob))
 
     def disable(self):
         """Disable vmprof.
diff --git a/rpython/rlib/test/test_jitlog.py b/rpython/rlib/test/test_jitlog.py
--- a/rpython/rlib/test/test_jitlog.py
+++ b/rpython/rlib/test/test_jitlog.py
@@ -78,12 +78,12 @@
         #
         result = jl.encode_merge_point(fakelog, compressor, 
[jl.StringValue(0x0,'s','hello')])
         assert result == b"\xef"
-        assert fakelog.values == ["\x25\x00\x05\x00\x00\x00hello"]
+        assert fakelog.values == [chr(jl.MARK_COMMON_PREFIX) + 
"\x00\x05\x00\x00\x00hello"]
         #
         fakelog.values = []
         result = jl.encode_merge_point(fakelog, compressor, 
[jl.StringValue(0x0,'s','heiter')])
         assert result == b"\x00\x04\x00\x00\x00iter"
-        assert fakelog.values == ["\x25\x00\x02\x00\x00\x00he"]
+        assert fakelog.values == [chr(jl.MARK_COMMON_PREFIX) + 
"\x00\x02\x00\x00\x00he"]
         #
         fakelog.values = []
         result = jl.encode_merge_point(fakelog, compressor, 
[jl.StringValue(0x0,'s','heute')])
@@ -98,7 +98,7 @@
         fakelog.values = []
         result = jl.encode_merge_point(fakelog, compressor, 
[jl.StringValue(0x0,'s','welle')])
         assert result == b"\x00\x02\x00\x00\x00le"
-        assert fakelog.values == ["\x25\x00\x03\x00\x00\x00wel"]
+        assert fakelog.values == [chr(jl.MARK_COMMON_PREFIX) + 
"\x00\x03\x00\x00\x00wel"]
 
     def test_common_prefix_func(self):
         assert jl.commonprefix("","") == ""
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to