diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2021-05-08 01:56:58 +0300 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2021-05-08 21:35:08 +0300 |
commit | 1d06d4ca1a5a2da157966fad915f9d72d2228421 (patch) | |
tree | eee5f17ea211c85367d0858a608a4ee355dd2162 /run_unittests.py | |
parent | 247630b98172221718bce202c9fe144d9694892c (diff) | |
download | meson-1d06d4ca1a5a2da157966fad915f9d72d2228421.zip meson-1d06d4ca1a5a2da157966fad915f9d72d2228421.tar.gz meson-1d06d4ca1a5a2da157966fad915f9d72d2228421.tar.bz2 |
Set unittest backend with an argument rather than an envvar.
Diffstat (limited to 'run_unittests.py')
-rwxr-xr-x | run_unittests.py | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/run_unittests.py b/run_unittests.py index 1556b10..89b00f6 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -82,7 +82,6 @@ from run_tests import ( if T.TYPE_CHECKING: from mesonbuild.compilers import Compiler - URLOPEN_TIMEOUT = 5 @contextmanager @@ -1704,8 +1703,7 @@ class BasePlatformTests(unittest.TestCase): src_root = os.path.join(os.getcwd(), src_root) self.src_root = src_root # Get the backend - # FIXME: Extract this from argv? - self.backend = getattr(Backend, os.environ.get('MESON_UNIT_TEST_BACKEND', 'ninja')) + self.backend = getattr(Backend, os.environ['MESON_UNIT_TEST_BACKEND']) self.meson_args = ['--backend=' + self.backend.name] self.meson_native_file = None self.meson_cross_file = None @@ -10010,8 +10008,24 @@ def running_single_tests(argv, cases): got_test_arg = True return got_test_arg +def setup_backend(): + filtered = [] + be = 'ninja' + for a in sys.argv: + if a.startswith('--backend'): + be = a.split('=')[1] + else: + filtered.append(a) + # Since we invoke the tests via unittest or xtest test runner + # we need to pass the backend to use to the spawned process via + # this side channel. Yes it sucks, but at least is is fully + # internal to this file. + os.environ['MESON_UNIT_TEST_BACKEND'] = be + sys.argv = filtered + def main(): unset_envs() + setup_backend() cases = ['InternalTests', 'DataTests', 'AllPlatformTests', 'FailureTests', 'PythonTests', 'NativeFileTests', 'RewriterTests', 'CrossFileTests', 'TAPParserTests', 'SubprojectsCommandTests', |