[pypy-svn] r40618 - pypy/branch/jit-virtual-world/pypy/jit/timeshifter/test
arigo at codespeak.net
arigo at codespeak.net
Fri Mar 16 20:54:46 CET 2007
Author: arigo
Date: Fri Mar 16 20:54:43 2007
New Revision: 40618
Modified:
pypy/branch/jit-virtual-world/pypy/jit/timeshifter/test/test_timeshift.py
pypy/branch/jit-virtual-world/pypy/jit/timeshifter/test/test_vlist.py
Log:
Three tests about obscure cases that trigger compile-time crashes.
Modified: pypy/branch/jit-virtual-world/pypy/jit/timeshifter/test/test_timeshift.py
==============================================================================
--- pypy/branch/jit-virtual-world/pypy/jit/timeshifter/test/test_timeshift.py (original)
+++ pypy/branch/jit-virtual-world/pypy/jit/timeshifter/test/test_timeshift.py Fri Mar 16 20:54:43 2007
@@ -1528,3 +1528,68 @@
res = self.timeshift(f, [sys.maxint, 1])
assert res == -42
self.check_insns({})
+
+ def test_nonzeroness_assert_while_compiling(self):
+ import py; py.test.skip("in-progress")
+ class X:
+ pass
+ class Y:
+ pass
+
+ def g(x, y):
+ if y.flag:
+ return x.value
+ else:
+ return -7
+
+ def h(n):
+ if n:
+ x = X()
+ x.value = n
+ return x
+ else:
+ return None
+
+ y = Y()
+
+ def f(n):
+ y.flag = True
+ g(h(n), y)
+ y.flag = False
+ return g(h(0), y)
+
+ res = self.timeshift(f, [42], policy=P_NOVIRTUAL)
+ assert res == -7
+
+ def test_segfault_while_compiling(self):
+ import py; py.test.skip("in-progress")
+ class X:
+ pass
+ class Y:
+ pass
+
+ def g(x, y):
+ x = hint(x, deepfreeze=True)
+ if y.flag:
+ return x.value
+ else:
+ return -7
+
+ def h(n):
+ if n:
+ x = X()
+ x.value = n
+ return x
+ else:
+ return None
+
+ y = Y()
+
+ def f(n):
+ y.flag = True
+ g(h(n), y)
+ y.flag = False
+ return g(h(0), y)
+
+ res = self.timeshift(f, [42], policy=P_NOVIRTUAL)
+ assert res == -7
Modified: pypy/branch/jit-virtual-world/pypy/jit/timeshifter/test/test_vlist.py
==============================================================================
--- pypy/branch/jit-virtual-world/pypy/jit/timeshifter/test/test_vlist.py (original)
+++ pypy/branch/jit-virtual-world/pypy/jit/timeshifter/test/test_vlist.py Fri Mar 16 20:54:43 2007
@@ -156,3 +156,33 @@
res = self.timeshift(ll_function, [4], policy=P_OOPSPEC)
assert res == -42
self.check_insns({})
+
+ def test_bogus_index_while_compiling(self):
+ import py; py.test.skip("in-progress")
+ class Y:
+ pass
+
+ def g(lst, y, n):
+ lst = hint(lst, deepfreeze=True)
+ if y.flag:
+ return lst[n]
+ else:
+ return -7
+
+ y = Y()
+ lst1 = [3, 4, 5]
+ lst2 = [6, 2]
+
+ def h(i):
+ if i == 1: return lst1
+ elif i == 2: return lst2
+ else: return []
+
+ def f(n):
+ y.flag = n < 3
+ g(h(1), y, n)
+ y.flag = n < 2
+ return g(h(2), y, n)
+
+ res = self.timeshift(f, [2], [0], policy=P_OOPSPEC)
+ assert res == -7
More information about the Pypy-commit
mailing list