Commit ac887af7 authored by qinsoon's avatar qinsoon

[wip] rewrite two rpython_list tests as separated function (loaded as

dylib). cannot do more, since we need rpython runtime to init global
cells (list needs global cells for a template 0-length list)
parent cae72305
<?xml version="1.0" encoding="UTF-8"?>
<module type="RUST_MODULE" version="4">
<component name="FacetManager">
<facet type="Python" name="Python">
<configuration sdkName="" />
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
......@@ -11,7 +16,7 @@
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Rust &lt;mu&gt;" level="project" />
<orderEntry type="library" name="Cargo &lt;mu&gt;" level="project" />
<orderEntry type="library" name="Rust &lt;mu&gt;" level="project" />
\ No newline at end of file
from rpython.rtyper.lltypesystem import rffi, lltype
from rpython.rlib.rmu import zebu
from rpython.rlib.rmu import zebu as rmu
from rpython.translator.platform import platform
from util import fncptr_from_rpy_func, fncptr_from_py_script, may_spawn_proc
import ctypes, py, stat
......@@ -11,25 +11,25 @@ c_exit = rffi.llexternal('exit', [rffi.INT], lltype.Void, _nowrapper=True)
def test_rpython_list_new_empty():
def main(argv):
def new_empty():
a = []
c_exit(rffi.cast(rffi.INT, len(a)))
return 0
return a
res = run_boot_image(main, '/tmp/test_rpython_list_new_empty')
fn, (db, bdlgen) = fncptr_from_rpy_func(new_empty, [], lltype.Void)
assert res.returncode == 0, res.err
def test_rpython_list_new_5():
def main(argv):
def new_5():
a = [1, 2, 3, 4, 5]
c_exit(rffi.cast(rffi.INT, len(a)))
return 0
return len(a)
res = run_boot_image(main, '/tmp/test_rpython_list_new_5')
fn, (db, bdlgen) = fncptr_from_rpy_func(new_5, [], rffi.INT)
assert res.returncode == 5, res.err
assert fn() == 5
def test_rpython_list_append():
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment