Author: Richard Plangger <[email protected]>
Branch: new-jit-log
Changeset: r83615:25e8a7bf37c2
Date: 2016-04-12 15:03 +0200
http://bitbucket.org/pypy/pypy/changeset/25e8a7bf37c2/
Log: added test to ensure version number is correctly written
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
@@ -5,6 +5,7 @@
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 StringIO import StringIO
from rpython.jit.metainterp.optimizeopt.util import equaloplists
from rpython.jit.metainterp.history import AbstractDescr, JitCellToken,
BasicFailDescr, BasicFinalDescr
@@ -43,8 +44,29 @@
assert fd.read(3) == '\x23' + JITLOG_VERSION_16BIT_LE
assert len(fd.read()) > 0
- def test_version(self):
- pass
+ def test_version(self, monkeypatch, tmpdir):
+ file = tmpdir.join('jitlog')
+ monkeypatch.setattr(jitlog, '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 len(fd.read()) > 0
+
+ def test_version(self, monkeypatch, tmpdir):
+ file = tmpdir.join('jitlog')
+ monkeypatch.setattr(jitlog, '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 len(fd.read()) > 0
def run_sample_loop(self, func, myjitdriver = None):
if not myjitdriver:
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit