[pypy-svn] r27407 - pypy/dist/pypy/translator/c/test
cfbolz at codespeak.net
cfbolz at codespeak.net
Thu May 18 13:22:32 CEST 2006
Author: cfbolz
Date: Thu May 18 13:22:31 2006
New Revision: 27407
Modified:
pypy/dist/pypy/translator/c/test/test_lladdresses.py
Log:
this test started failing because since from 27370 also raw_mallocs are counted
in the total number of mallocs. call raw_free where appropriate to stop leaking
memory and to pass the tests again.
Modified: pypy/dist/pypy/translator/c/test/test_lladdresses.py
==============================================================================
--- pypy/dist/pypy/translator/c/test/test_lladdresses.py (original)
+++ pypy/dist/pypy/translator/c/test/test_lladdresses.py Thu May 18 13:22:31 2006
@@ -24,7 +24,9 @@
def f(value):
addr = raw_malloc(16)
addr.signed[0] = value
- return addr.signed[0]
+ result = addr.signed[0]
+ raw_free(addr)
+ return result
fc = compile(f, [int])
res = fc(42)
assert res == 42
@@ -51,7 +53,9 @@
addr += offset
addr.char[-offset] = char
addr -= offset
- return addr.char[0]
+ result = addr.char[0]
+ raw_free(addr)
+ return result
fc = compile(f, [int, SomeChar()])
res = fc(10, "c")
assert res == "c"
@@ -67,6 +71,8 @@
result = addr1.signed[0] == 12
result = result and (addr1 + 10).signed[0] == 42
result = result and (addr1 + 20).char[0] == "a"
+ raw_free(addr)
+ raw_free(addr1)
return result
fc = compile(f, [])
res = fc()
@@ -75,7 +81,8 @@
def test_pointer_comparison():
def f():
result = 0
- for addr1 in [raw_malloc(1), NULL]:
+ addresses = [raw_malloc(1), NULL]
+ for addr1 in addresses:
addr2 = addr1 + 1
result = result * 2 + int(addr1 == addr2)
result = result * 2 + int(addr1 != addr2)
@@ -83,6 +90,7 @@
result = result * 2 + int(addr1 <= addr2)
result = result * 2 + int(addr1 > addr2)
result = result * 2 + int(addr1 >= addr2)
+ raw_free(addresses[0])
return result
fc = compile(f, [])
res = fc()
More information about the Pypy-commit
mailing list