Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
02d86d70
Commit
02d86d70
authored
Feb 20, 2015
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
extend nogil coverage test
parent
f4d42e80
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
8 deletions
+12
-8
tests/run/coverage_nogil.srctree
tests/run/coverage_nogil.srctree
+12
-8
No files found.
tests/run/coverage_nogil.srctree
View file @
02d86d70
...
@@ -26,19 +26,22 @@ plugins = Cython.Coverage
...
@@ -26,19 +26,22 @@ plugins = Cython.Coverage
# distutils: define_macros=CYTHON_TRACE=1
# distutils: define_macros=CYTHON_TRACE=1
cdef int func1(int a, int b) nogil:
cdef int func1(int a, int b) nogil:
cdef int x = 1 # 5
cdef int x # 5
cdef int c = func2(a) + b # 6
with gil: # 6
return x + c # 7
x = 1 # 7
cdef int c = func2(a) + b # 8
return x + c # 9
cdef int func2(int a) with gil:
cdef int func2(int a) with gil:
return a * 2 # 1
1
return a * 2 # 1
3
def call(int a, int b):
def call(int a, int b):
with nogil: # 15
a, b = b, a # 17
result = func1(a, b) # 16
with nogil: # 18
return result # 17
result = func1(b, a) # 19
return result # 20
######## coverage_test.py ########
######## coverage_test.py ########
...
@@ -81,8 +84,9 @@ def run_coverage(module):
...
@@ -81,8 +84,9 @@ def run_coverage(module):
executed = set(exec_lines) - set(missing_lines)
executed = set(exec_lines) - set(missing_lines)
# check that everything that runs with the gil owned was executed
# check that everything that runs with the gil owned was executed
assert all(line in executed for line in [1
1, 15, 17
]), '%s / %s' % (exec_lines, missing_lines)
assert all(line in executed for line in [1
3, 17, 18, 20
]), '%s / %s' % (exec_lines, missing_lines)
# currently, we do not trace nogil code lines, but that should eventually be implemented
# currently, we do not trace nogil code lines, but that should eventually be implemented
# we also don't trace 'with gil' blocks in 'nogil' functions
if __name__ == '__main__':
if __name__ == '__main__':
...
...
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