On 9/16/2026 1:53 AM, Alex Bennée wrote: > This should trigger the building of the docker image when the user > calls "make check-tcg" or one of the arch specific targets such as > "make check-tcg-m68k-linux-user". >
Maybe there is some confusion, patch 2 only reverts option enable/disable-containers + --container-command for meson. It does not disable container support for meson tcg tests, which is there and enabled by default. Thus, container image dependencies are already there, with ninja or make. $ ./configure && make check-tcg-m68k-linux-user --dry-run |& grep debian [246/1052] Generating tests/tcg/image-debian-all-test-cross with a custom command Given that dependencies are already there, what is the goal of current patch? > We still keep the internal meson dependency so individual tests can > launched and the docker build verified. > As a side note, since patch 3 removes existing meson options, there will be no way to disable container build and run. It might be a (new) problem if some people were relying on this to avoid using docker/podman, which is the current workaround for John Snow's issue for instance. At minimum, current series should at least keep meson implementation of --disable-containers, which implies to keep this entry in meson_options.txt. The rest is less important, as risk is only to skip tests, which is not blocking for users. > Signed-off-by: Alex Bennée <[email protected]> > --- > scripts/mtest2make.py | 35 +++++++++++++++++++++++++++++------ > 1 file changed, 29 insertions(+), 6 deletions(-) > > diff --git a/scripts/mtest2make.py b/scripts/mtest2make.py > index 383ea68b16d..ab894d90d47 100644 > --- a/scripts/mtest2make.py > +++ b/scripts/mtest2make.py > @@ -14,6 +14,7 @@ class Suite(object): > def __init__(self): > self.deps = set() > self.speeds = set() > + self.docker_deps = set() > > def names(self, base): > return [f'{base}-{speed}' for speed in self.speeds] > @@ -40,7 +41,22 @@ def names(self, base): > > introspect = json.load(sys.stdin) > > -def process_tests(test, targets, suites): > +targets = {t['id']: [os.path.relpath(f) for f in t['filename']] > + for t in introspect['targets']} > + > +# collect the docker images uses by the tests. This is totally a hacky > +# heuristic that fishes the images out of the test custom commands by > +# looking for the qemu/image pattern. > +targets_docker = {} > +for t in introspect['targets']: > + for src in t.get('target_sources', []): > + for arg in src.get('compiler', []): > + if arg.startswith('qemu/'): > + img = arg.split('/', 1)[1] > + targets_docker[t['id']] = f'docker-image-{img}' > + break > + > +def process_tests(test, targets, targets_docker, suites): > executable = test['cmd'][0] > try: > executable = os.path.relpath(executable) > @@ -51,6 +67,8 @@ def process_tests(test, targets, suites): > deps = itertools.chain.from_iterable(deps) > deps = list(deps) > > + docker_deps = [targets_docker[x] for x in test['depends'] if x in > targets_docker] > + > test_suites = test['suite'] or ['default'] > for s in test_suites: > # The suite name in the introspection info is "PROJECT" or > "PROJECT:SUITE" > @@ -59,6 +77,7 @@ def process_tests(test, targets, suites): > if s == 'slow' or s == 'thorough': > continue > suites[s].deps.update(deps) > + suites[s].docker_deps.update(docker_deps) > if s.endswith('-slow'): > s = s[:-5] > suites[s].speeds.add('slow') > @@ -81,6 +100,9 @@ def emit_prolog(suites, prefix): > print(f'all-{prefix}-xml = {all_xml}') > print(f'.PHONY: {prefix} do-meson-{prefix} {prefix}-report.junit.xml > $(all-{prefix}-targets) $(all-{prefix}-xml)') > print(f'ninja-cmd-goals += $(foreach s, $(.{prefix}.mtest-suites), > $(.{prefix}-$s.deps))') > + print(f'docker-cmd-goals += $(foreach s, $(.{prefix}.mtest-suites), > $(.{prefix}-$s.docker-deps))') > + print(f'docker-cmd-goals += $(foreach g, $(MAKECMDGOALS), > $(.docker-goals.$g))') > + print(f'run-ninja: $(sort $(docker-cmd-goals))') > print(f'{prefix}-build: run-ninja') > print(f'{prefix} $(all-{prefix}-targets): do-meson-{prefix}') > print(f'do-meson-{prefix}: run-ninja; $(if $(MAKE.n),,+)$(MESON) test > $(.{prefix}.mtestargs)') > @@ -93,6 +115,10 @@ def emit_suite(name, suite, prefix): > print() > print(f'.{prefix}-{tgtname}.deps = {deps}') > print(f'.ninja-goals.check-build += $(.{prefix}-{tgtname}.deps)') > + if suite.docker_deps: > + docker_deps = ' '.join(sorted(suite.docker_deps)) > + print(f'.{prefix}-{tgtname}.docker-deps = {docker_deps}') > + print(f'.docker-goals.check-build += > $(.{prefix}-{tgtname}.docker-deps)') > > names = ' '.join(sorted(suite.names(name))) > targets = f'{prefix}-{tgtname} {prefix}-report-{tgtname}.junit.xml' > @@ -105,19 +131,16 @@ def emit_suite(name, suite, prefix): > print(f".{prefix}.mtest-suites += {name} $(call .speed.$(SPEED), > {names})") > print(f'endif') > > -targets = {t['id']: [os.path.relpath(f) for f in t['filename']] > - for t in introspect['targets']} > - > testsuites = defaultdict(Suite) > for test in introspect['tests']: > - process_tests(test, targets, testsuites) > + process_tests(test, targets, targets_docker, testsuites) > emit_prolog(testsuites, 'check') > for name, suite in testsuites.items(): > emit_suite(name, suite, 'check') > > benchsuites = defaultdict(Suite) > for test in introspect['benchmarks']: > - process_tests(test, targets, benchsuites) > + process_tests(test, targets, targets_docker, benchsuites) > emit_prolog(benchsuites, 'bench') > for name, suite in benchsuites.items(): > emit_suite(name, suite, 'bench')
