aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2022-12-02 11:47:11 -0800
committerEli Schwartz <eschwartz93@gmail.com>2022-12-05 15:20:09 -0500
commit010f525cc5d632b2d7da5cf9b80a1b758841ba71 (patch)
treebf53f9ea1a6e967c11de49f5afc08f60c2b44555 /mesonbuild
parent99dfc988ebe79ff5461fc01a246916becf0c9c5c (diff)
downloadmeson-010f525cc5d632b2d7da5cf9b80a1b758841ba71.zip
meson-010f525cc5d632b2d7da5cf9b80a1b758841ba71.tar.gz
meson-010f525cc5d632b2d7da5cf9b80a1b758841ba71.tar.bz2
interpreter: move TEST_KW from interpreter.py to type_checking.py
Since it's also used in the rust module, it should be in a common place. Also rename from `TEST_KWARGS` to `TEST_KWS`, which is more in line with the `*_KW` naming scheme used in the type_checking module.
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/interpreter/interpreter.py24
-rw-r--r--mesonbuild/interpreter/type_checking.py19
-rw-r--r--mesonbuild/modules/rust.py4
3 files changed, 24 insertions, 23 deletions
diff --git a/mesonbuild/interpreter/interpreter.py b/mesonbuild/interpreter/interpreter.py
index 1228caa..552f51c 100644
--- a/mesonbuild/interpreter/interpreter.py
+++ b/mesonbuild/interpreter/interpreter.py
@@ -83,6 +83,7 @@ from .type_checking import (
REQUIRED_KW,
SOURCES_KW,
VARIABLES_KW,
+ TEST_KWS,
NoneType,
in_set_validator,
env_convertor_with_method
@@ -223,25 +224,6 @@ known_build_target_kwargs = (
{'target_type'}
)
-TEST_KWARGS: T.List[KwargInfo] = [
- KwargInfo('args', ContainerTypeInfo(list, (str, mesonlib.File, build.BuildTarget, build.CustomTarget, build.CustomTargetIndex)),
- listify=True, default=[]),
- KwargInfo('should_fail', bool, default=False),
- KwargInfo('timeout', int, default=30),
- KwargInfo('workdir', (str, NoneType), default=None,
- validator=lambda x: 'must be an absolute path' if not os.path.isabs(x) else None),
- KwargInfo('protocol', str,
- default='exitcode',
- validator=in_set_validator({'exitcode', 'tap', 'gtest', 'rust'}),
- since_values={'gtest': '0.55.0', 'rust': '0.57.0'}),
- KwargInfo('priority', int, default=0, since='0.52.0'),
- # TODO: env needs reworks of the way the environment variable holder itself works probably
- ENV_KW,
- DEPENDS_KW.evolve(since='0.46.0'),
- KwargInfo('suite', ContainerTypeInfo(list, str), listify=True, default=['']), # yes, a list of empty string
- KwargInfo('verbose', bool, default=False, since='0.62.0'),
-]
-
class InterpreterRuleRelaxation(Enum):
''' Defines specific relaxations of the Meson rules.
@@ -2050,14 +2032,14 @@ class Interpreter(InterpreterBase, HoldableObject):
return gen
@typed_pos_args('benchmark', str, (build.Executable, build.Jar, ExternalProgram, mesonlib.File))
- @typed_kwargs('benchmark', *TEST_KWARGS)
+ @typed_kwargs('benchmark', *TEST_KWS)
def func_benchmark(self, node: mparser.BaseNode,
args: T.Tuple[str, T.Union[build.Executable, build.Jar, ExternalProgram, mesonlib.File]],
kwargs: 'kwtypes.FuncBenchmark') -> None:
self.add_test(node, args, kwargs, False)
@typed_pos_args('test', str, (build.Executable, build.Jar, ExternalProgram, mesonlib.File))
- @typed_kwargs('test', *TEST_KWARGS, KwargInfo('is_parallel', bool, default=True))
+ @typed_kwargs('test', *TEST_KWS, KwargInfo('is_parallel', bool, default=True))
def func_test(self, node: mparser.BaseNode,
args: T.Tuple[str, T.Union[build.Executable, build.Jar, ExternalProgram, mesonlib.File]],
kwargs: 'kwtypes.FuncTest') -> None:
diff --git a/mesonbuild/interpreter/type_checking.py b/mesonbuild/interpreter/type_checking.py
index e56c3b6..9cee495 100644
--- a/mesonbuild/interpreter/type_checking.py
+++ b/mesonbuild/interpreter/type_checking.py
@@ -448,3 +448,22 @@ VARIABLES_KW: KwargInfo[T.Dict[str, str]] = KwargInfo(
)
PRESERVE_PATH_KW: KwargInfo[bool] = KwargInfo('preserve_path', bool, default=False, since='0.63.0')
+
+TEST_KWS: T.List[KwargInfo] = [
+ KwargInfo('args', ContainerTypeInfo(list, (str, File, BuildTarget, CustomTarget, CustomTargetIndex)),
+ listify=True, default=[]),
+ KwargInfo('should_fail', bool, default=False),
+ KwargInfo('timeout', int, default=30),
+ KwargInfo('workdir', (str, NoneType), default=None,
+ validator=lambda x: 'must be an absolute path' if not os.path.isabs(x) else None),
+ KwargInfo('protocol', str,
+ default='exitcode',
+ validator=in_set_validator({'exitcode', 'tap', 'gtest', 'rust'}),
+ since_values={'gtest': '0.55.0', 'rust': '0.57.0'}),
+ KwargInfo('priority', int, default=0, since='0.52.0'),
+ # TODO: env needs reworks of the way the environment variable holder itself works probably
+ ENV_KW,
+ DEPENDS_KW.evolve(since='0.46.0'),
+ KwargInfo('suite', ContainerTypeInfo(list, str), listify=True, default=['']), # yes, a list of empty string
+ KwargInfo('verbose', bool, default=False, since='0.62.0'),
+]
diff --git a/mesonbuild/modules/rust.py b/mesonbuild/modules/rust.py
index 42034af..7f56fab 100644
--- a/mesonbuild/modules/rust.py
+++ b/mesonbuild/modules/rust.py
@@ -19,7 +19,7 @@ from . import ExtensionModule, ModuleReturnValue, ModuleInfo
from .. import mlog
from ..build import BothLibraries, BuildTarget, CustomTargetIndex, Executable, ExtractedObjects, GeneratedList, IncludeDirs, CustomTarget, StructuredSources
from ..dependencies import Dependency, ExternalLibrary
-from ..interpreter.interpreter import TEST_KWARGS, OUTPUT_KW
+from ..interpreter.type_checking import TEST_KWS, OUTPUT_KW
from ..interpreterbase import ContainerTypeInfo, InterpreterException, KwargInfo, typed_kwargs, typed_pos_args, noPosargs
from ..mesonlib import File
@@ -63,7 +63,7 @@ class RustModule(ExtensionModule):
@typed_pos_args('rust.test', str, BuildTarget)
@typed_kwargs(
'rust.test',
- *TEST_KWARGS,
+ *TEST_KWS,
KwargInfo('is_parallel', bool, default=False),
KwargInfo(
'dependencies',