mtest2make: cleanup mtest-suites variables
Remove the "--suite" argument from the .*.mtest-suites variables, and add it only when actually computing the arguments to "meson test". This makes it possible to set ninja-cmd-goals from the set of suites, instead of doing it via many different .ninja-goals.* variables. Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Tested-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
106d766c9d
commit
50797af6e8
2 changed files with 22 additions and 22 deletions
4
Makefile
4
Makefile
|
|
@ -96,6 +96,8 @@ meson.stamp: config-host.mak
|
||||||
|
|
||||||
# 3. ensure meson-generated build files are up-to-date
|
# 3. ensure meson-generated build files are up-to-date
|
||||||
|
|
||||||
|
ninja-cmd-goals =
|
||||||
|
|
||||||
ifneq ($(NINJA),)
|
ifneq ($(NINJA),)
|
||||||
Makefile.ninja: build.ninja
|
Makefile.ninja: build.ninja
|
||||||
$(quiet-@){ \
|
$(quiet-@){ \
|
||||||
|
|
@ -150,7 +152,7 @@ NINJAFLAGS = \
|
||||||
$(or $(filter -l% -j%, $(MAKEFLAGS)), \
|
$(or $(filter -l% -j%, $(MAKEFLAGS)), \
|
||||||
$(if $(filter --jobserver-auth=%, $(MAKEFLAGS)),, -j1))) \
|
$(if $(filter --jobserver-auth=%, $(MAKEFLAGS)),, -j1))) \
|
||||||
-d keepdepfile
|
-d keepdepfile
|
||||||
ninja-cmd-goals = $(or $(MAKECMDGOALS), all)
|
ninja-cmd-goals += $(or $(MAKECMDGOALS), all)
|
||||||
ninja-cmd-goals += $(foreach g, $(MAKECMDGOALS), $(.ninja-goals.$g))
|
ninja-cmd-goals += $(foreach g, $(MAKECMDGOALS), $(.ninja-goals.$g))
|
||||||
|
|
||||||
makefile-targets := build.ninja ctags TAGS cscope dist clean
|
makefile-targets := build.ninja ctags TAGS cscope dist clean
|
||||||
|
|
|
||||||
|
|
@ -8,24 +8,23 @@ from collections import defaultdict
|
||||||
import itertools
|
import itertools
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import shlex
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
class Suite(object):
|
class Suite(object):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.deps = set()
|
self.deps = set()
|
||||||
self.speeds = ['quick']
|
self.speeds = []
|
||||||
|
|
||||||
def names(self, base):
|
def names(self, base):
|
||||||
return [base if speed == 'quick' else f'{base}-{speed}' for speed in self.speeds]
|
return [f'{base}-{speed}' for speed in self.speeds]
|
||||||
|
|
||||||
|
|
||||||
print('''
|
print(r'''
|
||||||
SPEED = quick
|
SPEED = quick
|
||||||
|
|
||||||
.speed.quick = $(foreach s,$(sort $(filter-out %-slow %-thorough, $1)), --suite $s)
|
.speed.quick = $(sort $(filter-out %-slow %-thorough, $1))
|
||||||
.speed.slow = $(foreach s,$(sort $(filter-out %-thorough, $1)), --suite $s)
|
.speed.slow = $(sort $(filter-out %-thorough, $1))
|
||||||
.speed.thorough = $(foreach s,$(sort $1), --suite $s)
|
.speed.thorough = $(sort $1)
|
||||||
|
|
||||||
TIMEOUT_MULTIPLIER ?= 1
|
TIMEOUT_MULTIPLIER ?= 1
|
||||||
.mtestargs = --no-rebuild -t $(TIMEOUT_MULTIPLIER)
|
.mtestargs = --no-rebuild -t $(TIMEOUT_MULTIPLIER)
|
||||||
|
|
@ -34,8 +33,10 @@ ifneq ($(SPEED), quick)
|
||||||
endif
|
endif
|
||||||
.mtestargs += $(subst -j,--num-processes , $(filter-out -j, $(lastword -j1 $(filter -j%, $(MAKEFLAGS)))))
|
.mtestargs += $(subst -j,--num-processes , $(filter-out -j, $(lastword -j1 $(filter -j%, $(MAKEFLAGS)))))
|
||||||
|
|
||||||
.check.mtestargs = $(MTESTARGS) $(.mtestargs) $(if $(V),--verbose,--print-errorlogs)
|
.check.mtestargs = $(MTESTARGS) $(.mtestargs) $(if $(V),--verbose,--print-errorlogs) \
|
||||||
.bench.mtestargs = $(MTESTARGS) $(.mtestargs) --benchmark --verbose''')
|
$(foreach s, $(sort $(.check.mtest-suites)), --suite $s)
|
||||||
|
.bench.mtestargs = $(MTESTARGS) $(.mtestargs) --benchmark --verbose \
|
||||||
|
$(foreach s, $(sort $(.bench.mtest-suites)), --suite $s)''')
|
||||||
|
|
||||||
introspect = json.load(sys.stdin)
|
introspect = json.load(sys.stdin)
|
||||||
|
|
||||||
|
|
@ -72,29 +73,26 @@ def emit_prolog(suites, prefix):
|
||||||
print(f'all-{prefix}-targets = {all_targets}')
|
print(f'all-{prefix}-targets = {all_targets}')
|
||||||
print(f'all-{prefix}-xml = {all_xml}')
|
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'.PHONY: {prefix} do-meson-{prefix} {prefix}-report.junit.xml $(all-{prefix}-targets) $(all-{prefix}-xml)')
|
||||||
print(f'ifeq ($(filter {prefix}, $(MAKECMDGOALS)),)')
|
print(f'ninja-cmd-goals += $(foreach s, $(.{prefix}.mtest-suites), $(.{prefix}-$s.deps))')
|
||||||
print(f'.{prefix}.mtestargs += $(call .speed.$(SPEED), $(.{prefix}.mtest-suites))')
|
|
||||||
print(f'endif')
|
|
||||||
print(f'{prefix}-build: run-ninja')
|
print(f'{prefix}-build: run-ninja')
|
||||||
print(f'{prefix} $(all-{prefix}-targets): do-meson-{prefix}')
|
print(f'{prefix} $(all-{prefix}-targets): do-meson-{prefix}')
|
||||||
print(f'do-meson-{prefix}: run-ninja; $(if $(MAKE.n),,+)$(MESON) test $(.{prefix}.mtestargs)')
|
print(f'do-meson-{prefix}: run-ninja; $(if $(MAKE.n),,+)$(MESON) test $(.{prefix}.mtestargs)')
|
||||||
print(f'{prefix}-report.junit.xml $(all-{prefix}-xml): {prefix}-report%.junit.xml: run-ninja')
|
print(f'{prefix}-report.junit.xml $(all-{prefix}-xml): {prefix}-report%.junit.xml: run-ninja')
|
||||||
print(f'\t$(MAKE) {prefix}$* MTESTARGS="$(MTESTARGS) --logbase {prefix}-report$*" && ln -f meson-logs/$@ .')
|
print(f'\t$(MAKE) {prefix}$* MTESTARGS="$(MTESTARGS) --logbase {prefix}-report$*" && ln -f meson-logs/$@ .')
|
||||||
|
|
||||||
def emit_suite_deps(name, suite, prefix):
|
def emit_suite(name, suite, prefix):
|
||||||
deps = ' '.join(suite.deps)
|
deps = ' '.join(suite.deps)
|
||||||
targets = [f'{prefix}-{name}', f'{prefix}-report-{name}.junit.xml', f'{prefix}', f'{prefix}-report.junit.xml',
|
|
||||||
f'{prefix}-build']
|
|
||||||
print()
|
print()
|
||||||
print(f'.{prefix}-{name}.deps = {deps}')
|
print(f'.{prefix}-{name}.deps = {deps}')
|
||||||
for t in targets:
|
print(f'.ninja-goals.check-build += $(.{prefix}-{name}.deps)')
|
||||||
print(f'.ninja-goals.{t} += $(.{prefix}-{name}.deps)')
|
|
||||||
|
|
||||||
def emit_suite(name, suite, prefix):
|
names = ' '.join(suite.names(name))
|
||||||
emit_suite_deps(name, suite, prefix)
|
targets = f'{prefix}-{name} {prefix}-report-{name}.junit.xml'
|
||||||
targets = f'{prefix}-{name} {prefix}-report-{name}.junit.xml {prefix} {prefix}-report.junit.xml'
|
if not name.endswith('-slow') and not name.endswith('-thorough'):
|
||||||
|
targets += f' {prefix} {prefix}-report.junit.xml'
|
||||||
print(f'ifneq ($(filter {targets}, $(MAKECMDGOALS)),)')
|
print(f'ifneq ($(filter {targets}, $(MAKECMDGOALS)),)')
|
||||||
print(f'.{prefix}.mtest-suites += ' + ' '.join(suite.names(name)))
|
# for the "base" suite possibly add FOO-slow and FOO-thorough
|
||||||
|
print(f".{prefix}.mtest-suites += {name} $(call .speed.$(SPEED), {names})")
|
||||||
print(f'endif')
|
print(f'endif')
|
||||||
|
|
||||||
targets = {t['id']: [os.path.relpath(f) for f in t['filename']]
|
targets = {t['id']: [os.path.relpath(f) for f in t['filename']]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue