Namespace test setups.

Use $project_name:$test_setup namespace scheme for test setups. This
allows one to choose from which (sub)project a test setup is taken from
should there be several sharing the same name. Defaults to the main
project. E.g. "meson test --setup subproj:valgrind".
pull/2311/head
Hemmo Nieminen 7 years ago
parent ec286d4970
commit abcaf7c222
  1. 16
      mesonbuild/interpreter.py
  2. 9
      mesonbuild/mtest.py

@ -2892,8 +2892,10 @@ different subdirectory.
if len(args) != 1:
raise InterpreterException('Add_test_setup needs one argument for the setup name.')
setup_name = args[0]
if re.fullmatch('[_a-zA-Z][_0-9a-zA-Z]*', setup_name) is None:
if re.fullmatch('([_a-zA-Z][_0-9a-zA-Z]*:)?[_a-zA-Z][_0-9a-zA-Z]*', setup_name) is None:
raise InterpreterException('Setup name may only contain alphanumeric characters.')
if ":" not in setup_name:
setup_name = (self.subproject if self.subproject else self.build.project_name) + ":" + setup_name
try:
inp = extract_as_list(kwargs, 'exe_wrapper')
exe_wrapper = []
@ -2917,14 +2919,10 @@ different subdirectory.
if not isinstance(timeout_multiplier, int):
raise InterpreterException('Timeout multiplier must be a number.')
env = self.unpack_env_kwarg(kwargs)
setupobj = build.TestSetup(exe_wrapper=exe_wrapper,
gdb=gdb,
timeout_multiplier=timeout_multiplier,
env=env)
if self.subproject == '':
# Dunno what we should do with subprojects really. Let's start simple
# and just use the master project ones.
self.build.test_setups[setup_name] = setupobj
self.build.test_setups[setup_name] = build.TestSetup(exe_wrapper=exe_wrapper,
gdb=gdb,
timeout_multiplier=timeout_multiplier,
env=env)
@permittedKwargs(permitted_kwargs['add_global_arguments'])
@stringArgs

@ -446,7 +446,7 @@ TIMEOUT: %4d
if self.options.wrapper:
namebase = os.path.basename(self.get_wrapper()[0])
elif self.options.setup:
namebase = self.options.setup
namebase = self.options.setup.replace(":", "_")
if namebase:
logfile_base += '-' + namebase.replace(' ', '_')
@ -553,10 +553,11 @@ def merge_suite_options(options):
buildfile = os.path.join(options.wd, 'meson-private/build.dat')
with open(buildfile, 'rb') as f:
build = pickle.load(f)
setups = build.test_setups
if options.setup not in setups:
if ":" not in options.setup:
options.setup = (build.subproject if build.subproject else build.project_name) + ":" + options.setup
if options.setup not in build.test_setups:
sys.exit('Unknown test setup: %s' % options.setup)
current = setups[options.setup]
current = build.test_setups[options.setup]
if not options.gdb:
options.gdb = current.gdb
if options.timeout_multiplier is None:

Loading…
Cancel
Save