Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vincent Pelletier
neoppod
Commits
497edbe1
Commit
497edbe1
authored
Jun 23, 2020
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
master: add support for PyPy
parent
f4cb59d2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
3 deletions
+48
-3
neo/lib/connection.py
neo/lib/connection.py
+12
-1
neo/lib/logger.py
neo/lib/logger.py
+5
-1
neo/scripts/runner.py
neo/scripts/runner.py
+3
-0
neo/tests/functional/__init__.py
neo/tests/functional/__init__.py
+28
-1
No files found.
neo/lib/connection.py
View file @
497edbe1
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
from
functools
import
wraps
from
functools
import
wraps
from
time
import
time
from
time
import
time
import
msgpack
import
msgpack
from
msgpack.exceptions
import
UnpackValueError
from
msgpack.exceptions
import
OutOfData
,
UnpackValueError
from
.
import
attributeTracker
,
logging
from
.
import
attributeTracker
,
logging
from
.connector
import
ConnectorException
,
ConnectorDelayedConnection
from
.connector
import
ConnectorException
,
ConnectorDelayedConnection
...
@@ -25,6 +25,17 @@ from .locking import RLock
...
@@ -25,6 +25,17 @@ from .locking import RLock
from
.protocol
import
uuid_str
,
Errors
,
PacketMalformedError
,
Packets
,
\
from
.protocol
import
uuid_str
,
Errors
,
PacketMalformedError
,
Packets
,
\
Unpacker
Unpacker
try
:
msgpack
.
Unpacker
().
read_bytes
(
1
)
except
OutOfData
:
# fallback implementation
# monkey-patch for upstream issues 259 & 352
def
read_bytes
(
self
,
n
):
ret
=
self
.
_read
(
min
(
n
,
len
(
self
.
_buffer
)
-
self
.
_buff_i
))
self
.
_consume
()
return
ret
msgpack
.
Unpacker
.
read_bytes
=
read_bytes
del
read_bytes
@
apply
@
apply
class
dummy_read_buffer
(
msgpack
.
Unpacker
):
class
dummy_read_buffer
(
msgpack
.
Unpacker
):
def
feed
(
self
,
_
):
def
feed
(
self
,
_
):
...
...
neo/lib/logger.py
View file @
497edbe1
...
@@ -167,7 +167,11 @@ class NEOLogger(Logger):
...
@@ -167,7 +167,11 @@ class NEOLogger(Logger):
q
(
"PRAGMA synchronous = OFF"
)
q
(
"PRAGMA synchronous = OFF"
)
if
1
:
# Not only when logging everything,
if
1
:
# Not only when logging everything,
# but also for interoperability with logrotate.
# but also for interoperability with logrotate.
q
(
"PRAGMA journal_mode = MEMORY"
)
# Close the returned cursor to work around the following
# OperationalError with PyPy:
# cannot commit transaction - SQL statements in progress
# XXX: Is it enough?
q
(
"PRAGMA journal_mode = MEMORY"
).
close
()
for
t
,
columns
in
((
'log'
,
(
for
t
,
columns
in
((
'log'
,
(
"level INTEGER NOT NULL"
,
"level INTEGER NOT NULL"
,
"pathname TEXT"
,
"pathname TEXT"
,
...
...
neo/scripts/runner.py
View file @
497edbe1
...
@@ -318,6 +318,9 @@ class TestRunner(BenchmarkRunner):
...
@@ -318,6 +318,9 @@ class TestRunner(BenchmarkRunner):
" passed.")
" passed.")
parser.epilog = """
parser.epilog = """
Environment Variables:
Environment Variables:
NEO_PYPY PyPy executable to run master nodes in functional
tests (and also in zodb tests depending on
NEO_TEST_ZODB_FUNCTIONAL).
NEO_TESTS_ADAPTER Default is SQLite for threaded clusters,
NEO_TESTS_ADAPTER Default is SQLite for threaded clusters,
MySQL otherwise.
MySQL otherwise.
...
...
neo/tests/functional/__init__.py
View file @
497edbe1
...
@@ -55,6 +55,26 @@ command_dict = {
...
@@ -55,6 +55,26 @@ command_dict = {
DELAY_SAFETY_MARGIN
=
10
DELAY_SAFETY_MARGIN
=
10
MAX_START_TIME
=
30
MAX_START_TIME
=
30
PYPY_EXECUTABLE
=
os
.
getenv
(
'NEO_PYPY'
)
if
PYPY_EXECUTABLE
:
import
neo
,
msgpack
PYPY_TEMPLATE
=
"""
\
import os, signal, sys
def sigusr2(*_):
os.close(%r)
os.kill(os.getpid(), signal.SIGSTOP)
signal.signal(signal.SIGUSR2, sigusr2)
os.close(%r)
os.write(%r, '
\
\
0')
sys.path.append({!r}); import msgpack; del sys.path[-1]
sys.path.insert(0, {!r}); import neo; del sys.path[0]
from neo.lib import logging
logging.default_root_handler.handle = lambda record: None
logging.backlog(%s, %s)
from neo.scripts.%s import main
main()
"""
.
format
(
os
.
path
.
dirname
(
*
msgpack
.
__path__
),
os
.
path
.
dirname
(
*
neo
.
__path__
))
class
NodeProcessError
(
Exception
):
class
NodeProcessError
(
Exception
):
pass
pass
...
@@ -174,6 +194,13 @@ class Process(object):
...
@@ -174,6 +194,13 @@ class Process(object):
from
coverage
import
Coverage
from
coverage
import
Coverage
coverage
=
Coverage
(
coverage_data_path
)
coverage
=
Coverage
(
coverage_data_path
)
coverage
.
start
()
coverage
.
start
()
elif
PYPY_EXECUTABLE
and
command
==
'neomaster'
:
os
.
execlp
(
PYPY_EXECUTABLE
,
PYPY_EXECUTABLE
,
'-c'
,
PYPY_TEMPLATE
%
(
w
,
self
.
_coverage_fd
,
w
,
logging
.
_max_size
,
logging
.
_max_packet
,
command
),
*
args
)
# XXX: Sometimes, the handler is not called immediately.
# XXX: Sometimes, the handler is not called immediately.
# The process is stuck at an unknown place and the test
# The process is stuck at an unknown place and the test
# never ends. strace unlocks:
# never ends. strace unlocks:
...
@@ -186,7 +213,7 @@ class Process(object):
...
@@ -186,7 +213,7 @@ class Process(object):
os
.
close
(
self
.
_coverage_fd
)
os
.
close
(
self
.
_coverage_fd
)
os
.
write
(
w
,
'
\
0
'
)
os
.
write
(
w
,
'
\
0
'
)
sys
.
argv
=
[
command
]
+
args
sys
.
argv
=
[
command
]
+
args
setproctitle
(
self
.
command
)
setproctitle
(
command
)
for
on_fork
in
self
.
on_fork
:
for
on_fork
in
self
.
on_fork
:
on_fork
()
on_fork
()
self
.
run
()
self
.
run
()
...
...
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