Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mu-impl-fast
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
40
Issues
40
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
mu
mu-impl-fast
Commits
f2ef3e0c
Commit
f2ef3e0c
authored
Feb 15, 2017
by
qinsoon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more list tests
parent
7220a589
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
59 additions
and
2 deletions
+59
-2
tests/test_jit/test_rpython_list.py
tests/test_jit/test_rpython_list.py
+59
-2
No files found.
tests/test_jit/test_rpython_list.py
View file @
f2ef3e0c
...
...
@@ -63,9 +63,66 @@ def test_rpython_list_iter():
assert
res
.
returncode
==
45
,
res
.
err
@
pytest
.
mark
.
xfail
(
reason
=
"bug"
)
@
may_spawn_proc
def
test_rpython_list_addr_check_length1
():
Int64Ptr
=
lltype
.
Ptr
(
lltype
.
Array
(
rffi
.
LONGLONG
))
def
check
(
actual
,
expect
):
if
actual
!=
expect
:
c_exit
(
rffi
.
cast
(
rffi
.
INT
,
actual
))
def
main
(
argv
):
a
=
[]
a
.
append
(
42
)
from
rpython.rtyper.lltypesystem.llmemory
import
cast_ptr_to_adr
from
rpython.rlib.objectmodel
import
keepalive_until_here
addr
=
cast_ptr_to_adr
(
a
)
mem
=
rffi
.
cast
(
Int64Ptr
,
addr
)
# ignore mem[0]
check
(
mem
[
1
],
1
)
keepalive_until_here
(
argv
)
return
0
res
=
run_boot_image
(
main
,
'/tmp/test_rpython_list_addr_check_length1'
)
assert
res
.
returncode
==
0
,
'returncode = %d
\n
%s'
%
(
res
.
returncode
,
res
.
err
)
@
pytest
.
mark
.
xfail
(
reason
=
"bug"
)
@
may_spawn_proc
def
test_rpython_list_addr_check_length2
():
Int64Ptr
=
lltype
.
Ptr
(
lltype
.
Array
(
rffi
.
LONGLONG
))
def
check
(
actual
,
expect
):
if
actual
!=
expect
:
c_exit
(
rffi
.
cast
(
rffi
.
INT
,
actual
))
def
main
(
argv
):
a
=
[]
a
.
append
(
42
)
a
.
append
(
43
)
from
rpython.rtyper.lltypesystem.llmemory
import
cast_ptr_to_adr
from
rpython.rlib.objectmodel
import
keepalive_until_here
addr
=
cast_ptr_to_adr
(
a
)
mem
=
rffi
.
cast
(
Int64Ptr
,
addr
)
# ignore mem[0]
check
(
mem
[
1
],
2
)
keepalive_until_here
(
argv
)
return
0
res
=
run_boot_image
(
main
,
'/tmp/test_rpython_list_addr_check_length2'
)
assert
res
.
returncode
==
0
,
'returncode = %d
\n
%s'
%
(
res
.
returncode
,
res
.
err
)
@
pytest
.
mark
.
xfail
(
reason
=
"mem[1] is not 10? but mem[0] is 10, need to look into this"
)
@
may_spawn_proc
def
test_rpython_list_
check_by_addr
():
def
test_rpython_list_
addr_check_all
():
Int64Ptr
=
lltype
.
Ptr
(
lltype
.
Array
(
rffi
.
LONGLONG
))
def
check
(
a
,
b
):
...
...
@@ -88,6 +145,6 @@ def test_rpython_list_check_by_addr():
return
0
res
=
run_boot_image
(
main
,
'/tmp/test_rpython_list_
check_by_addr
'
)
res
=
run_boot_image
(
main
,
'/tmp/test_rpython_list_
addr_check_all
'
)
assert
res
.
returncode
==
0
,
'returncode = %d
\n
%s'
%
(
res
.
returncode
,
res
.
err
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment