From 0fb1d029b6d64e1373448950eadc60545022fe97 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Wed, 2 Oct 2019 13:35:15 -0700 Subject: interpreter: Correctly handle arguments to benchmark This fixes two separate issues, one is that benchmark warns about depends and priority; The other is that we passed bad values like is_parallel into the test and would actually run benchmarks in parallel, which is bad. --- mesonbuild/interpreter.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index 0aa4b37..ffd3ace 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -1954,7 +1954,7 @@ permitted_kwargs = {'add_global_arguments': {'language', 'native'}, 'add_project_link_arguments': {'language', 'native'}, 'add_project_arguments': {'language', 'native'}, 'add_test_setup': {'exe_wrapper', 'gdb', 'timeout_multiplier', 'env', 'is_default'}, - 'benchmark': {'args', 'env', 'should_fail', 'timeout', 'workdir', 'suite'}, + 'benchmark': {'args', 'depends', 'env', 'should_fail', 'timeout', 'workdir', 'suite', 'priority', 'protocol'}, 'build_target': known_build_target_kwargs, 'configure_file': {'input', 'output', @@ -3364,8 +3364,13 @@ This will become a hard error in the future.''' % kwargs['input'], location=self self.generators.append(gen) return gen + @FeatureNewKwargs('benchmark', '0.46.0', ['depends']) + @FeatureNewKwargs('benchmark', '0.52.0', ['priority']) @permittedKwargs(permitted_kwargs['benchmark']) def func_benchmark(self, node, args, kwargs): + # is_parallel isn't valid here, so make sure it isn't passed + if 'is_parallel' in kwargs: + del kwargs['is_parallel'] self.add_test(node, args, kwargs, False) @FeatureNewKwargs('test', '0.46.0', ['depends']) -- cgit v1.1 From 00aba4a2794c79685d698a446d8c932b0b1e0843 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Wed, 2 Oct 2019 13:44:48 -0700 Subject: interpreter: Combine test and benchmark args Adding the test specific args later. This will help prevent bugs where arguments are added to test but not to benchmark even when they apply. --- mesonbuild/interpreter.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index ffd3ace..ec7a7b2 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -1948,13 +1948,15 @@ known_build_target_kwargs = ( {'target_type'} ) +_base_test_args = {'args', 'depends', 'env', 'should_fail', 'timeout', 'workdir', 'suite', 'priority', 'protocol'} + permitted_kwargs = {'add_global_arguments': {'language', 'native'}, 'add_global_link_arguments': {'language', 'native'}, 'add_languages': {'required'}, 'add_project_link_arguments': {'language', 'native'}, 'add_project_arguments': {'language', 'native'}, 'add_test_setup': {'exe_wrapper', 'gdb', 'timeout_multiplier', 'env', 'is_default'}, - 'benchmark': {'args', 'depends', 'env', 'should_fail', 'timeout', 'workdir', 'suite', 'priority', 'protocol'}, + 'benchmark': _base_test_args, 'build_target': known_build_target_kwargs, 'configure_file': {'input', 'output', @@ -2032,8 +2034,7 @@ permitted_kwargs = {'add_global_arguments': {'language', 'native'}, 'library': known_library_kwargs, 'subdir': {'if_found'}, 'subproject': {'version', 'default_options', 'required'}, - 'test': {'args', 'depends', 'env', 'is_parallel', 'should_fail', 'timeout', 'workdir', - 'suite', 'protocol', 'priority'}, + 'test': set.union(_base_test_args, {'is_parallel'}), 'vcs_tag': {'input', 'output', 'fallback', 'command', 'replace_string'}, } -- cgit v1.1 From 678ee8a9c1487b1c6771e98258ba841028daae9f Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Wed, 2 Oct 2019 13:49:19 -0700 Subject: docs: update docs on benchmark in regards to arguments accepted --- docs/markdown/Reference-manual.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/markdown/Reference-manual.md b/docs/markdown/Reference-manual.md index 176cde4..cd87646 100644 --- a/docs/markdown/Reference-manual.md +++ b/docs/markdown/Reference-manual.md @@ -155,6 +155,9 @@ run. The behavior of this function is identical to `test` with the exception that there is no `is_parallel` keyword, because benchmarks are never run in parallel. +*Note:* Prior to 0.52.0 benchmark would warn that `depends` and `proiority` +were unsupported, this is incorrect + ### both_libraries() ``` meson -- cgit v1.1