[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 37/92] mtest2make: add support for introspected test dependencies
From: |
Paolo Bonzini |
Subject: |
[PULL 37/92] mtest2make: add support for introspected test dependencies |
Date: |
Thu, 24 Sep 2020 05:22:19 -0400 |
Right now all "make check" targets depend blindly on "all". If Meson
is 0.56.0 or newer, we can use the correct dependencies using the new
"depends" entry in "meson introspect --tests".
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
Makefile | 2 +-
scripts/mtest2make.py | 19 +++++++++++++++----
2 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/Makefile b/Makefile
index 42d90cb597..897246d77c 100644
--- a/Makefile
+++ b/Makefile
@@ -78,7 +78,7 @@ ${ninja-targets-c_COMPILER} ${ninja-targets-cpp_COMPILER}:
.var.command += -MP
# reread (and MESON won't be empty anymore).
ifneq ($(MESON),)
Makefile.mtest: build.ninja scripts/mtest2make.py
- $(MESON) introspect --tests --benchmarks | $(PYTHON)
scripts/mtest2make.py > $@
+ $(MESON) introspect --targets --tests --benchmarks | $(PYTHON)
scripts/mtest2make.py > $@
-include Makefile.mtest
endif
diff --git a/scripts/mtest2make.py b/scripts/mtest2make.py
index 9cbb2e374d..c3489a4605 100644
--- a/scripts/mtest2make.py
+++ b/scripts/mtest2make.py
@@ -5,6 +5,7 @@
# Author: Paolo Bonzini <pbonzini@redhat.com>
from collections import defaultdict
+import itertools
import json
import os
import shlex
@@ -36,7 +37,7 @@ SPEED = quick
introspect = json.load(sys.stdin)
i = 0
-def process_tests(test, suites):
+def process_tests(test, targets, suites):
global i
env = ' '.join(('%s=%s' % (shlex.quote(k), shlex.quote(v))
for k, v in test['env'].items()))
@@ -58,12 +59,19 @@ def process_tests(test, suites):
i += 1
if test['workdir'] is not None:
print('.test.dir.%d := %s' % (i, shlex.quote(test['workdir'])))
+
+ if 'depends' in test:
+ deps = (targets.get(x, []) for x in test['depends'])
+ deps = itertools.chain.from_iterable(deps)
+ else:
+ deps = ['all']
+
print('.test.name.%d := %s' % (i, test['name']))
print('.test.driver.%d := %s' % (i, driver))
print('.test.env.%d := $(.test.env) %s' % (i, env))
print('.test.cmd.%d := %s' % (i, cmd))
print('.PHONY: run-test-%d' % (i,))
- print('run-test-%d: all' % (i,))
+ print('run-test-%d: %s' % (i, ' '.join(deps)))
print('\t@$(call .test.run,%d,$(.test.output-format))' % (i,))
test_suites = test['suite'] or ['default']
@@ -102,16 +110,19 @@ def emit_suite(name, suite, prefix):
print('.tests += $(.test.$(SPEED).%s)' % (target, ))
print('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, testsuites)
+ process_tests(test, targets, 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, benchsuites)
+ process_tests(test, targets, benchsuites)
emit_prolog(benchsuites, 'bench')
for name, suite in benchsuites.items():
emit_suite(name, suite, 'bench')
--
2.26.2
- [PULL 22/92] hw/char/serial: Rename I/O read/write trace events, (continued)
- [PULL 22/92] hw/char/serial: Rename I/O read/write trace events, Paolo Bonzini, 2020/09/24
- [PULL 30/92] meson: move libmpathpersist test, Paolo Bonzini, 2020/09/24
- [PULL 33/92] configure: fix --meson=/path/to/meson, Paolo Bonzini, 2020/09/24
- [PULL 32/92] configure: move malloc_trim/tcmalloc/jemalloc to meson, Paolo Bonzini, 2020/09/24
- [PULL 26/92] hw: megasas: return -1 when 'megasas_map_sgl' fails, Paolo Bonzini, 2020/09/24
- [PULL 35/92] configure: do not limit Hypervisor.framework test to Darwin, Paolo Bonzini, 2020/09/24
- [PULL 24/92] hw/char/serial-{isa, pci}: Alias QDEV properties from generic serial object, Paolo Bonzini, 2020/09/24
- [PULL 41/92] oslib-posix: default exec_dir to bindir, Paolo Bonzini, 2020/09/24
- [PULL 36/92] meson: qtest: set "depends" correctly, Paolo Bonzini, 2020/09/24
- [PULL 38/92] meson: report accelerator support, Paolo Bonzini, 2020/09/24
- [PULL 37/92] mtest2make: add support for introspected test dependencies,
Paolo Bonzini <=
- [PULL 39/92] oslib: do not call g_strdup from qemu_get_exec_dir, Paolo Bonzini, 2020/09/24
- [PULL 46/92] vl: relocate paths to data directories, Paolo Bonzini, 2020/09/24
- [PULL 34/92] configure: move cocoa option to Meson, Paolo Bonzini, 2020/09/24
- [PULL 40/92] fuzz: use qemu_get_exec_dir, Paolo Bonzini, 2020/09/24
- [PULL 42/92] cutils: introduce get_relocated_path, Paolo Bonzini, 2020/09/24
- [PULL 44/92] module: relocate path to modules, Paolo Bonzini, 2020/09/24
- [PULL 51/92] configure: use a platform-neutral prefix, Paolo Bonzini, 2020/09/24
- [PULL 50/92] ui: relocate paths to icons and translations, Paolo Bonzini, 2020/09/24
- [PULL 48/92] qemu-bridge-helper: relocate path to default ACL, Paolo Bonzini, 2020/09/24
- [PULL 52/92] hw/i386/q35: Remove unreachable Xen code on Q35 machine, Paolo Bonzini, 2020/09/24