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
ae488ce3
Commit
ae488ce3
authored
Aug 25, 2018
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Write regular time stamps into the test log to spot slow running tests.
parent
51c1f8fe
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
6 deletions
+46
-6
runtests.py
runtests.py
+46
-6
No files found.
runtests.py
View file @
ae488ce3
...
...
@@ -17,6 +17,7 @@ import traceback
import
warnings
import
zlib
import
glob
from
contextlib
import
contextmanager
try
:
import
platform
...
...
@@ -2042,11 +2043,13 @@ def main():
pool = multiprocessing.Pool(options.shard_count)
tasks = [(options, cmd_args, shard_num) for shard_num in range(options.shard_count)]
errors = []
for shard_num, return_code in pool.imap_unordered(runtests_callback, tasks):
if return_code != 0:
errors.append(shard_num)
print("FAILED (%s/%s)" % (shard_num, options.shard_count))
print("ALL DONE (%s/%s)" % (shard_num, options.shard_count))
# NOTE: create process pool before time stamper thread to avoid forking issues.
with time_stamper_thread():
for shard_num, return_code in pool.imap_unordered(runtests_callback, tasks):
if return_code != 0:
errors.append(shard_num)
print("FAILED (%s/%s)" % (shard_num, options.shard_count))
print("ALL DONE (%s/%s)" % (shard_num, options.shard_count))
pool.close()
pool.join()
if errors:
...
...
@@ -2055,7 +2058,8 @@ def main():
else:
return_code = 0
else:
_, return_code = runtests(options, cmd_args, coverage)
with time_stamper_thread():
_, return_code = runtests(options, cmd_args, coverage)
print("ALL DONE")
try:
...
...
@@ -2067,6 +2071,42 @@ def main():
sys.exit(return_code)
@contextmanager
def time_stamper_thread(interval=10):
"""
Print
regular
time
stamps
into
the
build
logs
to
find
slow
tests
.
@
param
interval
:
time
interval
in
seconds
"""
try:
_xrange = xrange
except NameError:
_xrange = range
import threading
from datetime import datetime
from time import sleep
interval = _xrange(interval * 4)
now = datetime.now
stop = False
def time_stamper():
while True:
for _ in interval:
if stop:
return
sleep(1./4)
print('
\
n
#### %s' % now())
thread = threading.Thread(target=time_stamper)
thread.start()
try:
yield
finally:
stop = True
thread.join()
def configure_cython(options):
global CompilationOptions, pyrex_default_options, cython_compile
from Cython.Compiler.Main import
\
...
...
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