aboutsummaryrefslogtreecommitdiff
path: root/run_project_tests.py
diff options
context:
space:
mode:
authorChristoph Reiter <reiter.christoph@gmail.com>2018-01-27 13:38:34 +0100
committerJussi Pakkanen <jpakkane@gmail.com>2018-01-30 07:06:51 +1100
commit4e5ad57161a475dfab1c1a4edde075b2620b9f75 (patch)
treec7555097643a70adfe6fc7df39a1461dc3ab37e5 /run_project_tests.py
parent6a1a56ab57ed29d31c9550d9725e60e2fb67ac6c (diff)
downloadmeson-4e5ad57161a475dfab1c1a4edde075b2620b9f75.zip
meson-4e5ad57161a475dfab1c1a4edde075b2620b9f75.tar.gz
meson-4e5ad57161a475dfab1c1a4edde075b2620b9f75.tar.bz2
run_project_tests: Remove workaround for missing concurrent.futures.ProcessPoolExecutor support
This removes the workaround code added in https://github.com/mesonbuild/meson/commit/52e1b0a3c909 The bug in the MSYS2 Python3 build has been fixed for some time now, see https://github.com/Alexpux/MINGW-packages/pull/2619 The original commit noted that this might be helpful for OpenBSD, but that has sem_open support since version 5.5 released 4 years ago: https://www.openbsd.org/55.html
Diffstat (limited to 'run_project_tests.py')
-rwxr-xr-xrun_project_tests.py52
1 files changed, 2 insertions, 50 deletions
diff --git a/run_project_tests.py b/run_project_tests.py
index d191e28..1d17000 100755
--- a/run_project_tests.py
+++ b/run_project_tests.py
@@ -31,7 +31,7 @@ import argparse
import xml.etree.ElementTree as ET
import time
import multiprocessing
-import concurrent.futures as conc
+from concurrent.futures import ProcessPoolExecutor
import re
from run_unittests import get_fake_options, run_configure
@@ -59,50 +59,6 @@ class TestResult:
self.buildtime = buildtime
self.testtime = testtime
-class DummyFuture(conc.Future):
- '''
- Dummy Future implementation that executes the provided function when you
- ask for the result. Used on platforms where sem_open() is not available:
- MSYS2, OpenBSD, etc: https://bugs.python.org/issue3770
- '''
- def set_function(self, fn, *args, **kwargs):
- self.fn = fn
- self.fn_args = args
- self.fn_kwargs = kwargs
-
- def result(self, **kwargs):
- try:
- result = self.fn(*self.fn_args, **self.fn_kwargs)
- except BaseException as e:
- self.set_exception(e)
- else:
- self.set_result(result)
- return super().result(**kwargs)
-
-
-class DummyExecutor(conc.Executor):
- '''
- Dummy single-thread 'concurrent' executor for use on platforms where
- sem_open is not available: https://bugs.python.org/issue3770
- '''
-
- def __init__(self):
- from threading import Lock
- self._shutdown = False
- self._shutdownLock = Lock()
-
- def submit(self, fn, *args, **kwargs):
- with self._shutdownLock:
- if self._shutdown:
- raise RuntimeError('Cannot schedule new futures after shutdown')
- f = DummyFuture()
- f.set_function(fn, *args, **kwargs)
- return f
-
- def shutdown(self, wait=True):
- with self._shutdownLock:
- self._shutdown = True
-
class AutoDeletedDir:
def __init__(self, d):
@@ -548,11 +504,7 @@ def _run_tests(all_tests, log_name_base, extra_args):
# Remove this once the following issue has been resolved:
# https://github.com/mesonbuild/meson/pull/2082
num_workers *= 2
- try:
- executor = conc.ProcessPoolExecutor(max_workers=num_workers)
- except ImportError:
- print('Platform doesn\'t ProcessPoolExecutor, falling back to single-threaded testing\n')
- executor = DummyExecutor()
+ executor = ProcessPoolExecutor(max_workers=num_workers)
for name, test_cases, skipped in all_tests:
current_suite = ET.SubElement(junit_root, 'testsuite', {'name': name, 'tests': str(len(test_cases))})