Author: Alex Gaynor <[email protected]>
Branch: 
Changeset: r44335:4e46b7c79d0e
Date: 2011-05-20 13:56 -0500
http://bitbucket.org/pypy/pypy/changeset/4e46b7c79d0e/

Log:    merged upstream

diff --git a/pypy/config/pypyoption.py b/pypy/config/pypyoption.py
--- a/pypy/config/pypyoption.py
+++ b/pypy/config/pypyoption.py
@@ -33,7 +33,7 @@
      "struct", "_hashlib", "_md5", "_sha", "_minimal_curses", "cStringIO",
      "thread", "itertools", "pyexpat", "_ssl", "cpyext", "array",
      "_bisect", "binascii", "_multiprocessing", '_warnings',
-     "_collections", "_multibytecodec", 'micronumpy']
+     "_collections", "_multibytecodec", "micronumpy"]
 ))
 
 translation_modules = default_modules.copy()
diff --git a/pypy/jit/backend/llgraph/llimpl.py 
b/pypy/jit/backend/llgraph/llimpl.py
--- a/pypy/jit/backend/llgraph/llimpl.py
+++ b/pypy/jit/backend/llgraph/llimpl.py
@@ -1564,6 +1564,9 @@
     assert list(argsiter_f) == []
     return args
 
+def do_partial_virtualizable(virtualizable):
+    pass
+
 
 # for ootype meth and staticmeth
 def call_maybe_on_top_of_llinterp(meth, args):
diff --git a/pypy/jit/metainterp/compile.py b/pypy/jit/metainterp/compile.py
--- a/pypy/jit/metainterp/compile.py
+++ b/pypy/jit/metainterp/compile.py
@@ -650,6 +650,7 @@
         raise metainterp_sd.ExitFrameWithExceptionRef(cpu, exception)
 
 propagate_exception_descr = PropagateExceptionDescr()
+_compile_bogus_code = False     # for test_compile_tmp_callback_and_using_it
 
 def compile_tmp_callback(cpu, jitdriver_sd, greenboxes, redboxes,
                          memory_manager=None):
@@ -683,6 +684,38 @@
     else:
         finishargs = []
     #
+    # must cancel the optimization done by optimize_PARTIAL_VIRTUALIZABLE
+    # in optimizeopt/virtualize.py
+    setoperations = []
+    src_index = nb_red_args
+    vinfo = jitdriver_sd.virtualizable_info
+    if vinfo is not None:
+        vablebox = inputargs[jitdriver_sd.index_of_virtualizable]
+        for descr in vinfo.static_field_descrs:
+            valuebox = inputargs[src_index]
+            src_index += 1
+            setoperations.append(
+                ResOperation(rop.SETFIELD_GC, [vablebox, valuebox], None,
+                             descr=descr))
+        for arrayindex in range(len(vinfo.array_field_descrs)):
+            # xxx fish the virtualizable from the box
+            length = vinfo.get_array_length(vablebox.getref_base(), arrayindex)
+            assert src_index + length <= len(inputargs)
+            arraybox = BoxPtr()
+            arrayfielddescr = vinfo.array_field_descrs[arrayindex]
+            arraydescr = vinfo.array_descrs[arrayindex]
+            setoperations.append(
+                ResOperation(rop.GETFIELD_GC, [vablebox], arraybox,
+                             descr=arrayfielddescr))
+            for i in range(length):
+                valuebox = inputargs[src_index]
+                src_index += 1
+                setoperations.append(
+                    ResOperation(rop.SETARRAYITEM_GC,
+                                 [arraybox, history.ConstInt(i), valuebox],
+                                 None, descr=arraydescr))
+    assert src_index == len(inputargs)
+    #
     jd = jitdriver_sd
     faildescr = propagate_exception_descr
     operations = [
@@ -691,6 +724,12 @@
         ResOperation(rop.FINISH, finishargs, None, descr=jd.portal_finishtoken)
         ]
     operations[1].setfailargs([])
+    if _compile_bogus_code:      # testing only
+        operations.insert(0, ResOperation(rop.INT_FLOORDIV,
+                                          [history.ConstInt(42),
+                                           history.ConstInt(0)],
+                                          history.BoxInt()))
+    operations = setoperations + operations
     operations = get_deep_immutable_oplist(operations)
     cpu.compile_loop(inputargs, operations, loop_token, log=False)
     if memory_manager is not None:    # for tests
diff --git a/pypy/jit/metainterp/executor.py b/pypy/jit/metainterp/executor.py
--- a/pypy/jit/metainterp/executor.py
+++ b/pypy/jit/metainterp/executor.py
@@ -323,6 +323,7 @@
                          rop.JIT_DEBUG,
                          rop.SETARRAYITEM_RAW,
                          rop.QUASIIMMUT_FIELD,
+                         rop.PARTIAL_VIRTUALIZABLE,
                          ):      # list of opcodes never executed by pyjitpl
                 continue
             raise AssertionError("missing %r" % (key,))
diff --git a/pypy/jit/metainterp/history.py b/pypy/jit/metainterp/history.py
--- a/pypy/jit/metainterp/history.py
+++ b/pypy/jit/metainterp/history.py
@@ -211,6 +211,10 @@
     def get_jitcode_for_class(self, oocls):
         return self.jitcodes[oocls]
 
+class JitDriverDescr(AbstractDescr):
+    def __init__(self, jitdriver_sd):
+        self.jitdriver_sd = jitdriver_sd
+
 
 class Const(AbstractValue):
     __slots__ = ()
diff --git a/pypy/jit/metainterp/optimizeopt/simplify.py 
b/pypy/jit/metainterp/optimizeopt/simplify.py
--- a/pypy/jit/metainterp/optimizeopt/simplify.py
+++ b/pypy/jit/metainterp/optimizeopt/simplify.py
@@ -25,6 +25,9 @@
         #     but it's a bit hard to implement robustly if heap.py is also run
         pass
 
+    def optimize_PARTIAL_VIRTUALIZABLE(self, op):
+        pass
+
     def propagate_forward(self, op):
         opnum = op.getopnum()
         for value, func in optimize_ops:
diff --git a/pypy/jit/metainterp/optimizeopt/virtualize.py 
b/pypy/jit/metainterp/optimizeopt/virtualize.py
--- a/pypy/jit/metainterp/optimizeopt/virtualize.py
+++ b/pypy/jit/metainterp/optimizeopt/virtualize.py
@@ -1,3 +1,4 @@
+from pypy.jit.metainterp import history
 from pypy.jit.metainterp.history import Const, ConstInt, BoxInt
 from pypy.jit.metainterp.resoperation import rop, ResOperation
 from pypy.jit.metainterp.optimizeutil import _findall, sort_descrs
@@ -435,6 +436,32 @@
         ###self.heap_op_optimizer.optimize_SETARRAYITEM_GC(op, value, 
fieldvalue)
         self.emit_operation(op)
 
+    def optimize_PARTIAL_VIRTUALIZABLE(self, op):
+        value = self.getvalue(op.getarg(0))
+        if value.is_virtual():
+            jddescr = op.getdescr()
+            assert isinstance(jddescr, history.JitDriverDescr)
+            vinfo = jddescr.jitdriver_sd.virtualizable_info
+            # XXX giant hack.  The idea is that this virtual will be passed
+            # as the virtualizable to the CALL_ASSEMBLER operation that
+            # follows, so it will be forced.  But we will also pass the
+            # virtualizable fields explicitly as arguments to CALL_ASSEMBLER,
+            # which have already been read out of the virtual just before.
+            # The following hackery resets the fields to their NULL/0 value,
+            # which has (only) the effect that forcing the virtual will not
+            # write anything in these fields.
+            assert isinstance(value, AbstractVirtualStructValue)
+            for descr in vinfo.static_field_descrs:
+                try:
+                    del value._fields[descr]
+                except KeyError:
+                    pass
+            for descr in vinfo.array_field_descrs:
+                avalue = value.getfield(descr, None)
+                if isinstance(avalue, VArrayValue):
+                    for i in range(len(avalue._items)):
+                        avalue._items[i] = avalue.constvalue
+
     def propagate_forward(self, op):
         opnum = op.getopnum()
         for value, func in optimize_ops:
diff --git a/pypy/jit/metainterp/pyjitpl.py b/pypy/jit/metainterp/pyjitpl.py
--- a/pypy/jit/metainterp/pyjitpl.py
+++ b/pypy/jit/metainterp/pyjitpl.py
@@ -2340,6 +2340,9 @@
             vbox = args[index]
             args = args + self.gen_load_from_other_virtualizable(vinfo, vbox)
             # ^^^ and not "+=", which makes 'args' a resizable list
