aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2019-08-25 04:26:41 +1000
committerJussi Pakkanen <jpakkane@gmail.com>2019-08-24 21:26:41 +0300
commit4ebce2c3f25d98f9ba49d9fcc343ffbe760363af (patch)
tree9620b6f72a4c713e30c90c5c5e5823cd24a98bd3 /mesonbuild
parente3b21de5630e009f130d2e160a6fc125b5f84e31 (diff)
downloadmeson-4ebce2c3f25d98f9ba49d9fcc343ffbe760363af.zip
meson-4ebce2c3f25d98f9ba49d9fcc343ffbe760363af.tar.gz
meson-4ebce2c3f25d98f9ba49d9fcc343ffbe760363af.tar.bz2
Add test priorities to force test start order
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/backend/backends.py8
-rw-r--r--mesonbuild/interpreter.py12
-rw-r--r--mesonbuild/mintro.py1
3 files changed, 15 insertions, 6 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py
index 512eeed..c0b2666 100644
--- a/mesonbuild/backend/backends.py
+++ b/mesonbuild/backend/backends.py
@@ -86,7 +86,7 @@ class TestSerialisation:
is_parallel: bool, cmd_args: typing.List[str],
env: build.EnvironmentVariables, should_fail: bool,
timeout: typing.Optional[int], workdir: typing.Optional[str],
- extra_paths: typing.List[str], protocol: str):
+ extra_paths: typing.List[str], protocol: str, priority: int):
self.name = name
self.project_name = project
self.suite = suite
@@ -103,6 +103,7 @@ class TestSerialisation:
self.workdir = workdir
self.extra_paths = extra_paths
self.protocol = protocol
+ self.priority = priority
class OptionProxy:
def __init__(self, value):
@@ -728,7 +729,7 @@ class Backend:
def create_test_serialisation(self, tests):
arr = []
- for t in tests:
+ for t in sorted(tests, key=lambda tst: -1 * tst.priority):
exe = t.get_exe()
if isinstance(exe, dependencies.ExternalProgram):
cmd = exe.get_command()
@@ -770,7 +771,8 @@ class Backend:
raise MesonException('Bad object in test command.')
ts = TestSerialisation(t.get_name(), t.project_name, t.suite, cmd, is_cross,
exe_wrapper, t.is_parallel, cmd_args, t.env,
- t.should_fail, t.timeout, t.workdir, extra_paths, t.protocol)
+ t.should_fail, t.timeout, t.workdir,
+ extra_paths, t.protocol, t.priority)
arr.append(ts)
return arr
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index 5f69e22..03910b2 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -900,7 +900,8 @@ class Test(InterpreterObject):
def __init__(self, name: str, project: str, suite: List[str], exe: build.Executable,
depends: List[Union[build.CustomTarget, build.BuildTarget]],
is_parallel: bool, cmd_args: List[str], env: build.EnvironmentVariables,
- should_fail: bool, timeout: int, workdir: Optional[str], protocol: str):
+ should_fail: bool, timeout: int, workdir: Optional[str], protocol: str,
+ priority: int):
InterpreterObject.__init__(self)
self.name = name
self.suite = suite
@@ -914,6 +915,7 @@ class Test(InterpreterObject):
self.timeout = timeout
self.workdir = workdir
self.protocol = protocol
+ self.priority = priority
def get_exe(self):
return self.exe
@@ -2044,7 +2046,7 @@ permitted_kwargs = {'add_global_arguments': {'language', 'native'},
'subdir': {'if_found'},
'subproject': {'version', 'default_options', 'required'},
'test': {'args', 'depends', 'env', 'is_parallel', 'should_fail', 'timeout', 'workdir',
- 'suite', 'protocol'},
+ 'suite', 'protocol', 'priority'},
'vcs_tag': {'input', 'output', 'fallback', 'command', 'replace_string'},
}
@@ -3383,6 +3385,7 @@ This will become a hard error in the future.''' % kwargs['input'], location=self
self.add_test(node, args, kwargs, False)
@FeatureNewKwargs('test', '0.46.0', ['depends'])
+ @FeatureNewKwargs('test', '0.52.0', ['priority'])
@permittedKwargs(permitted_kwargs['test'])
def func_test(self, node, args, kwargs):
self.add_test(node, args, kwargs, True)
@@ -3453,8 +3456,11 @@ This will become a hard error in the future.''' % kwargs['input'], location=self
for dep in depends:
if not isinstance(dep, (build.CustomTarget, build.BuildTarget)):
raise InterpreterException('Depends items must be build targets.')
+ priority = kwargs.get('priority', 0)
+ if not isinstance(priority, int):
+ raise InterpreterException('Keyword argument priority must be an integer.')
t = Test(args[0], prj, suite, exe.held_object, depends, par, cmd_args,
- env, should_fail, timeout, workdir, protocol)
+ env, should_fail, timeout, workdir, protocol, priority)
if is_base_test:
self.build.tests.append(t)
mlog.debug('Adding test', mlog.bold(args[0], True))
diff --git a/mesonbuild/mintro.py b/mesonbuild/mintro.py
index 1d30149..49eef0a 100644
--- a/mesonbuild/mintro.py
+++ b/mesonbuild/mintro.py
@@ -321,6 +321,7 @@ def get_test_list(testdata):
to['timeout'] = t.timeout
to['suite'] = t.suite
to['is_parallel'] = t.is_parallel
+ to['priority'] = t.priority
result.append(to)
return result