diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2020-09-04 04:50:15 -0400 |
---|---|---|
committer | Daniel Mensinger <daniel@mensinger-ka.de> | 2020-09-04 14:45:20 +0200 |
commit | fa5c2363eb1dd94058aac1a4045d2ab546eed7b9 (patch) | |
tree | eb28e49113496ac423b5cee05e8c603d6e111e49 /mesonbuild | |
parent | 0b0873c7438471732e5237b1c667e5a3b3fe3c82 (diff) | |
download | meson-fa5c2363eb1dd94058aac1a4045d2ab546eed7b9.zip meson-fa5c2363eb1dd94058aac1a4045d2ab546eed7b9.tar.gz meson-fa5c2363eb1dd94058aac1a4045d2ab546eed7b9.tar.bz2 |
introspect: add test dependencies info to test/benchmark JSON
Add the ids of any target that needs to be rebuilt before running the
tests as computed by the backend, to the introspection data for tests and benchmarks.
This also includes anything that appears on the test's command line.
Without this information, IDEs must update the entire build before running
any test. They can now instead selectively build the test executable
itself and anything that is needed to run it.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'mesonbuild')
-rw-r--r-- | mesonbuild/backend/backends.py | 12 | ||||
-rw-r--r-- | mesonbuild/mintro.py | 1 |
2 files changed, 11 insertions, 2 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py index 7bdccbf..6c5b75a 100644 --- a/mesonbuild/backend/backends.py +++ b/mesonbuild/backend/backends.py @@ -120,7 +120,8 @@ class TestSerialisation: env: build.EnvironmentVariables, should_fail: bool, timeout: T.Optional[int], workdir: T.Optional[str], extra_paths: T.List[str], protocol: TestProtocol, priority: int, - cmd_is_built: bool): + cmd_is_built: bool, + depends: T.List[str]): self.name = name self.project_name = project self.suite = suite @@ -140,6 +141,7 @@ class TestSerialisation: self.priority = priority self.needs_exe_wrapper = needs_exe_wrapper self.cmd_is_built = cmd_is_built + self.depends = depends def get_backend_from_name(backend: str, build: T.Optional[build.Build] = None, interpreter: T.Optional['Interpreter'] = None) -> T.Optional['Backend']: @@ -830,7 +832,12 @@ class Backend: extra_paths = [] cmd_args = [] + depends = set(t.depends) + if isinstance(exe, build.Target): + depends.add(exe) for a in unholder(t.cmd_args): + if isinstance(a, build.Target): + depends.add(a) if isinstance(a, build.BuildTarget): extra_paths += self.determine_windows_extra_paths(a, []) if isinstance(a, mesonlib.File): @@ -852,7 +859,8 @@ class Backend: t.is_parallel, cmd_args, t.env, t.should_fail, t.timeout, t.workdir, extra_paths, t.protocol, t.priority, - isinstance(exe, build.Executable)) + isinstance(exe, build.Executable), + [x.get_id() for x in depends]) arr.append(ts) return arr diff --git a/mesonbuild/mintro.py b/mesonbuild/mintro.py index 0049bbd..d55227a 100644 --- a/mesonbuild/mintro.py +++ b/mesonbuild/mintro.py @@ -325,6 +325,7 @@ def get_test_list(testdata) -> T.List[T.Dict[str, T.Union[str, int, T.List[str], to['is_parallel'] = t.is_parallel to['priority'] = t.priority to['protocol'] = str(t.protocol) + to['depends'] = t.depends result.append(to) return result |