+            jddescr = history.JitDriverDescr(targetjitdriver_sd)
+            self.history.record(rop.PARTIAL_VIRTUALIZABLE, [vbox], None,
+                                descr=jddescr)
         warmrunnerstate = targetjitdriver_sd.warmstate
         token = warmrunnerstate.get_assembler_token(greenargs, args)
         op = op.copy_and_change(rop.CALL_ASSEMBLER, args=args, descr=token)
diff --git a/pypy/jit/metainterp/resoperation.py 
b/pypy/jit/metainterp/resoperation.py
--- a/pypy/jit/metainterp/resoperation.py
+++ b/pypy/jit/metainterp/resoperation.py
@@ -478,6 +478,7 @@
     'COPYSTRCONTENT/5',       # src, dst, srcstart, dststart, length
     'COPYUNICODECONTENT/5',
     'QUASIIMMUT_FIELD/1d',    # [objptr], descr=SlowMutateDescr
+    'PARTIAL_VIRTUALIZABLE/1d',  # removed before it's passed to the backend
 
     '_CANRAISE_FIRST', # ----- start of can_raise operations -----
     '_CALL_FIRST',
diff --git a/pypy/jit/metainterp/test/test_recursive.py 
b/pypy/jit/metainterp/test/test_recursive.py
--- a/pypy/jit/metainterp/test/test_recursive.py
+++ b/pypy/jit/metainterp/test/test_recursive.py
@@ -655,8 +655,9 @@
             i = 1
             while 1:
                 driver.jit_merge_point(codeno=codeno, i=i, frame=frame)
+                assert frame.j >= 100
                 if (i >> 1) == 1:
-                    if frame.j == 0:
+                    if frame.j == 100:
                         return
                     portal(2, Frame(frame.j - 1))
                 elif i == 5:
@@ -665,7 +666,7 @@
                 driver.can_enter_jit(codeno=codeno, i=i, frame=frame)
 
         def main(codeno, j):
-            portal(codeno, Frame(j))
+            portal(codeno, Frame(j + 100))
 
         main(2, 5)
 
@@ -695,6 +696,85 @@
             print redirected
             assert redirected.keys() == trace
 
+    def test_compile_tmp_callback_and_using_it(self):
+        # unlike the previous tests, this test calls compile_tmp_callback()
+        # and actually invokes the compiled temporary callback
+        driver = JitDriver(greens = ['codeno'], reds = ['i'])
+
+        def main(codeno):
+            i = 1
+            while i < 7:
+                driver.jit_merge_point(codeno=codeno, i=i)
+                if codeno == 1:
+                    return 42
+                if i >= 3:
+                    main(1)
+                i += 1
+            return i
+
+        from pypy.rpython.llinterp import LLException
+        from pypy.jit.metainterp import compile
+        compile._compile_bogus_code = True
+        try:
+            e = py.test.raises(LLException, self.meta_interp,
+                               main, [2], inline=True)
+        finally:
+            compile._compile_bogus_code = False
+        assert e.value.args[2][0] is ZeroDivisionError
+
+        res = self.meta_interp(main, [2], inline=True)
+        assert res == 7
+
+    def test_compile_tmp_callback_and_using_it_with_virtualizable(self):
+        # same as the previous test, but with a virtualizable
+        class Frame(object):
+            _virtualizable2_ = ['j']
+            def __init__(self, j):
+                self.j = j
+
+        driver = JitDriver(greens = ['codeno'], reds = ['i', 'frame'],
+                           virtualizables = ['frame'])
+
+        def main(codeno):
+            frame = Frame(codeno+100)
+            i = 1
+            while i < 7:
+                driver.jit_merge_point(codeno=codeno, i=i, frame=frame)
+                assert frame.j == codeno+100
+                if codeno == 1:
+                    return
+                if i >= 3:
+                    main(1)
+                i += 1
+
+        self.meta_interp(main, [2], inline=True)
+
+    def test_compile_tmp_callback_and_using_it_with_virtualizable_array(self):
+        # same as the previous test, but with a virtualizable with an array
+        class Frame(object):
+            _virtualizable2_ = ['lst[*]']
+            def __init__(self, lst):
+                self = hint(self, fresh_virtualizable=True,
+                                  access_directly=True)
+                self.lst = lst
+
+        driver = JitDriver(greens = ['codeno'], reds = ['i', 'frame'],
+                           virtualizables = ['frame'])
+
+        def main(codeno):
+            frame = Frame([codeno+100])
+            i = 1
+            while i < 7:
+                driver.jit_merge_point(codeno=codeno, i=i, frame=frame)
+                assert frame.lst[0] == codeno+100
+                if codeno == 1:
+                    return
+                if i >= 3:
+                    main(1)
+                i += 1
+
+        self.meta_interp(main, [2], inline=True)
+
     def test_directly_call_assembler_return(self):
         driver = JitDriver(greens = ['codeno'], reds = ['i', 'k'],
                            get_printable_location = lambda codeno : 
str(codeno))
diff --git a/pypy/jit/metainterp/test/test_ztranslation.py 
b/pypy/jit/metainterp/test/test_ztranslation.py
--- a/pypy/jit/metainterp/test/test_ztranslation.py
+++ b/pypy/jit/metainterp/test/test_ztranslation.py
@@ -40,12 +40,6 @@
                 self.i = i
                 self.l = [float(i)]
 
