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
228ffec9
Commit
228ffec9
authored
Aug 06, 2020
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adapt existing cypclass locking unit tests
parent
5aef3d90
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
13 deletions
+17
-13
tests/errors/cypclass_lock_error.pyx
tests/errors/cypclass_lock_error.pyx
+6
-6
tests/run/cypclass_acthon.pyx
tests/run/cypclass_acthon.pyx
+6
-4
tests/run/cypclass_lock.pyx
tests/run/cypclass_lock.pyx
+5
-3
No files found.
tests/errors/cypclass_lock_error.pyx
View file @
228ffec9
...
@@ -26,10 +26,10 @@ def incorrect_locks():
...
@@ -26,10 +26,10 @@ def incorrect_locks():
take_read_locked
(
obj
)
take_read_locked
(
obj
)
_ERRORS
=
u"""
_ERRORS
=
u"""
20:4:
This expression is not correctly locked (write lock need
ed)
20:4:
Reference 'obj' is not correctly locked in this expression (write lock requir
ed)
21:4:
This expression is not correctly locked (read lock need
ed)
21:4:
Reference 'obj' is not correctly locked in this expression (read lock requir
ed)
23:8:
This expression is not correctly locked (write lock need
ed)
23:8:
Reference 'obj' is not correctly locked in this expression (write lock requir
ed)
24:26:
This expression is not correctly locked (write lock need
ed)
24:26:
Reference 'obj' is not correctly locked in this expression (write lock requir
ed)
25:4:
This expression is not correctly locked (read lock need
ed)
25:4:
Reference 'obj' is not correctly locked in this expression (read lock requir
ed)
26:21:
This expression is not correctly locked (read lock need
ed)
26:21:
Reference 'obj' is not correctly locked in this expression (write lock requir
ed)
"""
"""
tests/run/cypclass_acthon.pyx
View file @
228ffec9
...
@@ -46,8 +46,9 @@ cdef cypclass BasicQueue(ActhonQueueInterface) checklock:
...
@@ -46,8 +46,9 @@ cdef cypclass BasicQueue(ActhonQueueInterface) checklock:
one_message_processed
=
next_message
.
activate
()
one_message_processed
=
next_message
.
activate
()
if
one_message_processed
:
if
one_message_processed
:
if
next_message
.
_sync_method
is
not
NULL
:
if
next_message
.
_sync_method
is
not
NULL
:
with
wlocked
next_message
.
_sync_method
:
next_sync_method
=
next_message
.
_sync_method
next_message
.
_sync_method
.
removeActivity
(
next_message
)
with
wlocked
next_sync_method
:
next_sync_method
.
removeActivity
(
next_message
)
else
:
else
:
self
.
_queue
.
push_back
(
next_message
)
self
.
_queue
.
push_back
(
next_message
)
# Don't forget to incref to avoid premature deallocation
# Don't forget to incref to avoid premature deallocation
...
@@ -125,8 +126,9 @@ cdef cypclass ActivityCounterSync(ActhonSyncInterface) checklock:
...
@@ -125,8 +126,9 @@ cdef cypclass ActivityCounterSync(ActhonSyncInterface) checklock:
bint
isActivable
(
self
)
const
:
bint
isActivable
(
self
)
const
:
cdef
bint
res
=
True
cdef
bint
res
=
True
if
self
.
previous_sync
is
not
NULL
:
if
self
.
previous_sync
is
not
NULL
:
with
rlocked
self
.
previous_sync
:
prev_sync
=
self
.
previous_sync
res
=
self
.
previous_sync
.
isCompleted
()
with
rlocked
prev_sync
:
res
=
prev_sync
.
isCompleted
()
return
res
return
res
cdef
cypclass
A
checklock
activable
:
cdef
cypclass
A
checklock
activable
:
...
...
tests/run/cypclass_lock.pyx
View file @
228ffec9
...
@@ -69,6 +69,8 @@ def test_lock_traversal(n):
...
@@ -69,6 +69,8 @@ def test_lock_traversal(n):
42
42
"""
"""
container
=
Container
()
container
=
Container
()
with
rlocked
container
,
wlocked
container
.
object
:
with
rlocked
container
:
argument_recursivity
(
container
.
object
,
n
)
contained
=
container
.
object
print
container
.
object
.
getter
()
with
wlocked
contained
:
argument_recursivity
(
contained
,
n
)
print
contained
.
getter
()
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