Improve integration of iotests in the meson test harness
PATCH v3 1/4 tests/qemu-iotests: Rework the checks and spots using GNU sed
In reply to Thomas HuthInstead of failing the iotests if GNU sed is not available (or skipping them completely in the check-block.sh script), it would be better to simply skip the bash-based tests that rely on GNU sed, so that the other tests could still be run. Thus we now explicitely use "gsed" (either as direct program or as a wrapper around "sed" if it's the GNU version) in the spots that rely on the GNU sed behavior. Statements that use the "-r" parameter of sed have been switched to use "-E" instead, since this switch is supported by all sed versions on our supported build hosts (most also support "-r", but macOS' sed only supports "-E"). With all these changes in place, we then can also remove the sed checks from the check-block.sh script, so that "make check-block" can now be run on systems without GNU sed, too.
--- tests/check-block.sh | 12 ------ tests/qemu-iotests/271 | 2 +- tests/qemu-iotests/common.filter | 65 ++++++++++++++++---------------- tests/qemu-iotests/common.rc | 45 +++++++++++----------- 4 files changed, 57 insertions(+), 67 deletions(-)
tests/check-block.sh +0 -12
@@ -48,18 +48,6 @@ if LANG=C bash --version | grep -q 'GNU bash, version [123]' ; then skip "bash version too old ==> Not running the qemu-iotests." fi -if ! (sed --version | grep 'GNU sed') > /dev/null 2>&1 ; then - if ! command -v gsed >/dev/null 2>&1; then - skip "GNU sed not available ==> Not running the qemu-iotests." - fi -else - # Double-check that we're not using BusyBox' sed which says - # that "This is not GNU sed version 4.0" ... - if sed --version | grep -q 'not GNU sed' ; then - skip "BusyBox sed not supported ==> Not running the qemu-iotests." - fi -fi - cd tests/qemu-iotests # QEMU_CHECK_BLOCK_AUTO is used to disable some unstable sub-tests
tests/qemu-iotests/271 +1 -1
@@ -896,7 +896,7 @@ _make_test_img -o extended_l2=on 1M # Second and third writes in _concurrent_io() are independent and may finish in # different order. So, filter offset out to match both possible variants. _concurrent_io | $QEMU_IO | _filter_qemu_io | \ - $SED -e 's/\(20480\|40960\)/OFFSET/' + sed -e 's/\(20480\|40960\)/OFFSET/' _concurrent_verify | $QEMU_IO | _filter_qemu_io # success, all done
tests/qemu-iotests/common.filter +33 -32
205 lines not on this page · raw message
tests/qemu-iotests/common.rc +23 -22
63 lines not on this page · raw message
Signature · 1 line
2.27.0
PATCH v3 2/4 tests/qemu-iotests/meson.build: Improve the indentation
In reply to Thomas HuthBy using subdir_done(), we can get rid of one level of indentation in this file. This will make it easier to add more conditions to skip the iotests in future patches.
--- tests/qemu-iotests/meson.build | 61 ++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 29 deletions(-)
tests/qemu-iotests/meson.build +32 -29
@@ -1,30 +1,33 @@ -if have_tools and targetos != 'windows' and not get_option('gprof') - 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, - protocol: 'tap', - suite: suites, - timeout: 0, - is_parallel: false) - endforeach +if not have_tools or targetos == 'windows' or get_option('gprof') + subdir_done() endif + +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, + protocol: 'tap', + suite: suites, + timeout: 0, + is_parallel: false) +endforeach
Signature · 1 line
2.27.0
PATCH v3 3/4 tests/qemu-iotests: Move the bash and sanitizer checks to meson.build
In reply to Thomas HuthWe want to get rid of check-block.sh in the long run, so let's move the checks for the bash version and sanitizers from check-block.sh into the meson.build file instead.
--- tests/check-block.sh | 26 -------------------------- tests/qemu-iotests/meson.build | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 26 deletions(-)
tests/check-block.sh +0 -26
@@ -18,36 +18,10 @@ skip() { exit 0 } -# Disable tests with any sanitizer except for specific ones -SANITIZE_FLAGS=$( grep "CFLAGS.*-fsanitize" config-host.mak 2>/dev/null ) -ALLOWED_SANITIZE_FLAGS="safe-stack cfi-icall" -#Remove all occurrencies of allowed Sanitize flags -for j in ${ALLOWED_SANITIZE_FLAGS}; do - TMP_FLAGS=${SANITIZE_FLAGS} - SANITIZE_FLAGS="" - for i in ${TMP_FLAGS}; do - if ! echo ${i} | grep -q "${j}" 2>/dev/null; then - SANITIZE_FLAGS="${SANITIZE_FLAGS} ${i}" - fi - done -done -if echo ${SANITIZE_FLAGS} | grep -q "\-fsanitize" 2>/dev/null; then - # Have a sanitize flag that is not allowed, stop - skip "Sanitizers are enabled ==> Not running the qemu-iotests." -fi - if [ -z "$(find . -name 'qemu-system-*' -print)" ]; then skip "No qemu-system binary available ==> Not running the qemu-iotests." fi -if ! command -v bash >/dev/null 2>&1 ; then - skip "bash not available ==> Not running the qemu-iotests." -fi - -if LANG=C bash --version | grep -q 'GNU bash, version [123]' ; then - skip "bash version too old ==> Not running the qemu-iotests." -fi - cd tests/qemu-iotests # QEMU_CHECK_BLOCK_AUTO is used to disable some unstable sub-tests
tests/qemu-iotests/meson.build +14 -0
@@ -2,6 +2,20 @@ if not have_tools or targetos == 'windows' or get_option('gprof') subdir_done() endif +foreach cflag: config_host['QEMU_CFLAGS'].split() + if cflag.startswith('-fsanitize') and \ + not cflag.contains('safe-stack') and not cflag.contains('cfi-icall') + message('Sanitizers are enabled ==> Disabled the qemu-iotests.') + subdir_done() + endif +endforeach + +bash = find_program('bash', required: false, version: '>= 4.0') +if not bash.found() + message('bash >= v4.0 not available ==> Disabled the qemu-iotests.') + subdir_done() +endif + qemu_iotests_binaries = [qemu_img, qemu_io, qemu_nbd, qsd] qemu_iotests_env = {'PYTHON': python.full_path()} qemu_iotests_formats = {
Signature · 1 line
2.27.0
PATCH v3 4/4 tests: Do not treat the iotests as separate meson test target anymore
In reply to Thomas HuthIf there is a failing iotest, the output is currently not logged to the console anymore. To get this working again, we need to run the meson test runner with --print-errorlogs (and without --verbose). We could update the "meson test" call in tests/Makefile.include, but actually it's nicer and easier if we simply do not treat the iotests as separate test target anymore and integrate them along with the other test suites.
--- meson.build | 6 +++--- scripts/mtest2make.py | 4 ---- tests/Makefile.include | 9 +-------- 3 files changed, 4 insertions(+), 15 deletions(-)
meson.build +3 -3
@@ -3,9 +3,9 @@ project('qemu', ['c'], meson_version: '>=0.59.3', 'b_staticpic=false', 'stdsplit=false'], version: files('VERSION')) -add_test_setup('quick', exclude_suites: ['block', 'slow', 'thorough'], is_default: true) -add_test_setup('slow', exclude_suites: ['block', 'thorough'], env: ['G_TEST_SLOW=1', 'SPEED=slow']) -add_test_setup('thorough', exclude_suites: ['block'], env: ['G_TEST_SLOW=1', 'SPEED=thorough']) +add_test_setup('quick', exclude_suites: ['slow', 'thorough'], is_default: true) +add_test_setup('slow', exclude_suites: ['thorough'], env: ['G_TEST_SLOW=1', 'SPEED=slow']) +add_test_setup('thorough', env: ['G_TEST_SLOW=1', 'SPEED=thorough']) not_found = dependency('', required: false) keyval = import('keyval')
scripts/mtest2make.py +0 -4
@@ -101,10 +101,6 @@ def emit_suite(name, suite, prefix): testsuites = defaultdict(Suite) for test in introspect['tests']: 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') for name, suite in testsuites.items(): emit_suite(name, suite, 'check')
tests/Makefile.include +1 -8
@@ -147,16 +147,9 @@ check-acceptance: check-acceptance-deprecated-warning | check-avocado # Consolidated targets -.PHONY: check-block check check-clean get-vm-images +.PHONY: check check-clean get-vm-images check: -ifneq ($(.check-block.deps),) -check: check-block -check-block: run-ninja - $(if $(MAKE.n),,+)$(MESON) test $(MTESTARGS) $(.mtestargs) --verbose \ - --logbase iotestslog $(call .speed.$(SPEED), block block-slow block-thorough) -endif - check-build: run-ninja check-clean:
Signature · 1 line
2.27.0
v3 cover Improve integration of iotests in the meson test harness
Though "make check-block" is currently already run via the meson test runner, it still looks like an oddball in the output of "make check". It would be nicer if the iotests would show up like the other tests suites.
My original plan was to add each iotests individually from meson.build, but I did not get that done reliably yet [*], so here's now a cut-down version to improve the situation at least a little bit: The first three patches are preparation for the clean-up (long-term goal is to get rid of check-block.sh, though we're not quite there yet), and the final patch adds the iotests not as separate test target in the meson test harness anymore. This way, we can now finally get the output of failed tests on the console again (unless you're running meson test in verbose mode, where meson only puts this to the log file - for incomprehensible reasons), so this should hopefully help to diagnose problems with the iotests in most cases more easily.
[*] See v2 here:
https://lists.gnu.org/archive/html/qemu-devel/2022-02/msg01942.html
Thomas Huth (4):
tests/qemu-iotests: Rework the checks and spots using GNU sed tests/qemu-iotests/meson.build: Improve the indentation tests/qemu-iotests: Move the bash and sanitizer checks to meson.build
tests: Do not treat the iotests as separate meson test target anymore
meson.build | 6 +-- scripts/mtest2make.py | 4 -- tests/Makefile.include | 9 +--- tests/check-block.sh | 38 ----------------- tests/qemu-iotests/271 | 2 +- tests/qemu-iotests/common.filter | 65 ++++++++++++++-------------- tests/qemu-iotests/common.rc | 45 ++++++++++---------- tests/qemu-iotests/meson.build | 73 ++++++++++++++++++++------------ 8 files changed, 106 insertions(+), 136 deletions(-)
Signature · 1 line
2.27.0
Quoted 4 lines · Thomas Huth
This way, we can now finally get the output of failed
tests on the console again (unless you're running meson test in verbose mode, where meson only puts this to the log file - for incomprehensible reasons),
It's a bug (introduced by yours truly, which perhaps makes it less incomprehensible) and there's an open pull request to fix it.
Paolo
Quoted 16 lines · Thomas Huth
Though "make check-block" is currently already run via the meson test runner, it still looks like an oddball in the output of "make check". It would be nicer if the iotests would show up like the other tests suites.
My original plan was to add each iotests individually from meson.build, but I did not get that done reliably yet [*], so here's now a cut-down version to improve the situation at least a little bit: The first three patches are preparation for the clean-up (long-term goal is to get rid of
check-block.sh, though we're not quite there yet), and the final patch adds the iotests not as separate test target in the meson test harness anymore. This way, we can now finally get the output of failed tests on the console again (unless you're running meson test in verbose mode, where meson only puts this to the log file - for incomprehensible reasons), so this should hopefully help to diagnose problems with the iotests in most cases more easily.
Quoted 8 lines
[*] See v2 here:
https://lists.gnu.org/archive/html/qemu-devel/2022-02/msg01942.htmlThomas Huth (4):
tests/qemu-iotests: Rework the checks and spots using GNU sed tests/qemu-iotests/meson.build: Improve the indentation tests/qemu-iotests: Move the bash and sanitizer checks to meson.build
tests: Do not treat the iotests as separate meson test target anymore
What’s the status of this series? I wonder why you split it apart, mainly.
Patch 1 was already merged, and I took patch 4 today. So what about patches 2 and 3? They look sensible to me, but is this series still relevant and fresh, considering you sent new versions of patches 1 and 4?
(And are there any other iotests patches from you that flew under my radar?)
Hanna
Re: [PATCH v3 3/4] tests/qemu-iotests: Move the bash and sanitizer checks to meson.build
In reply to Thomas HuthQuoted 9 lines · Thomas Huth
We want to get rid of
check-block.shin the long run, so let's move the checks for the bash version and sanitizers fromcheck-block.shinto the meson.build file instead.Signed-off-by Thomas Huth <[email protected]>--- tests/check-block.sh | 26 -------------------------- tests/qemu-iotests/meson.build | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 26 deletions(-)
FWIW
Quoted 20 lines · Hanna Reitz
Quoted 19 lines · Thomas Huth
Though "make check-block" is currently already run via the meson test runner, it still looks like an oddball in the output of "make check". It would be nicer if the iotests would show up like the other tests suites.
My original plan was to add each iotests individually from meson.build, but I did not get that done reliably yet [*], so here's now a cut-down version to improve the situation at least a little bit: The first three patches are preparation for the clean-up (long-term goal is to get rid of
check-block.sh, though we're not quite there yet), and the final patch adds the iotests not as separate test target in the meson test harness anymore. This way, we can now finally get the output of failed tests on the console again (unless you're running meson test in verbose mode, where meson only puts this to the log file - for incomprehensible reasons), so this should hopefully help to diagnose problems with the iotests in most cases more easily.[*] See v2 here:
https://lists.gnu.org/archive/html/qemu-devel/2022-02/msg01942.html
Quoted 7 lines
Quoted 5 lines
Thomas Huth (4):
tests/qemu-iotests: Rework the checks and spots using GNU sed tests/qemu-iotests/meson.build: Improve the indentation tests/qemu-iotests: Move the bash and sanitizer checks to meson.build
tests: Do not treat the iotests as separate meson test target anymoreWhat’s the status of this series? I wonder why you split it apart, mainly.
I've mainly split the fourth patch apart since Paolo mentioned that the commit message should mention the meson bug (IIRC), and since QEMU was entering soft-freeze, thus I doubt that a patch like "Move the bash and sanitizer checks to meson.build" is still acceptable at this point in time. The meson.build clean-up is rather something for 7.1 instead.
Quoted 1 line
Patch 1 was already merged, and I took patch 4 today. So what about patches 2 and 3? They look sensible to me, but is this series still relevant and fresh, considering you sent new versions of patches 1 and 4?
If you think they are still ok for 7.0, you can certainly also pick the 2nd and 3rd patch ... otherwise I'll respin them later for 7.1.
Quoted 1 line
(And are there any other iotests patches from you that flew under my radar?)
There's my "Supply a test plan in TAP mode" patch on the list, but apparently you already found it :-)
Thanks!
Thomas
Quoted 27 lines · Thomas Huth
Quoted 26 lines · Hanna Reitz
Quoted 24 lines · Thomas Huth
Though "make check-block" is currently already run via the meson test runner, it still looks like an oddball in the output of "make check". It would be nicer if the iotests would show up like the other tests suites.
My original plan was to add each iotests individually from meson.build, but I did not get that done reliably yet [*], so here's now a cut-down version to improve the situation at least a little bit: The first three patches are preparation for the clean-up (long-term goal is to get rid of
check-block.sh, though we're not quite there yet), and the final patch adds the iotests not as separate test target in the meson test harness anymore. This way, we can now finally get the output of failed tests on the console again (unless you're running meson test in verbose mode, where meson only puts this to the log file - for incomprehensible reasons), so this should hopefully help to diagnose problems with the iotests in most cases more easily.[*] See v2 here:
https://lists.gnu.org/archive/html/qemu-devel/2022-02/msg01942.htmlThomas Huth (4):
tests/qemu-iotests: Rework the checks and spots using GNU sed tests/qemu-iotests/meson.build: Improve the indentation tests/qemu-iotests: Move the bash and sanitizer checks to meson.build
tests: Do not treat the iotests as separate meson test target anymore
Quoted 7 lines
Quoted 1 line
What’s the status of this series? I wonder why you split it apart, mainly.
I've mainly split the fourth patch apart since Paolo mentioned that the commit message should mention the meson bug (IIRC), and since QEMU was entering soft-freeze, thus I doubt that a patch like "Move the bash and sanitizer checks to meson.build" is still acceptable at this point in time. The meson.build clean-up is rather something for 7.1 instead.
Quoted 1 line
Patch 1 was already merged, and I took patch 4 today. So what about patches 2 and 3? They look sensible to me, but is this series still relevant and fresh, considering you sent new versions of patches 1 and 4?
If you think they are still ok for 7.0, you can certainly also pick the 2nd and 3rd patch ... otherwise I'll respin them later for 7.1.
That sounds like you don’t really need to respin, so I’ve taken them to my block-next branch for 7.1:
https://gitlab.com/hreitz/qemu/-/commits/block-next
Thanks!
Hanna