diff options
| author | Eli Schwartz <eschwartz@archlinux.org> | 2022-05-19 19:17:01 -0400 |
|---|---|---|
| committer | Eli Schwartz <eschwartz93@gmail.com> | 2025-01-07 20:16:05 -0500 |
| commit | eb1e52afa142fc0f38260a9cb3413f2bd63b1675 (patch) | |
| tree | 26c54730d3d586c6305da7127ed5716da78407da /test cases/unit | |
| parent | dfe5cbb3e432bb632731f853df05e2023ab233d6 (diff) | |
| download | meson-eb1e52afa142fc0f38260a9cb3413f2bd63b1675.tar.gz | |
mtest: fix rebuilding all before running tests
Inconsistency in the original implementation of commit
79e2c52a15e896e46ff3cfa3ec16fbf3f132ee01.
If an explicit list of targets is passed on the CLI, then that is passed
to rebuild_deps. If not, we pass every loaded test to rebuild_deps
instead. This means we cannot distinguish between "trying to run all
tests" and "trying to run specific tests". We then load all the deps for
all tests, and try to build them all as explicit arguments to the
underlying ninja.
There are two situations where this falls flat:
- given underspecified deps
- given all (selected?) tests legitimately happen to have no
dependencies
In both cases, we calculate that there are no deps to rebuild, we run
ninja without any targets, and this invokes the default "all" rule and
maybe builds a few thousand targets that this specific test run does not
need.
Additionally, in large projects which define many tests with many
dependencies, we could end up overflowing ARG_MAX when processing *all*
tests.
Instead, pass no tests to rebuild_deps. We then specially handle this by
directly running the relevant ninja target for "all test deps", which is
overall more elegant than specifying many many dependencies by name.
Given a subset of tests to guarantee the freshness of, we instead skip
running ninja at all if there are indeed no test dependencies.
Diffstat (limited to 'test cases/unit')
| -rw-r--r-- | test cases/unit/106 underspecified mtest/main.c | 1 | ||||
| -rw-r--r-- | test cases/unit/106 underspecified mtest/meson.build | 8 | ||||
| -rwxr-xr-x | test cases/unit/106 underspecified mtest/runner.py | 5 |
3 files changed, 14 insertions, 0 deletions
diff --git a/test cases/unit/106 underspecified mtest/main.c b/test cases/unit/106 underspecified mtest/main.c new file mode 100644 index 000000000..8842fc122 --- /dev/null +++ b/test cases/unit/106 underspecified mtest/main.c @@ -0,0 +1 @@ +int main(void) { return 0 ; } diff --git a/test cases/unit/106 underspecified mtest/meson.build b/test cases/unit/106 underspecified mtest/meson.build new file mode 100644 index 000000000..c0a88d677 --- /dev/null +++ b/test cases/unit/106 underspecified mtest/meson.build @@ -0,0 +1,8 @@ +project('underspecified deps', 'c') + +runner = find_program('runner.py') +exe1 = executable('main1', 'main.c') +exe2 = executable('main2', 'main.c') + +test('runner-with-exedep', runner, args: exe1) +test('runner-without-dep', runner, args: exe2.full_path()) diff --git a/test cases/unit/106 underspecified mtest/runner.py b/test cases/unit/106 underspecified mtest/runner.py new file mode 100755 index 000000000..9fb9ac40b --- /dev/null +++ b/test cases/unit/106 underspecified mtest/runner.py @@ -0,0 +1,5 @@ +#!/usr/bin/env python3 + +import sys, subprocess + +subprocess.run(sys.argv[1:], check=True) |
