aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xrun_project_tests.py11
-rwxr-xr-xrun_tests.py31
2 files changed, 27 insertions, 15 deletions
diff --git a/run_project_tests.py b/run_project_tests.py
index ed1a0e8..b6879ee 100755
--- a/run_project_tests.py
+++ b/run_project_tests.py
@@ -476,7 +476,7 @@ def format_parameter_file(file_basename: str, test: TestDef, test_build_dir: str
return destination
-def detect_parameter_files(test: TestDef, test_build_dir: str) -> (Path, Path):
+def detect_parameter_files(test: TestDef, test_build_dir: str) -> T.Tuple[Path, Path]:
nativefile = test.path / 'nativefile.ini'
crossfile = test.path / 'crossfile.ini'
@@ -488,7 +488,9 @@ def detect_parameter_files(test: TestDef, test_build_dir: str) -> (Path, Path):
return nativefile, crossfile
-def run_test(test: TestDef, extra_args, compiler, backend, flags, commands, should_fail, use_tmp: bool):
+def run_test(test: TestDef, extra_args: T.List[str], compiler: str, backend: Backend,
+ flags: T.List[str], commands: T.Tuple[T.List[str], T.List[str], T.List[str], T.List[str]],
+ should_fail: bool, use_tmp: bool) -> T.Optional[TestResult]:
if test.skip:
return None
build_dir = create_deterministic_builddir(test, use_tmp)
@@ -503,7 +505,10 @@ def run_test(test: TestDef, extra_args, compiler, backend, flags, commands, shou
finally:
mesonlib.windows_proof_rmtree(build_dir)
-def _run_test(test: TestDef, test_build_dir: str, install_dir: str, extra_args, compiler, backend, flags, commands, should_fail):
+def _run_test(test: TestDef, test_build_dir: str, install_dir: str,
+ extra_args: T.List[str], compiler: str, backend: Backend,
+ flags: T.List[str], commands: T.Tuple[T.List[str], T.List[str], T.List[str], T.List[str]],
+ should_fail: bool) -> TestResult:
compile_commands, clean_commands, install_commands, uninstall_commands = commands
gen_start = time.time()
# Configure in-process
diff --git a/run_tests.py b/run_tests.py
index 24d6a51..5a0a70c 100755
--- a/run_tests.py
+++ b/run_tests.py
@@ -27,6 +27,8 @@ from enum import Enum
from glob import glob
from pathlib import Path
from unittest import mock
+import typing as T
+
from mesonbuild import compilers
from mesonbuild import dependencies
from mesonbuild import mesonlib
@@ -57,26 +59,27 @@ else:
if NINJA_CMD is None:
raise RuntimeError('Could not find Ninja v1.7 or newer')
-def guess_backend(backend, msbuild_exe: str):
+def guess_backend(backend_str: str, msbuild_exe: str) -> T.Tuple['Backend', T.List[str]]:
# Auto-detect backend if unspecified
backend_flags = []
- if backend is None:
+ if backend_str is None:
if msbuild_exe is not None and (mesonlib.is_windows() and not _using_intelcl()):
- backend = 'vs' # Meson will auto-detect VS version to use
+ backend_str = 'vs' # Meson will auto-detect VS version to use
else:
- backend = 'ninja'
+ backend_str = 'ninja'
+
# Set backend arguments for Meson
- if backend.startswith('vs'):
- backend_flags = ['--backend=' + backend]
+ if backend_str.startswith('vs'):
+ backend_flags = ['--backend=' + backend_str]
backend = Backend.vs
- elif backend == 'xcode':
+ elif backend_str == 'xcode':
backend_flags = ['--backend=xcode']
backend = Backend.xcode
- elif backend == 'ninja':
+ elif backend_str == 'ninja':
backend_flags = ['--backend=ninja']
backend = Backend.ninja
else:
- raise RuntimeError('Unknown backend: {!r}'.format(backend))
+ raise RuntimeError('Unknown backend: {!r}'.format(backend_str))
return (backend, backend_flags)
@@ -208,9 +211,13 @@ def get_builddir_target_args(backend, builddir, target):
raise AssertionError('Unknown backend: {!r}'.format(backend))
return target_args + dir_args
-def get_backend_commands(backend, debug=False):
- install_cmd = []
- uninstall_cmd = []
+def get_backend_commands(backend: Backend, debug: bool = False) -> \
+ T.Tuple[T.List[str], T.List[str], T.List[str], T.List[str], T.List[str]]:
+ install_cmd: T.List[str] = []
+ uninstall_cmd: T.List[str] = []
+ clean_cmd: T.List[str]
+ cmd: T.List[str]
+ test_cmd: T.List[str]
if backend is Backend.vs:
cmd = ['msbuild']
clean_cmd = cmd + ['/target:Clean']