-        class OtherFrame(object):
-            _virtualizable2_ = ['i']
-
-            def __init__(self, i):
-                self.i = i
-
         class JitCellCache:
             entry = None
         jitcellcache = JitCellCache()
@@ -77,7 +71,8 @@
                 frame.l[0] -= 1
             return total * 10
         #
-        myjitdriver2 = JitDriver(greens = ['g'], reds = ['m', 's', 'f'],
+        myjitdriver2 = JitDriver(greens = ['g'],
+                                 reds = ['m', 's', 'f', 'float_s'],
                                  virtualizables = ['f'])
         def f2(g, m, x):
             s = ""
diff --git a/pypy/module/micronumpy/interp_ufuncs.py 
b/pypy/module/micronumpy/interp_ufuncs.py
--- a/pypy/module/micronumpy/interp_ufuncs.py
+++ b/pypy/module/micronumpy/interp_ufuncs.py
@@ -36,7 +36,10 @@
 
 @ufunc
 def exp(value):
-    return math.exp(value)
+    try:
+        return math.exp(value)
+    except OverflowError:
+        return rfloat.INFINITY
 
 @ufunc2
 def maximum(lvalue, rvalue):
@@ -60,4 +63,4 @@
 def sign(value):
     if value == 0.0:
         return 0.0
-    return rfloat.copysign(1.0, value)
\ No newline at end of file
+    return rfloat.copysign(1.0, value)
diff --git a/pypy/module/micronumpy/test/test_ufuncs.py 
b/pypy/module/micronumpy/test/test_ufuncs.py
--- a/pypy/module/micronumpy/test/test_ufuncs.py
+++ b/pypy/module/micronumpy/test/test_ufuncs.py
@@ -1,3 +1,4 @@
+
 from pypy.module.micronumpy.test.test_base import BaseNumpyAppTest
 
 
@@ -73,7 +74,12 @@
         import math
         from numpy import array, exp
 
-        a = array([-5.0, -0.0, 0.0, float("inf")])
+        a = array([-5.0, -0.0, 0.0, 12345678.0, float("inf"),
+                   -float('inf'), -12343424.0])
         b = exp(a)
         for i in range(4):
-            assert b[i] == math.exp(a[i])
\ No newline at end of file
+            try:
+                res = math.exp(a[i])
+            except OverflowError:
+                res = float('inf')
+            assert b[i] == res
diff --git a/pypy/rlib/debug.py b/pypy/rlib/debug.py
--- a/pypy/rlib/debug.py
+++ b/pypy/rlib/debug.py
@@ -140,6 +140,40 @@
             return hop.inputconst(lltype.Bool, False)
 
 
+def debug_offset():
+    """ Return an offset in log file
+    """
+    return -1
+
+class Entry(ExtRegistryEntry):
+    _about_ = debug_offset
+
+    def compute_result_annotation(self):
+        from pypy.annotation import model as annmodel
+        return annmodel.SomeInteger()
+
+    def specialize_call(self, hop):
+        from pypy.rpython.lltypesystem import lltype
+        hop.exception_cannot_occur()
+        return hop.genop('debug_offset', [], resulttype=lltype.Signed)
+
+
+def debug_flush():
+    """ Flushes the debug file
+    """
+    pass
+
+class Entry(ExtRegistryEntry):
+    _about_ = debug_flush
+
+    def compute_result_annotation(self):
+        return None
+    
+    def specialize_call(self, hop):
+        hop.exception_cannot_occur()
+        return hop.genop('debug_flush', [])
+
+
 def llinterpcall(RESTYPE, pythonfunction, *args):
     """When running on the llinterp, this causes the llinterp to call to
     the provided Python function with the run-time value of the given args.
diff --git a/pypy/rlib/test/test_debug.py b/pypy/rlib/test/test_debug.py
--- a/pypy/rlib/test/test_debug.py
+++ b/pypy/rlib/test/test_debug.py
@@ -2,7 +2,7 @@
 import py
 from pypy.rlib.debug import check_annotation, make_sure_not_resized
 from pypy.rlib.debug import debug_print, debug_start, debug_stop
-from pypy.rlib.debug import have_debug_prints
+from pypy.rlib.debug import have_debug_prints, debug_offset
 from pypy.rlib.debug import check_nonneg, IntegerCanBeNegative
 from pypy.rlib import debug
 from pypy.rpython.test.test_llinterp import interpret
@@ -60,6 +60,8 @@
             debug_start("mycat")
             debug_print("foo", 2, "bar", x)
             debug_stop("mycat")
+            debug_flush() # does nothing
+            debug_offset() # should not explode at least
             return have_debug_prints()
 
         try:
diff --git a/pypy/rpython/lltypesystem/lloperation.py 
b/pypy/rpython/lltypesystem/lloperation.py
--- a/pypy/rpython/lltypesystem/lloperation.py
+++ b/pypy/rpython/lltypesystem/lloperation.py
@@ -553,6 +553,8 @@
     'debug_start':          LLOp(canrun=True),
     'debug_stop':           LLOp(canrun=True),
     'have_debug_prints':    LLOp(canrun=True),
+    'debug_offset':         LLOp(canrun=True),
+    'debug_flush':          LLOp(canrun=True),
     'debug_assert':         LLOp(tryfold=True),
     'debug_fatalerror':     LLOp(),
     'debug_llinterpcall':   LLOp(canraise=(Exception,)),
diff --git a/pypy/rpython/lltypesystem/opimpl.py 
b/pypy/rpython/lltypesystem/opimpl.py
--- a/pypy/rpython/lltypesystem/opimpl.py
+++ b/pypy/rpython/lltypesystem/opimpl.py
@@ -513,6 +513,12 @@
 def op_debug_stop(category):
     debug.debug_stop(_normalize(category))
 
+def op_debug_offset():
+    return debug.debug_offset()
+
+def op_debug_flush():
+    pass
+
 def op_have_debug_prints():
     return debug.have_debug_prints()
 
diff --git a/pypy/translator/c/src/debug_print.c 
b/pypy/translator/c/src/debug_print.c
--- a/pypy/translator/c/src/debug_print.c
+++ b/pypy/translator/c/src/debug_print.c
@@ -65,6 +65,15 @@
   debug_ready = 1;
 }
 
+long pypy_debug_offset(void)
+{
+  if (!debug_ready)
+    return -1;
+  // note that we deliberately ignore errno, since -1 is fine
+  // in case this is not a real file
+  return ftell(pypy_debug_file);
+}
+
 void pypy_debug_ensure_opened(void)
 {
   if (!debug_ready)
diff --git a/pypy/translator/c/src/debug_print.h 
b/pypy/translator/c/src/debug_print.h
--- a/pypy/translator/c/src/debug_print.h
+++ b/pypy/translator/c/src/debug_print.h
@@ -26,8 +26,9 @@
 #define PYPY_DEBUG_FILE           pypy_debug_file
 #define PYPY_DEBUG_START(cat)     pypy_debug_start(cat)
 #define PYPY_DEBUG_STOP(cat)      pypy_debug_stop(cat)
+#define OP_DEBUG_OFFSET(res)      res = pypy_debug_offset()
 #define OP_HAVE_DEBUG_PRINTS(r)   r = (pypy_have_debug_prints & 1)
-
+#define OP_DEBUG_FLUSH() fflush(pypy_debug_file)
 
 /************************************************************/
 
@@ -35,6 +36,7 @@
 void pypy_debug_ensure_opened(void);
 void pypy_debug_start(const char *category);
 void pypy_debug_stop(const char *category);
+long pypy_debug_offset(void);
 
 extern long pypy_have_debug_prints;
 extern FILE *pypy_debug_file;
diff --git a/pypy/translator/c/test/test_standalone.py 
b/pypy/translator/c/test/test_standalone.py
--- a/pypy/translator/c/test/test_standalone.py
+++ b/pypy/translator/c/test/test_standalone.py
@@ -3,8 +3,8 @@
 
 from pypy.rlib.objectmodel import keepalive_until_here
 from pypy.rlib.rarithmetic import r_longlong
-from pypy.rlib.debug import ll_assert, have_debug_prints
-from pypy.rlib.debug import debug_print, debug_start, debug_stop
+from pypy.rlib.debug import ll_assert, have_debug_prints, debug_flush
+from pypy.rlib.debug import debug_print, debug_start, debug_stop, debug_offset
 from pypy.translator.translator import TranslationContext
 from pypy.translator.backendopt import all
 from pypy.translator.c.genc import CStandaloneBuilder, ExternalCompilationInfo
@@ -284,12 +284,13 @@
             debug_stop   ("mycat")
             if have_debug_prints(): x += "a"
             debug_print("toplevel")
-            os.write(1, x + '.\n')
+            debug_flush()
+            os.write(1, x + "." + str(debug_offset()) + '.\n')
             return 0
         t, cbuilder = self.compile(entry_point)
         # check with PYPYLOG undefined
         out, err = cbuilder.cmdexec("", err=True, env={})
-        assert out.strip() == 'got:a.'
+        assert out.strip() == 'got:a.-1.'
         assert 'toplevel' in err
         assert 'mycat' not in err
         assert 'foo 2 bar 3' not in err
@@ -298,7 +299,7 @@
         assert 'bok' not in err
         # check with PYPYLOG defined to an empty string (same as undefined)
         out, err = cbuilder.cmdexec("", err=True, env={'PYPYLOG': ''})
-        assert out.strip() == 'got:a.'
+        assert out.strip() == 'got:a.-1.'
         assert 'toplevel' in err
         assert 'mycat' not in err
         assert 'foo 2 bar 3' not in err
@@ -307,7 +308,7 @@
         assert 'bok' not in err
         # check with PYPYLOG=:- (means print to stderr)
         out, err = cbuilder.cmdexec("", err=True, env={'PYPYLOG': ':-'})
-        assert out.strip() == 'got:bcda.'
+        assert out.strip() == 'got:bcda.-1.'
         assert 'toplevel' in err
         assert '{mycat' in err
         assert 'mycat}' in err
@@ -320,7 +321,8 @@
         path = udir.join('test_debug_xxx.log')
         out, err = cbuilder.cmdexec("", err=True,
                                     env={'PYPYLOG': ':%s' % path})
-        assert out.strip() == 'got:bcda.'
+        size = os.stat(str(path)).st_size
+        assert out.strip() == 'got:bcda.' + str(size) + '.'
         assert not err
         assert path.check(file=1)
         data = path.read()
@@ -335,7 +337,8 @@
         # check with PYPYLOG=somefilename
         path = udir.join('test_debug_xxx_prof.log')
         out, err = cbuilder.cmdexec("", err=True, env={'PYPYLOG': str(path)})
-        assert out.strip() == 'got:a.'
+        size = os.stat(str(path)).st_size
+        assert out.strip() == 'got:a.' + str(size) + '.'
         assert not err
         assert path.check(file=1)
         data = path.read()
@@ -351,7 +354,8 @@
         path = udir.join('test_debug_xxx_myc.log')
         out, err = cbuilder.cmdexec("", err=True,
                                     env={'PYPYLOG': 'myc:%s' % path})
-        assert out.strip() == 'got:bda.'
+        size = os.stat(str(path)).st_size
+        assert out.strip() == 'got:bda.' + str(size) + '.'
         assert not err
         assert path.check(file=1)
         data = path.read()
@@ -366,7 +370,8 @@
         path = udir.join('test_debug_xxx_cat.log')
         out, err = cbuilder.cmdexec("", err=True,
                                     env={'PYPYLOG': 'cat:%s' % path})
-        assert out.strip() == 'got:ca.'
+        size = os.stat(str(path)).st_size
+        assert out.strip() == 'got:ca.' + str(size) + '.'
         assert not err
         assert path.check(file=1)
         data = path.read()
@@ -380,7 +385,8 @@
         path = udir.join('test_debug_xxx_myc_cat2.log')
         out, err = cbuilder.cmdexec("", err=True,
                                     env={'PYPYLOG': 'myc,cat2:%s' % path})
-        assert out.strip() == 'got:bcda.'
+        size = os.stat(str(path)).st_size
+        assert out.strip() == 'got:bcda.' + str(size) + '.'
         assert not err
         assert path.check(file=1)
         data = path.read()
@@ -401,7 +407,7 @@
         path = udir.join('test_debug_does_not_show_up.log')
         out, err = cbuilder.cmdexec("", err=True,
                                     env={'PYPYLOG': ':%s' % path})
-        assert out.strip() == 'got:.'
+        assert out.strip() == 'got:.-1.'
         assert not err
         assert path.check(file=0)
 
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to