diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2021-06-08 12:44:43 -0700 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2021-06-14 12:30:02 -0700 |
commit | e2266e87083762b6c6fb17b77a316abca0e4dfa0 (patch) | |
tree | c3244ad4448a37519e49dc38e7454b28f8f46f47 /mesonbuild/interpreter/kwargs.py | |
parent | 86704261a7227dc1681aa544e6d44e1b2f941fe1 (diff) | |
download | meson-e2266e87083762b6c6fb17b77a316abca0e4dfa0.zip meson-e2266e87083762b6c6fb17b77a316abca0e4dfa0.tar.gz meson-e2266e87083762b6c6fb17b77a316abca0e4dfa0.tar.bz2 |
interpreter: use typed_*args for test and benchmark
this also requires some changes to the Rust module, as it calls into the
test code.
Diffstat (limited to 'mesonbuild/interpreter/kwargs.py')
-rw-r--r-- | mesonbuild/interpreter/kwargs.py | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/mesonbuild/interpreter/kwargs.py b/mesonbuild/interpreter/kwargs.py index d5d9990..db6b02b 100644 --- a/mesonbuild/interpreter/kwargs.py +++ b/mesonbuild/interpreter/kwargs.py @@ -6,9 +6,10 @@ import typing as T -from typing_extensions import TypedDict +from typing_extensions import TypedDict, Literal -from ..mesonlib import MachineChoice +from ..mesonlib import MachineChoice, File +from .interpreterobjects import BuildTargetHolder, CustomTargetHolder, EnvironmentVariablesHolder, TargetHolder class FuncAddProjectArgs(TypedDict): @@ -24,3 +25,35 @@ class FuncAddProjectArgs(TypedDict): native: MachineChoice language: T.List[str] + + +class BaseTest(TypedDict): + + """Shared base for the Rust module.""" + + args: T.List[T.Union[str, File, TargetHolder]] + should_fail: bool + timeout: int + workdir: T.Optional[str] + depends: T.List[T.Union[CustomTargetHolder, BuildTargetHolder]] + priority: int + env: T.Union[EnvironmentVariablesHolder, T.List[str], T.Dict[str, str], str] + suite: T.List[str] + + +class FuncBenchmark(BaseTest): + + """Keyword Arguments shared between `test` and `benchmark`.""" + + protocol: Literal['exitcode', 'tap', 'gtest', 'rust'] + + +class FuncTest(FuncBenchmark): + + """Keyword Arguments for `test` + + `test` only adds the `is_prallel` argument over benchmark, so inherintance + is helpful here. + """ + + is_parallel: bool |