Allow Valgrind checking all QEMU processes
cover Allow Valgrind checking all QEMU processes
In the current implementation of the QEMU bash iotests, only qemu-io processes may be run under the Valgrind, which is a useful tool for finding memory usage issues. Let's allow the common.rc bash script runing all the QEMU processes, such as qemu-kvm, qemu-img, qemu-ndb and qemu-vxhs, under the Valgrind tool.
Andrey Shinkevich (7):
iotests: allow Valgrind checking all QEMU processes
iotests: amendment for benchmark output of 039 061 137
iotests: exclude killed processes from running under Valgrind
iotests: Valgrind fails to work with nonexistent directory
iotests: extended timeout under Valgrind
iotests: extend sleeping time under Valgrind
iotests: amend QEMU NBD process synchronization
tests/qemu-iotests/028 | 6 +++- tests/qemu-iotests/039 | 5 ++++ tests/qemu-iotests/039.out | 30 ++++---------------- tests/qemu-iotests/051 | 1 + tests/qemu-iotests/061 | 2 ++ tests/qemu-iotests/061.out | 12 ++------ tests/qemu-iotests/137 | 1 + tests/qemu-iotests/137.out | 6 +--- tests/qemu-iotests/183 | 9 +++++- tests/qemu-iotests/192 | 6 +++- tests/qemu-iotests/247 | 6 +++- tests/qemu-iotests/common.nbd | 6 ++++ tests/qemu-iotests/common.rc | 65 ++++++++++++++++++++++++++++++++----------- 13 files changed, 94 insertions(+), 61 deletions(-)
Signature · 1 line
1.8.3.1
PATCH 1/7 iotests: allow Valgrind checking all QEMU processes
With the '-valgrind' option, let all the QEMU processes be run under the Valgrind tool. The Valgrind own parameters may be set with its environment variable VALGRIND_OPTS, e.g. VALGRIND_OPTS="--leak-check=yes" ./check -qcow2 -valgrind <test#>
--- tests/qemu-iotests/common.rc | 65 ++++++++++++++++++++++++++++++++------------ 1 file changed, 48 insertions(+), 17 deletions(-)
tests/qemu-iotests/common.rc +48 -17
@@ -60,19 +60,52 @@ if ! . ./common.config exit 1 fi +_qemu_proc_wrapper() +{ + local VALGRIND_LOGFILE="$1" + shift + if [ "${VALGRIND_QEMU}" == "y" ]; then + exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99 "$@" + else + exec "$@" + fi +} + +_qemu_proc_valgrind_log() +{ + local VALGRIND_LOGFILE="$1" + local RETVAL="$2" + if [ "${VALGRIND_QEMU}" == "y" ]; then + if [ $RETVAL == 99 ]; then + cat "${VALGRIND_LOGFILE}" + fi + rm -f "${VALGRIND_LOGFILE}" + fi +} + _qemu_wrapper() { + local VALGRIND_LOGFILE="${TEST_DIR}"/$$.valgrind ( if [ -n "${QEMU_NEED_PID}" ]; then echo $BASHPID > "${QEMU_TEST_DIR}/qemu-${_QEMU_HANDLE}.pid" fi - exec "$QEMU_PROG" $QEMU_OPTIONS "$@" + _qemu_proc_wrapper "${VALGRIND_LOGFILE}" "$QEMU_PROG" $QEMU_OPTIONS "$@" ) + RETVAL=$? + _qemu_proc_valgrind_log "${VALGRIND_LOGFILE}" $RETVAL + return $RETVAL } _qemu_img_wrapper() { - (exec "$QEMU_IMG_PROG" $QEMU_IMG_OPTIONS "$@") + local VALGRIND_LOGFILE="${TEST_DIR}"/$$.valgrind + ( + _qemu_proc_wrapper "${VALGRIND_LOGFILE}" "$QEMU_IMG_PROG" $QEMU_IMG_OPTIONS "$@" + ) + RETVAL=$? + _qemu_proc_valgrind_log "${VALGRIND_LOGFILE}" $RETVAL + return $RETVAL } _qemu_io_wrapper()
@@ -85,38 +118,36 @@ _qemu_io_wrapper() QEMU_IO_ARGS="--object secret,id=keysec0,data=$IMGKEYSECRET $QEMU_IO_ARGS" fi fi - local RETVAL ( - if [ "${VALGRIND_QEMU}" == "y" ]; then - exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99 "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@" - else - exec "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@" - fi + _qemu_proc_wrapper "${VALGRIND_LOGFILE}" "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@" ) RETVAL=$? - if [ "${VALGRIND_QEMU}" == "y" ]; then - if [ $RETVAL == 99 ]; then - cat "${VALGRIND_LOGFILE}" - fi - rm -f "${VALGRIND_LOGFILE}" - fi - (exit $RETVAL) + _qemu_proc_valgrind_log "${VALGRIND_LOGFILE}" $RETVAL + return $RETVAL } _qemu_nbd_wrapper() { + local VALGRIND_LOGFILE="${TEST_DIR}"/$$.valgrind ( echo $BASHPID > "${QEMU_TEST_DIR}/qemu-nbd.pid" - exec "$QEMU_NBD_PROG" $QEMU_NBD_OPTIONS "$@" + _qemu_proc_wrapper "${VALGRIND_LOGFILE}" "$QEMU_NBD_PROG" $QEMU_NBD_OPTIONS "$@" ) + RETVAL=$? + _qemu_proc_valgrind_log "${VALGRIND_LOGFILE}" $RETVAL + return $RETVAL } _qemu_vxhs_wrapper() { + local VALGRIND_LOGFILE="${TEST_DIR}"/$$.valgrind ( echo $BASHPID > "${TEST_DIR}/qemu-vxhs.pid" - exec "$QEMU_VXHS_PROG" $QEMU_VXHS_OPTIONS "$@" + _qemu_proc_wrapper "${VALGRIND_LOGFILE}" "$QEMU_VXHS_PROG" $QEMU_VXHS_OPTIONS "$@" ) + RETVAL=$? + _qemu_proc_valgrind_log "${VALGRIND_LOGFILE}" $RETVAL + return $RETVAL } export QEMU=_qemu_wrapper
Signature · 1 line
1.8.3.1
Re: [Qemu-devel] [PATCH 1/7] iotests: allow Valgrind checking all QEMU processes
Quoted 4 lines · Andrey Shinkevich
With the '-valgrind' option, let all the QEMU processes be run under the Valgrind tool. The Valgrind own parameters may be set with its environment variable
VALGRIND_OPTS, e.g. VALGRIND_OPTS="--leak-check=yes" ./check -qcow2 -valgrind <test#>
Let's spell this --valgrind; long options should prefer the use of -- (as in getopt_long), whether or not we also have a reason to support -valgrind (as in getopt_long_only). Yes, qemu is an oddball in this regards, but no need to make it worse.
Quoted 8 lines
Signed-off-by Andrey Shinkevich <[email protected]>--- tests/qemu-iotests/common.rc | 65 ++++++++++++++++++++++++++++++++------------ 1 file changed, 48 insertions(+), 17 deletions(-)tests/qemu-iotests/common.rc +0
-0
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
Re: [Qemu-devel] [PATCH 1/7] iotests: allow Valgrind checking all QEMU processes
Quoted 11 lines · Eric Blake
Quoted 4 lines · Andrey Shinkevich
With the '-valgrind' option, let all the QEMU processes be run under the Valgrind tool. The Valgrind own parameters may be set with its environment variable
VALGRIND_OPTS, e.g. VALGRIND_OPTS="--leak-check=yes" ./check -qcow2 -valgrind <test#>Let's spell this --valgrind; long options should prefer the use of -- (as in
getopt_long), whether or not we also have a reason to support -valgrind (as ingetopt_long_only). Yes, qemu is an oddball in this regards, but no need to make it worse.
Thank you, Eric. That sounds good but the short option'-valgrind' is preexisting in QEMU. Should I create a new patch for the long option? If so, will we have both options supported by QEMU?
Andrey
Quoted 10 lines
Quoted 8 lines
Signed-off-by Andrey Shinkevich <[email protected]>--- tests/qemu-iotests/common.rc | 65 ++++++++++++++++++++++++++++++++------------ 1 file changed, 48 insertions(+), 17 deletions(-)tests/qemu-iotests/common.rc +0
-0
Signature · 2 lines
With the best regards, Andrey Shinkevich
Re: [Qemu-devel] [PATCH 1/7] iotests: allow Valgrind checking all QEMU processes
Quoted 15 lines · Andrey Shinkevich
Quoted 11 lines · Eric Blake
Quoted 4 lines · Andrey Shinkevich
With the '-valgrind' option, let all the QEMU processes be run under the Valgrind tool. The Valgrind own parameters may be set with its environment variable
VALGRIND_OPTS, e.g. VALGRIND_OPTS="--leak-check=yes" ./check -qcow2 -valgrind <test#>Let's spell this --valgrind; long options should prefer the use of -- (as in
getopt_long), whether or not we also have a reason to support -valgrind (as ingetopt_long_only). Yes, qemu is an oddball in this regards, but no need to make it worse.
Quoted 3 lines
Thank you, Eric. That sounds good but the short option'-valgrind' is preexisting in QEMU. Should I create a new patch for the long option? If so, will we have both options supported by QEMU?
Oh, you're talking about qemu-iotests/check already supporting merely '-valgrind', not 'qemu-kvm' or '*/qemu-system-*'. ./check is already an oddball for not permitting double dash, but at this point, normalizing it is a lot of churn. So it becomes a tradeoff on how much grunt work do you really want to do.
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
PATCH 2/7 iotests: amendment for benchmark output of 039 061 137
In reply to Andrey ShinkevichAfter including the Valgrind into the QEMU processes wrappers in the common.rc script, the output for the tests 039 061 137 has been changed and is to be amended.
--- tests/qemu-iotests/039.out | 30 +++++------------------------- tests/qemu-iotests/061.out | 12 ++---------- tests/qemu-iotests/137.out | 6 +----- 3 files changed, 8 insertions(+), 40 deletions(-)
tests/qemu-iotests/039.out +5 -25
@@ -11,11 +11,7 @@ No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 wrote 512/512 bytes at offset 0 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -./common.rc: Killed ( if [ "${VALGRIND_QEMU}" == "y" ]; then - exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99 "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@"; -else - exec "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@"; -fi ) +./common.rc: Killed ( _qemu_proc_wrapper "${VALGRIND_LOGFILE}" "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@" ) incompatible_features 0x1 ERROR cluster 5 refcount=0 reference=1 ERROR OFLAG_COPIED data cluster: l2_entry=8000000000050000 refcount=0
@@ -50,11 +46,7 @@ read 512/512 bytes at offset 0 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 wrote 512/512 bytes at offset 0 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -./common.rc: Killed ( if [ "${VALGRIND_QEMU}" == "y" ]; then - exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99 "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@"; -else - exec "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@"; -fi ) +./common.rc: Killed ( _qemu_proc_wrapper "${VALGRIND_LOGFILE}" "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@" ) incompatible_features 0x1 ERROR cluster 5 refcount=0 reference=1 Rebuilding refcount structure
@@ -68,11 +60,7 @@ incompatible_features 0x0 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 wrote 512/512 bytes at offset 0 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -./common.rc: Killed ( if [ "${VALGRIND_QEMU}" == "y" ]; then - exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99 "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@"; -else - exec "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@"; -fi ) +./common.rc: Killed ( _qemu_proc_wrapper "${VALGRIND_LOGFILE}" "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@" ) incompatible_features 0x0 No errors were found on the image.
@@ -91,11 +79,7 @@ No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 wrote 512/512 bytes at offset 0 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -./common.rc: Killed ( if [ "${VALGRIND_QEMU}" == "y" ]; then - exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99 "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@"; -else - exec "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@"; -fi ) +./common.rc: Killed ( _qemu_proc_wrapper "${VALGRIND_LOGFILE}" "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@" ) incompatible_features 0x1 ERROR cluster 5 refcount=0 reference=1 ERROR OFLAG_COPIED data cluster: l2_entry=8000000000050000 refcount=0
@@ -105,11 +89,7 @@ Data may be corrupted, or further writes to the image may corrupt it. Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 wrote 512/512 bytes at offset 0 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -./common.rc: Killed ( if [ "${VALGRIND_QEMU}" == "y" ]; then - exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99 "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@"; -else - exec "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@"; -fi ) +./common.rc: Killed ( _qemu_proc_wrapper "${VALGRIND_LOGFILE}" "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@" ) incompatible_features 0x0 No errors were found on the image. *** done
tests/qemu-iotests/061.out +2 -10
@@ -118,11 +118,7 @@ No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 wrote 131072/131072 bytes at offset 0 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -./common.rc: Killed ( if [ "${VALGRIND_QEMU}" == "y" ]; then - exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99 "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@"; -else - exec "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@"; -fi ) +./common.rc: Killed ( _qemu_proc_wrapper "${VALGRIND_LOGFILE}" "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@" ) magic 0x514649fb version 3 backing_file_offset 0x0
@@ -280,11 +276,7 @@ No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 wrote 131072/131072 bytes at offset 0 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -./common.rc: Killed ( if [ "${VALGRIND_QEMU}" == "y" ]; then - exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99 "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@"; -else - exec "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@"; -fi ) +./common.rc: Killed ( _qemu_proc_wrapper "${VALGRIND_LOGFILE}" "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@" ) magic 0x514649fb version 3 backing_file_offset 0x0
tests/qemu-iotests/137.out +1 -5
@@ -35,11 +35,7 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 qemu-io: Unsupported value 'blubb' for qcow2 option 'overlap-check'. Allowed are any of the following: none, constant, cached, all wrote 512/512 bytes at offset 0 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -./common.rc: Killed ( if [ "${VALGRIND_QEMU}" == "y" ]; then - exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99 "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@"; -else - exec "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@"; -fi ) +./common.rc: Killed ( _qemu_proc_wrapper "${VALGRIND_LOGFILE}" "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@" ) incompatible_features 0x0 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 wrote 65536/65536 bytes at offset 0
Signature · 1 line
1.8.3.1
Re: [Qemu-devel] [PATCH 2/7] iotests: amendment for benchmark output of 039 061 137
Quoted 3 lines · Andrey Shinkevich
After including the Valgrind into the QEMU processes wrappers in the common.rc script, the output for the tests 039 061 137 has been changed and is to be amended.
The change to common.rc was done in the previous patch, so this fixup should be there too. Separating the fixup will impact people doing "git bisect" to track down bugs.
Regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Re: [Qemu-devel] [PATCH 2/7] iotests: amendment for benchmark output of 039 061 137
Quoted 5 lines · Daniel P. Berrangé
Quoted 3 lines · Andrey Shinkevich
After including the Valgrind into the QEMU processes wrappers in the common.rc script, the output for the tests 039 061 137 has been changed and is to be amended.
Quoted 8 lines
The change to common.rc was done in the previous patch, so this fixup should be there too. Separating the fixup will impact people doing "git bisect" to track down bugs.
Regards,
Daniel
Yes, I will in v2, thank you.
Andrey
PATCH 3/7 iotests: exclude killed processes from running under Valgrind
In reply to Andrey ShinkevichThe Valgrind tool fails to manage its termination when QEMU raises the signal SIGKILL. Lets exclude such test cases from running under the Valgrind because there is no sense to check memory issues that way.
--- tests/qemu-iotests/039 | 5 +++++ tests/qemu-iotests/061 | 2 ++ tests/qemu-iotests/137 | 1 + 3 files changed, 8 insertions(+)
tests/qemu-iotests/039 +5 -0
@@ -65,6 +65,7 @@ echo "== Creating a dirty image file ==" IMGOPTS="compat=1.1,lazy_refcounts=on" _make_test_img $size +VALGRIND_QEMU="" \ $QEMU_IO -c "write -P 0x5a 0 512" \ -c "sigraise $(kill -l KILL)" "$TEST_IMG" 2>&1 \ | _filter_qemu_io
@@ -100,6 +101,7 @@ echo "== Opening a dirty image read/write should repair it ==" IMGOPTS="compat=1.1,lazy_refcounts=on" _make_test_img $size +VALGRIND_QEMU="" \ $QEMU_IO -c "write -P 0x5a 0 512" \ -c "sigraise $(kill -l KILL)" "$TEST_IMG" 2>&1 \ | _filter_qemu_io
@@ -118,6 +120,7 @@ echo "== Creating an image file with lazy_refcounts=off ==" IMGOPTS="compat=1.1,lazy_refcounts=off" _make_test_img $size +VALGRIND_QEMU="" \ $QEMU_IO -c "write -P 0x5a 0 512" \ -c "sigraise $(kill -l KILL)" "$TEST_IMG" 2>&1 \ | _filter_qemu_io
@@ -151,6 +154,7 @@ echo "== Changing lazy_refcounts setting at runtime ==" IMGOPTS="compat=1.1,lazy_refcounts=off" _make_test_img $size +VALGRIND_QEMU="" \ $QEMU_IO -c "reopen -o lazy-refcounts=on" \ -c "write -P 0x5a 0 512" \ -c "sigraise $(kill -l KILL)" "$TEST_IMG" 2>&1 \
@@ -163,6 +167,7 @@ _check_test_img IMGOPTS="compat=1.1,lazy_refcounts=on" _make_test_img $size +VALGRIND_QEMU="" \ $QEMU_IO -c "reopen -o lazy-refcounts=off" \ -c "write -P 0x5a 0 512" \ -c "sigraise $(kill -l KILL)" "$TEST_IMG" 2>&1 \
tests/qemu-iotests/061 +2 -0
@@ -73,6 +73,7 @@ echo echo "=== Testing dirty version downgrade ===" echo IMGOPTS="compat=1.1,lazy_refcounts=on" _make_test_img 64M +VALGRIND_QEMU="" \ $QEMU_IO -c "write -P 0x2a 0 128k" -c flush \ -c "sigraise $(kill -l KILL)" "$TEST_IMG" 2>&1 | _filter_qemu_io $PYTHON qcow2.py "$TEST_IMG" dump-header
@@ -107,6 +108,7 @@ echo echo "=== Testing dirty lazy_refcounts=off ===" echo IMGOPTS="compat=1.1,lazy_refcounts=on" _make_test_img 64M +VALGRIND_QEMU="" \ $QEMU_IO -c "write -P 0x2a 0 128k" -c flush \ -c "sigraise $(kill -l KILL)" "$TEST_IMG" 2>&1 | _filter_qemu_io $PYTHON qcow2.py "$TEST_IMG" dump-header
tests/qemu-iotests/137 +1 -0
@@ -130,6 +130,7 @@ echo # Whether lazy-refcounts was actually enabled can easily be tested: Check if # the dirty bit is set after a crash +VALGRIND_QEMU="" \ $QEMU_IO \ -c "reopen -o lazy-refcounts=on,overlap-check=blubb" \ -c "write -P 0x5a 0 512" \
Signature · 1 line
1.8.3.1
PATCH 4/7 iotests: Valgrind fails to work with nonexistent directory
In reply to Andrey ShinkevichThe Valgrind uses the exported variable TMPDIR and fails if the directory does not exist. Let us exclude such a test case from being run under the Valgrind.
--- tests/qemu-iotests/051 | 1 + 1 file changed, 1 insertion(+)
tests/qemu-iotests/051 +1 -0
@@ -377,6 +377,7 @@ printf %b "qemu-io $device_id \"write -P 0x33 0 4k\"\ncommit $device_id\n" | $QEMU_IO -c "read -P 0x33 0 4k" "$TEST_IMG" | _filter_qemu_io # Using snapshot=on with a non-existent TMPDIR +VALGRIND_QEMU="" \ TMPDIR=/nonexistent run_qemu -drive driver=null-co,snapshot=on # Using snapshot=on together with read-only=on
Signature · 1 line
1.8.3.1
PATCH 5/7 iotests: extended timeout under Valgrind
In reply to Andrey ShinkevichAs the iotests run longer under the Valgrind, the QEMU_COMM_TIMEOUT is to be increased in the test cases 028, 183 and 192 when running under the Valgrind.
--- tests/qemu-iotests/028 | 6 +++++- tests/qemu-iotests/183 | 9 ++++++++- tests/qemu-iotests/192 | 6 +++++- 3 files changed, 18 insertions(+), 3 deletions(-)
tests/qemu-iotests/028 +5 -1
@@ -110,7 +110,11 @@ echo qemu_comm_method="monitor" _launch_qemu -drive file="${TEST_IMG}",cache=${CACHEMODE},id=disk h=$QEMU_HANDLE -QEMU_COMM_TIMEOUT=1 +if [ "${VALGRIND_QEMU}" == "y" ]; then + QEMU_COMM_TIMEOUT=4 +else + QEMU_COMM_TIMEOUT=1 +fi # Silence output since it contains the disk image path and QEMU's readline # character echoing makes it very hard to filter the output. Plus, there
tests/qemu-iotests/183 +8 -1
@@ -94,8 +94,15 @@ if echo "$reply" | grep "compiled without old-style" > /dev/null; then _notrun "migrate -b support not compiled in" fi -QEMU_COMM_TIMEOUT=0.1 qemu_cmd_repeat=50 silent=yes \ +timeout_comm=$QEMU_COMM_TIMEOUT +if [ "${VALGRIND_QEMU}" == "y" ]; then + QEMU_COMM_TIMEOUT=1 +else + QEMU_COMM_TIMEOUT=0.1 +fi +qemu_cmd_repeat=50 silent=yes \ _send_qemu_cmd $src "{ 'execute': 'query-migrate' }" '"status": "completed"' +QEMU_COMM_TIMEOUT=$timeout_comm _send_qemu_cmd $src "{ 'execute': 'query-status' }" "return" echo
tests/qemu-iotests/192 +5 -1
@@ -60,7 +60,11 @@ fi qemu_comm_method="monitor" _launch_qemu -drive $DRIVE_ARG -incoming defer h=$QEMU_HANDLE -QEMU_COMM_TIMEOUT=1 +if [ "${VALGRIND_QEMU}" == "y" ]; then + QEMU_COMM_TIMEOUT=4 +else + QEMU_COMM_TIMEOUT=1 +fi _send_qemu_cmd $h "nbd_server_start unix:$TEST_DIR/nbd" "(qemu)" _send_qemu_cmd $h "nbd_server_add -w drive0" "(qemu)"
Signature · 1 line
1.8.3.1
PATCH 6/7 iotests: extend sleeping time under Valgrind
In reply to Andrey ShinkevichTo synchronize the time when QEMU is running longer under the Valgrind, increase the sleeping time int the test 247.
--- tests/qemu-iotests/247 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
tests/qemu-iotests/247 +5 -1
@@ -57,7 +57,11 @@ TEST_IMG="$TEST_IMG.4" _make_test_img $size {"execute":"block-commit", "arguments":{"device":"format-4", "top-node": "format-2", "base-node":"format-0", "job-id":"job0"}} EOF -sleep 1 +if [ "${VALGRIND_QEMU}" == "y" ]; then + sleep 5 +else + sleep 1 +fi echo '{"execute":"quit"}' ) | $QEMU -qmp stdio -nographic -nodefaults \ -blockdev file,node-name=file-0,filename=$TEST_IMG.0,auto-read-only=on \
Signature · 1 line
1.8.3.1
PATCH 7/7 iotests: amend QEMU NBD process synchronization
In reply to Andrey ShinkevichProcesses are dying harder under the Valgring. It results in counting the dying process as a newborn one. Make it sure that old NBD job get finished before starting a new one.
--- tests/qemu-iotests/common.nbd | 6 ++++++ 1 file changed, 6 insertions(+)
tests/qemu-iotests/common.nbd +6 -0
@@ -22,6 +22,7 @@ nbd_unix_socket="${TEST_DIR}/qemu-nbd.sock" nbd_tcp_addr="127.0.0.1" nbd_pid_file="${TEST_DIR}/qemu-nbd.pid" +nbd_job_pid="" nbd_server_stop() {
@@ -33,6 +34,9 @@ nbd_server_stop() kill "$NBD_PID" fi fi + if [ -n "$nbd_job_pid" ] && kill -s 0 "$nbd_job_pid" 2>/dev/null; then + wait "$nbd_job_pid" + fi rm -f "$nbd_unix_socket" }
@@ -61,6 +65,7 @@ nbd_server_start_unix_socket() { nbd_server_stop $QEMU_NBD -v -t -k "$nbd_unix_socket" "$@" & + nbd_job_pid=$! nbd_server_wait_for_unix_socket $! }
@@ -105,5 +110,6 @@ nbd_server_start_tcp_socket() { nbd_server_stop $QEMU_NBD -v -t -b $nbd_tcp_addr -p $nbd_tcp_port "$@" & + nbd_job_pid=$! nbd_server_wait_for_tcp_socket $! }
Signature · 1 line
1.8.3.1