Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gevent
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gevent
Commits
6390aec4
Commit
6390aec4
authored
Dec 05, 2017
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Debugging the test__core.py memory corruption bug seen on travis.
parent
cbae4c9b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
64 additions
and
48 deletions
+64
-48
.travis.yml
.travis.yml
+9
-9
src/gevent/libuv/loop.py
src/gevent/libuv/loop.py
+3
-3
src/gevent/libuv/watcher.py
src/gevent/libuv/watcher.py
+3
-2
src/greentest/greentest.py
src/greentest/greentest.py
+6
-0
src/greentest/test__core.py
src/greentest/test__core.py
+43
-34
No files found.
.travis.yml
View file @
6390aec4
...
...
@@ -11,16 +11,16 @@ env:
# These are ordered to get as much diversity in the
# first group of parallel runs (4) as posible
-
TASK=test-py27-libuv
-
TASK=test-py27-noembed
-
TASK=test-pypy
-
TASK=test-py36
#
- TASK=test-py27-noembed
#
- TASK=test-pypy
#
- TASK=test-py36
-
TASK=lint-py27
-
TASK=test-pypy3
-
TASK=test-py35
-
TASK=test-py278
-
TASK=test-py27
-
TASK=test-py34
-
TASK=test-py27-cffi
#
- TASK=test-pypy3
#
- TASK=test-py35
#
- TASK=test-py278
#
- TASK=test-py27
#
- TASK=test-py34
#
- TASK=test-py27-cffi
matrix
:
fast_finish
:
true
...
...
src/gevent/libuv/loop.py
View file @
6390aec4
"""
libuv loop implementation
"""
# pylint: disable=no-member
from
__future__
import
absolute_import
,
print_function
import
os
...
...
@@ -15,8 +15,8 @@ from gevent._ffi.loop import AbstractLoop
from
gevent.libuv
import
_corecffi
# pylint:disable=no-name-in-module,import-error
from
gevent._ffi.loop
import
assign_standard_callbacks
ffi
=
_corecffi
.
ffi
# pylint:disable=no-member
libuv
=
_corecffi
.
lib
# pylint:disable=no-member
ffi
=
_corecffi
.
ffi
libuv
=
_corecffi
.
lib
__all__
=
[
]
...
...
src/gevent/libuv/watcher.py
View file @
6390aec4
# pylint: disable=too-many-lines, protected-access, redefined-outer-name, not-callable
# pylint: disable=no-member
from
__future__
import
absolute_import
,
print_function
import
functools
...
...
@@ -6,8 +7,8 @@ import weakref
import
gevent.libuv._corecffi
as
_corecffi
# pylint:disable=no-name-in-module,import-error
ffi
=
_corecffi
.
ffi
# pylint:disable=no-member
libuv
=
_corecffi
.
lib
# pylint:disable=no-member
ffi
=
_corecffi
.
ffi
libuv
=
_corecffi
.
lib
from
gevent._ffi
import
watcher
as
_base
...
...
src/greentest/greentest.py
View file @
6390aec4
...
...
@@ -42,6 +42,7 @@ import _six as six
PYPY
=
hasattr
(
sys
,
'pypy_version_info'
)
VERBOSE
=
sys
.
argv
.
count
(
'-v'
)
>
1
LIBUV
=
os
.
getenv
(
'GEVENT_CORE_CFFI_ONLY'
)
==
'libuv'
# XXX: Formalize this better
if
'--debug-greentest'
in
sys
.
argv
:
sys
.
argv
.
remove
(
'--debug-greentest'
)
...
...
@@ -138,6 +139,11 @@ skipIf = unittest.skipIf
EXPECT_POOR_TIMER_RESOLUTION
=
PYPY3
or
RUNNING_ON_APPVEYOR
if
LIBUV
:
skipOnLibuv
=
unittest
.
skip
else
:
skipOnLibuv
=
_do_not_skip
class
ExpectedException
(
Exception
):
"""An exception whose traceback should be ignored"""
...
...
src/greentest/test__core.py
View file @
6390aec4
# pylint:disable=no-member
import
sys
from
greentest
import
TestCase
,
main
from
gevent
import
core
import
unittest
from
greentest
import
main
,
skipOnLibuv
from
gevent
import
core
class
Test
(
TestCase
):
switch_expected
=
False
__timeout__
=
None
@
unittest
.
skip
(
"Debugging"
)
class
TestCore
(
unittest
.
TestCase
):
def
test_get_version
(
self
):
version
=
core
.
get_version
()
assert
isinstance
(
version
,
str
),
repr
(
version
)
assert
version
,
repr
(
version
)
self
.
assertIsInstance
(
version
,
str
)
self
.
assertTrue
(
version
)
header_version
=
core
.
get_header_version
()
assert
isinstance
(
header_version
,
str
),
repr
(
header_version
)
assert
header_version
,
repr
(
header_version
)
self
.
assertIsInstance
(
header_version
,
str
)
self
.
assertTrue
(
header_version
)
self
.
assertEqual
(
version
,
header_version
)
@
unittest
.
skipIf
(
hasattr
(
core
,
'libuv'
),
"flags are libev-only"
)
def
test_flags_conversion
(
self
):
if
sys
.
platform
!=
'win32'
:
self
.
assertEqual
(
core
.
loop
(
2
,
default
=
False
).
backend_int
,
2
)
self
.
assertEqual
(
core
.
loop
(
'select'
,
default
=
False
).
backend
,
'select'
)
self
.
assertEqual
(
core
.
_flags_to_int
(
None
),
0
)
self
.
assertEqual
(
core
.
_flags_to_int
([
'kqueue'
,
'SELECT'
]),
core
.
BACKEND_KQUEUE
|
core
.
BACKEND_SELECT
)
self
.
assertEqual
(
core
.
_flags_to_list
(
core
.
BACKEND_PORT
|
core
.
BACKEND_POLL
),
[
'port'
,
'poll'
])
self
.
assertRaises
(
ValueError
,
core
.
loop
,
[
'port'
,
'blabla'
])
self
.
assertRaises
(
TypeError
,
core
.
loop
,
object
())
def
test_events_conversion
(
self
):
self
.
assertEqual
(
core
.
_events_to_str
(
core
.
READ
|
core
.
WRITE
),
'READ|WRITE'
)
def
test_EVENTS
(
self
):
self
.
assertEqual
(
str
(
core
.
EVENTS
),
'gevent.core.EVENTS'
)
self
.
assertEqual
(
repr
(
core
.
EVENTS
),
'gevent.core.EVENTS'
)
class
TestWatchers
(
unittest
.
TestCase
):
def
test_io
(
self
):
if
sys
.
platform
==
'win32'
:
...
...
@@ -43,10 +25,13 @@ class Test(TestCase):
else
:
Error
=
ValueError
win32
=
False
self
.
assertRaises
(
Error
,
core
.
loop
().
io
,
-
1
,
1
)
with
self
.
assertRaises
(
Error
):
core
.
loop
().
io
(
-
1
,
1
)
if
hasattr
(
core
,
'TIMER'
):
# libev
self
.
assertRaises
(
ValueError
,
core
.
loop
().
io
,
1
,
core
.
TIMER
)
with
self
.
assertRaises
(
ValueError
):
core
.
loop
().
io
(
1
,
core
.
TIMER
)
# Test we can set events and io before it's started
if
not
win32
:
# We can't do this with arbitrary FDs on windows;
...
...
@@ -61,12 +46,36 @@ class Test(TestCase):
else
:
self
.
assertEqual
(
core
.
_events_to_str
(
io
.
events
),
'WRITE'
)
def
test_timer
(
self
):
self
.
assertRaises
(
ValueError
,
core
.
loop
().
timer
,
1
,
-
1
)
def
test_timer_constructor
(
self
):
with
self
.
assertRaises
(
ValueError
):
core
.
loop
().
timer
(
1
,
-
1
)
def
test_signal
(
self
):
self
.
assertRaises
(
ValueError
,
core
.
loop
().
signal
,
1000
)
def
test_signal_constructor
(
self
):
with
self
.
assertRaises
(
ValueError
):
core
.
loop
().
signal
(
1000
)
@
skipOnLibuv
(
"Tests for libev-only functions"
)
class
TestLibev
(
unittest
.
TestCase
):
def
test_flags_conversion
(
self
):
if
sys
.
platform
!=
'win32'
:
self
.
assertEqual
(
core
.
loop
(
2
,
default
=
False
).
backend_int
,
2
)
self
.
assertEqual
(
core
.
loop
(
'select'
,
default
=
False
).
backend
,
'select'
)
self
.
assertEqual
(
core
.
_flags_to_int
(
None
),
0
)
self
.
assertEqual
(
core
.
_flags_to_int
([
'kqueue'
,
'SELECT'
]),
core
.
BACKEND_KQUEUE
|
core
.
BACKEND_SELECT
)
self
.
assertEqual
(
core
.
_flags_to_list
(
core
.
BACKEND_PORT
|
core
.
BACKEND_POLL
),
[
'port'
,
'poll'
])
self
.
assertRaises
(
ValueError
,
core
.
loop
,
[
'port'
,
'blabla'
])
self
.
assertRaises
(
TypeError
,
core
.
loop
,
object
())
class
TestEvents
(
unittest
.
TestCase
):
def
test_events_conversion
(
self
):
self
.
assertEqual
(
core
.
_events_to_str
(
core
.
READ
|
core
.
WRITE
),
'READ|WRITE'
)
def
test_EVENTS
(
self
):
self
.
assertEqual
(
str
(
core
.
EVENTS
),
'gevent.core.EVENTS'
)
self
.
assertEqual
(
repr
(
core
.
EVENTS
),
'gevent.core.EVENTS'
)
if
__name__
==
'__main__'
:
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