Commit b6f927e4 authored by Stefan Behnel's avatar Stefan Behnel

runtests: print the shard number in front of the test name to show which was...

runtests: print the shard number in front of the test name to show which was the last test in case it hangs.
parent 6e2c8d0c
...@@ -614,6 +614,7 @@ class TestBuilder(object): ...@@ -614,6 +614,7 @@ class TestBuilder(object):
self.workdir = workdir self.workdir = workdir
self.selectors = selectors self.selectors = selectors
self.exclude_selectors = exclude_selectors self.exclude_selectors = exclude_selectors
self.shard_num = options.shard_num
self.annotate = options.annotate_source self.annotate = options.annotate_source
self.cleanup_workdir = options.cleanup_workdir self.cleanup_workdir = options.cleanup_workdir
self.cleanup_sharedlibs = options.cleanup_sharedlibs self.cleanup_sharedlibs = options.cleanup_sharedlibs
...@@ -690,7 +691,8 @@ class TestBuilder(object): ...@@ -690,7 +691,8 @@ class TestBuilder(object):
if ext == '.srctree': if ext == '.srctree':
if 'cpp' not in tags['tag'] or 'cpp' in self.languages: if 'cpp' not in tags['tag'] or 'cpp' in self.languages:
suite.addTest(EndToEndTest(filepath, workdir, self.cleanup_workdir, stats=self.stats)) suite.addTest(EndToEndTest(
filepath, workdir, self.cleanup_workdir, stats=self.stats, shard_num=self.shard_num))
continue continue
# Choose the test suite. # Choose the test suite.
...@@ -720,7 +722,8 @@ class TestBuilder(object): ...@@ -720,7 +722,8 @@ class TestBuilder(object):
if pyver if pyver
] ]
if not min_py_ver or any(sys.version_info >= min_ver for min_ver in min_py_ver): if not min_py_ver or any(sys.version_info >= min_ver for min_ver in min_py_ver):
suite.addTest(PureDoctestTestCase(module, os.path.join(path, filename), tags, stats=self.stats)) suite.addTest(PureDoctestTestCase(
module, os.path.join(path, filename), tags, stats=self.stats, shard_num=self.shard_num))
return suite return suite
...@@ -781,6 +784,7 @@ class TestBuilder(object): ...@@ -781,6 +784,7 @@ class TestBuilder(object):
cleanup_failures=self.cleanup_failures, cleanup_failures=self.cleanup_failures,
cython_only=self.cython_only, cython_only=self.cython_only,
doctest_selector=self.doctest_selector, doctest_selector=self.doctest_selector,
shard_num=self.shard_num,
fork=self.fork, fork=self.fork,
language_level=self.language_level, language_level=self.language_level,
warning_errors=warning_errors, warning_errors=warning_errors,
...@@ -823,7 +827,7 @@ class CythonCompileTestCase(unittest.TestCase): ...@@ -823,7 +827,7 @@ class CythonCompileTestCase(unittest.TestCase):
expect_errors=False, expect_warnings=False, annotate=False, cleanup_workdir=True, expect_errors=False, expect_warnings=False, annotate=False, cleanup_workdir=True,
cleanup_sharedlibs=True, cleanup_failures=True, cython_only=False, doctest_selector=None, cleanup_sharedlibs=True, cleanup_failures=True, cython_only=False, doctest_selector=None,
fork=True, language_level=2, warning_errors=False, fork=True, language_level=2, warning_errors=False,
test_determinism=False, test_determinism=False, shard_num=0,
common_utility_dir=None, pythran_dir=None, stats=None): common_utility_dir=None, pythran_dir=None, stats=None):
self.test_directory = test_directory self.test_directory = test_directory
self.tags = tags self.tags = tags
...@@ -840,6 +844,7 @@ class CythonCompileTestCase(unittest.TestCase): ...@@ -840,6 +844,7 @@ class CythonCompileTestCase(unittest.TestCase):
self.cleanup_failures = cleanup_failures self.cleanup_failures = cleanup_failures
self.cython_only = cython_only self.cython_only = cython_only
self.doctest_selector = doctest_selector self.doctest_selector = doctest_selector
self.shard_num = shard_num
self.fork = fork self.fork = fork
self.language_level = language_level self.language_level = language_level
self.warning_errors = warning_errors self.warning_errors = warning_errors
...@@ -850,7 +855,8 @@ class CythonCompileTestCase(unittest.TestCase): ...@@ -850,7 +855,8 @@ class CythonCompileTestCase(unittest.TestCase):
unittest.TestCase.__init__(self) unittest.TestCase.__init__(self)
def shortDescription(self): def shortDescription(self):
return "compiling (%s%s) %s" % (self.language, "/pythran" if self.pythran_dir is not None else "", self.name) return "[%d] compiling (%s%s) %s" % (
self.shard_num, self.language, "/pythran" if self.pythran_dir is not None else "", self.name)
def setUp(self): def setUp(self):
from Cython.Compiler import Options from Cython.Compiler import Options
...@@ -1246,7 +1252,8 @@ class CythonRunTestCase(CythonCompileTestCase): ...@@ -1246,7 +1252,8 @@ class CythonRunTestCase(CythonCompileTestCase):
if self.cython_only: if self.cython_only:
return CythonCompileTestCase.shortDescription(self) return CythonCompileTestCase.shortDescription(self)
else: else:
return "compiling (%s%s) and running %s" % (self.language, "/pythran" if self.pythran_dir is not None else "", self.name) return "[%d] compiling (%s%s) and running %s" % (
self.shard_num, self.language, "/pythran" if self.pythran_dir is not None else "", self.name)
def run(self, result=None): def run(self, result=None):
if result is None: if result is None:
...@@ -1371,15 +1378,17 @@ def run_forked_test(result, run_func, test_name, fork=True): ...@@ -1371,15 +1378,17 @@ def run_forked_test(result, run_func, test_name, fork=True):
class PureDoctestTestCase(unittest.TestCase): class PureDoctestTestCase(unittest.TestCase):
def __init__(self, module_name, module_path, tags, stats=None): def __init__(self, module_name, module_path, tags, stats=None, shard_num=0):
self.tags = tags self.tags = tags
self.module_name = self.name = module_name self.module_name = self.name = module_name
self.module_path = module_path self.module_path = module_path
self.stats = stats self.stats = stats
self.shard_num = shard_num
unittest.TestCase.__init__(self, 'run') unittest.TestCase.__init__(self, 'run')
def shortDescription(self): def shortDescription(self):
return "running pure doctests in %s" % self.module_name return "[%d] running pure doctests in %s" % (
self.shard_num, self.module_name)
def run(self, result=None): def run(self, result=None):
if result is None: if result is None:
...@@ -1484,7 +1493,8 @@ class PartialTestResult(TextTestResult): ...@@ -1484,7 +1493,8 @@ class PartialTestResult(TextTestResult):
class CythonUnitTestCase(CythonRunTestCase): class CythonUnitTestCase(CythonRunTestCase):
def shortDescription(self): def shortDescription(self):
return "compiling (%s) tests in %s" % (self.language, self.name) return "[%d] compiling (%s) tests in %s" % (
self.shard_num, self.language, self.name)
def run_tests(self, result, ext_so_path): def run_tests(self, result, ext_so_path):
with self.stats.time(self.name, self.language, 'import'): with self.stats.time(self.name, self.language, 'import'):
...@@ -1680,12 +1690,13 @@ class EndToEndTest(unittest.TestCase): ...@@ -1680,12 +1690,13 @@ class EndToEndTest(unittest.TestCase):
""" """
cython_root = os.path.dirname(os.path.abspath(__file__)) cython_root = os.path.dirname(os.path.abspath(__file__))
def __init__(self, treefile, workdir, cleanup_workdir=True, stats=None): def __init__(self, treefile, workdir, cleanup_workdir=True, stats=None, shard_num=0):
self.name = os.path.splitext(os.path.basename(treefile))[0] self.name = os.path.splitext(os.path.basename(treefile))[0]
self.treefile = treefile self.treefile = treefile
self.workdir = os.path.join(workdir, self.name) self.workdir = os.path.join(workdir, self.name)
self.cleanup_workdir = cleanup_workdir self.cleanup_workdir = cleanup_workdir
self.stats = stats self.stats = stats
self.shard_num = shard_num
cython_syspath = [self.cython_root] cython_syspath = [self.cython_root]
for path in sys.path: for path in sys.path:
if path.startswith(self.cython_root) and path not in cython_syspath: if path.startswith(self.cython_root) and path not in cython_syspath:
...@@ -1697,7 +1708,8 @@ class EndToEndTest(unittest.TestCase): ...@@ -1697,7 +1708,8 @@ class EndToEndTest(unittest.TestCase):
unittest.TestCase.__init__(self) unittest.TestCase.__init__(self)
def shortDescription(self): def shortDescription(self):
return "End-to-end %s" % self.name return "[%d] End-to-end %s" % (
self.shard_num, self.name)
def setUp(self): def setUp(self):
from Cython.TestUtils import unpack_source_tree from Cython.TestUtils import unpack_source_tree
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment