mirror of https://github.com/xemu-project/xemu.git
build: make check-block a meson test
"meson test" can be asked to run tests verbosely; this makes it usable also for qemu-iotests's own harness, and it lets "make check-block" reuse mtest2make.py's infrastructure to find and build test dependencies. Adjust check-block.sh to use the standard exit code that reports a test as skipped. Alternatively, in the future we could make it produce TAP output, which is consistent with all other "make check" tests. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
3e233e2917
commit
98487b9035
|
@ -3,9 +3,9 @@ project('qemu', ['c'], meson_version: '>=0.58.2',
|
||||||
'b_staticpic=false', 'stdsplit=false'],
|
'b_staticpic=false', 'stdsplit=false'],
|
||||||
version: files('VERSION'))
|
version: files('VERSION'))
|
||||||
|
|
||||||
add_test_setup('quick', exclude_suites: ['slow', 'thorough'], is_default: true)
|
add_test_setup('quick', exclude_suites: ['block', 'slow', 'thorough'], is_default: true)
|
||||||
add_test_setup('slow', exclude_suites: ['thorough'], env: ['G_TEST_SLOW=1', 'SPEED=slow'])
|
add_test_setup('slow', exclude_suites: ['block', 'thorough'], env: ['G_TEST_SLOW=1', 'SPEED=slow'])
|
||||||
add_test_setup('thorough', env: ['G_TEST_SLOW=1', 'SPEED=thorough'])
|
add_test_setup('thorough', exclude_suites: ['block'], env: ['G_TEST_SLOW=1', 'SPEED=thorough'])
|
||||||
|
|
||||||
not_found = dependency('', required: false)
|
not_found = dependency('', required: false)
|
||||||
keyval = import('keyval')
|
keyval = import('keyval')
|
||||||
|
|
|
@ -79,7 +79,7 @@ def emit_prolog(suites, prefix):
|
||||||
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(name, suite, prefix):
|
def emit_suite_deps(name, suite, prefix):
|
||||||
deps = ' '.join(suite.deps)
|
deps = ' '.join(suite.deps)
|
||||||
targets = f'{prefix}-{name} {prefix}-report-{name}.junit.xml {prefix} {prefix}-report.junit.xml'
|
targets = f'{prefix}-{name} {prefix}-report-{name}.junit.xml {prefix} {prefix}-report.junit.xml'
|
||||||
print()
|
print()
|
||||||
|
@ -87,6 +87,10 @@ def emit_suite(name, suite, prefix):
|
||||||
print(f'ifneq ($(filter {prefix}-build {targets}, $(MAKECMDGOALS)),)')
|
print(f'ifneq ($(filter {prefix}-build {targets}, $(MAKECMDGOALS)),)')
|
||||||
print(f'.{prefix}.build-suites += {name}')
|
print(f'.{prefix}.build-suites += {name}')
|
||||||
print(f'endif')
|
print(f'endif')
|
||||||
|
|
||||||
|
def emit_suite(name, suite, prefix):
|
||||||
|
emit_suite_deps(name, suite, prefix)
|
||||||
|
targets = f'{prefix}-{name} {prefix}-report-{name}.junit.xml {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)))
|
print(f'.{prefix}.mtest-suites += ' + ' '.join(suite.names(name)))
|
||||||
print(f'endif')
|
print(f'endif')
|
||||||
|
@ -97,6 +101,10 @@ targets = {t['id']: [os.path.relpath(f) for f in t['filename']]
|
||||||
testsuites = defaultdict(Suite)
|
testsuites = defaultdict(Suite)
|
||||||
for test in introspect['tests']:
|
for test in introspect['tests']:
|
||||||
process_tests(test, targets, testsuites)
|
process_tests(test, targets, testsuites)
|
||||||
|
# HACK: check-block is a separate target so that it runs with --verbose;
|
||||||
|
# only write the dependencies
|
||||||
|
emit_suite_deps('block', testsuites['block'], 'check')
|
||||||
|
del testsuites['block']
|
||||||
emit_prolog(testsuites, 'check')
|
emit_prolog(testsuites, 'check')
|
||||||
for name, suite in testsuites.items():
|
for name, suite in testsuites.items():
|
||||||
emit_suite(name, suite, 'check')
|
emit_suite(name, suite, 'check')
|
||||||
|
|
|
@ -156,19 +156,9 @@ check:
|
||||||
|
|
||||||
ifeq ($(CONFIG_TOOLS)$(CONFIG_POSIX),yy)
|
ifeq ($(CONFIG_TOOLS)$(CONFIG_POSIX),yy)
|
||||||
check: check-block
|
check: check-block
|
||||||
export PYTHON
|
check-block: run-ninja
|
||||||
|
$(if $(MAKE.n),,+)$(MESON) test $(MTESTARGS) $(.mtestargs) --verbose \
|
||||||
ifneq ($(filter check check-block check-build, $(MAKECMDGOALS)),)
|
--logbase iotestslog $(call .speed.$(SPEED), block block-slow block-thorough)
|
||||||
ninja-cmd-goals += \
|
|
||||||
qemu-img$(EXESUF) \
|
|
||||||
qemu-io$(EXESUF) \
|
|
||||||
qemu-nbd$(EXESUF) \
|
|
||||||
storage-daemon/qemu-storage-daemon$(EXESUF) \
|
|
||||||
$(filter qemu-system-%, $(ninja-targets))
|
|
||||||
endif
|
|
||||||
|
|
||||||
check-block: $(SRC_PATH)/tests/check-block.sh run-ninja
|
|
||||||
@$<
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
check-build: run-ninja
|
check-build: run-ninja
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
# Honor the SPEED environment variable, just like we do it for the qtests.
|
# Honor the SPEED environment variable, just like we do it for "meson test"
|
||||||
if [ "$SPEED" = "slow" ]; then
|
if [ "$SPEED" = "slow" ]; then
|
||||||
format_list="raw qcow2"
|
format_list="raw qcow2"
|
||||||
group=
|
group=
|
||||||
|
@ -16,9 +16,13 @@ if [ "$#" -ne 0 ]; then
|
||||||
format_list="$@"
|
format_list="$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
skip() {
|
||||||
|
echo "$*"
|
||||||
|
exit 77
|
||||||
|
}
|
||||||
|
|
||||||
if grep -q "CONFIG_GPROF=y" config-host.mak 2>/dev/null ; then
|
if grep -q "CONFIG_GPROF=y" config-host.mak 2>/dev/null ; then
|
||||||
echo "GPROF is enabled ==> Not running the qemu-iotests."
|
skip "GPROF is enabled ==> Not running the qemu-iotests."
|
||||||
exit 0
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Disable tests with any sanitizer except for specific ones
|
# Disable tests with any sanitizer except for specific ones
|
||||||
|
@ -36,36 +40,30 @@ for j in ${ALLOWED_SANITIZE_FLAGS}; do
|
||||||
done
|
done
|
||||||
if echo ${SANITIZE_FLAGS} | grep -q "\-fsanitize" 2>/dev/null; then
|
if echo ${SANITIZE_FLAGS} | grep -q "\-fsanitize" 2>/dev/null; then
|
||||||
# Have a sanitize flag that is not allowed, stop
|
# Have a sanitize flag that is not allowed, stop
|
||||||
echo "Sanitizers are enabled ==> Not running the qemu-iotests."
|
skip "Sanitizers are enabled ==> Not running the qemu-iotests."
|
||||||
exit 0
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$(find . -name 'qemu-system-*' -print)" ]; then
|
if [ -z "$(find . -name 'qemu-system-*' -print)" ]; then
|
||||||
echo "No qemu-system binary available ==> Not running the qemu-iotests."
|
skip "No qemu-system binary available ==> Not running the qemu-iotests."
|
||||||
exit 0
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! command -v bash >/dev/null 2>&1 ; then
|
if ! command -v bash >/dev/null 2>&1 ; then
|
||||||
echo "bash not available ==> Not running the qemu-iotests."
|
skip "bash not available ==> Not running the qemu-iotests."
|
||||||
exit 0
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if LANG=C bash --version | grep -q 'GNU bash, version [123]' ; then
|
if LANG=C bash --version | grep -q 'GNU bash, version [123]' ; then
|
||||||
echo "bash version too old ==> Not running the qemu-iotests."
|
skip "bash version too old ==> Not running the qemu-iotests."
|
||||||
exit 0
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! (sed --version | grep 'GNU sed') > /dev/null 2>&1 ; then
|
if ! (sed --version | grep 'GNU sed') > /dev/null 2>&1 ; then
|
||||||
if ! command -v gsed >/dev/null 2>&1; then
|
if ! command -v gsed >/dev/null 2>&1; then
|
||||||
echo "GNU sed not available ==> Not running the qemu-iotests."
|
skip "GNU sed not available ==> Not running the qemu-iotests."
|
||||||
exit 0
|
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
# Double-check that we're not using BusyBox' sed which says
|
# Double-check that we're not using BusyBox' sed which says
|
||||||
# that "This is not GNU sed version 4.0" ...
|
# that "This is not GNU sed version 4.0" ...
|
||||||
if sed --version | grep -q 'not GNU sed' ; then
|
if sed --version | grep -q 'not GNU sed' ; then
|
||||||
echo "BusyBox sed not supported ==> Not running the qemu-iotests."
|
skip "BusyBox sed not supported ==> Not running the qemu-iotests."
|
||||||
exit 0
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
py3 = import('python').find_installation()
|
py3 = import('python').find_installation()
|
||||||
|
|
||||||
subdir('bench')
|
subdir('bench')
|
||||||
|
subdir('qemu-iotests')
|
||||||
|
|
||||||
test_qapi_outputs = [
|
test_qapi_outputs = [
|
||||||
'qapi-builtin-types.c',
|
'qapi-builtin-types.c',
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
if have_tools and targetos != 'windows'
|
||||||
|
qemu_iotests_binaries = [qemu_img, qemu_io, qemu_nbd, qsd]
|
||||||
|
qemu_iotests_env = {'PYTHON': python.full_path()}
|
||||||
|
qemu_iotests_formats = {
|
||||||
|
'qcow2': 'quick',
|
||||||
|
'raw': 'slow',
|
||||||
|
'qed': 'thorough',
|
||||||
|
'vmdk': 'thorough',
|
||||||
|
'vpc': 'thorough'
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach k, v : emulators
|
||||||
|
if k.startswith('qemu-system-')
|
||||||
|
qemu_iotests_binaries += v
|
||||||
|
endif
|
||||||
|
endforeach
|
||||||
|
foreach format, speed: qemu_iotests_formats
|
||||||
|
if speed == 'quick'
|
||||||
|
suites = 'block'
|
||||||
|
else
|
||||||
|
suites = ['block-' + speed, speed]
|
||||||
|
endif
|
||||||
|
test('qemu-iotests ' + format, sh, args: [files('../check-block.sh'), format],
|
||||||
|
depends: qemu_iotests_binaries, env: qemu_iotests_env,
|
||||||
|
suite: suites,
|
||||||
|
timeout: 0,
|
||||||
|
is_parallel: false)
|
||||||
|
endforeach
|
||||||
|
endif
|
Loading…
Reference in New Issue