Skip to contentSkip to conversation

iotests: Fix cleanup path in some tests

PATCH In review Max Reitz 3 participants 4 messages Feb 24, 2020 – Mar 24, 2020

lore
Share & tools
lore

Max Reitz

author
#0 lore raw

PATCH 1/1 iotests: Fix cleanup path in some tests

Some iotests leave behind some external data file when run for qcow2 with -o data_file. Fix that.

---
 tests/qemu-iotests/085 | 1 +
 tests/qemu-iotests/087 | 6 ++++++
 tests/qemu-iotests/279 | 2 +-
 3 files changed, 8 insertions(+), 1 deletion(-)
tests/qemu-iotests/085 +1 -0
index 46981dbb64..dd3c993a2d 100755
@@ -39,6 +39,7 @@ SNAPSHOTS=10
 _cleanup()
 {
     _cleanup_qemu
+    _cleanup_test_img
     for i in $(seq 1 ${SNAPSHOTS})
     do
         _rm_test_img "${TEST_DIR}/${i}-${snapshot_virt0}"
tests/qemu-iotests/087 +6 -0
index d6c8613419..bdfdad3454 100755
@@ -26,6 +26,12 @@ echo "QA output created by $seq"
 
 status=1	# failure is the default!
 
+_cleanup()
+{
+    _cleanup_test_img
+}
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
 # get standard environment, filters and checks
 . ./common.rc
 . ./common.filter
tests/qemu-iotests/279 +1 -1
index 30d29b1cb2..75a4747e6b 100755
@@ -26,7 +26,7 @@ status=1	# failure is the default!
 _cleanup()
 {
     _cleanup_test_img
-    rm -f "$TEST_IMG.mid"
+    _rm_test_img "$TEST_IMG.mid"
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
 
Signature · 1 line
2.24.1
#1 lore raw
Patchew URL: https://patchew.org/QEMU/[email protected]/

Patchew URL: https://patchew.org/QEMU/[email protected]/

Hi,

This series failed the docker-quick@centos7 build test. Please find the testing commands and their output below. If you have Docker installed, you can probably reproduce it locally.

=== TEST SCRIPT BEGIN ===
#!/bin/bash
make docker-image-centos7 V=1 NETWORK=1
time make docker-test-quick@centos7 SHOW_ENV=1 J=14 NETWORK=1 === TEST SCRIPT END ===

Not run: 259
Failures: 161
Failed 1 of 116 iotests
make: *** [check-tests/check-block.sh] Error 1 Traceback (most recent call last):
File "./tests/docker/docker.py", line 664, in <module>

    sys.exit(main())

---
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['sudo', '-n', 'docker', 'run', '--label', 'com.qemu.instance.uuid=7028e57d717b4b119d70b501375c2943', '-u', '1001', '--security-opt', 'seccomp=unconfined', '--rm', '-e', 'TARGET_LIST=', '-e', 'EXTRA_CONFIGURE_OPTS=', '-e', 'V=', '-e', 'J=14', '-e', 'DEBUG=', '-e', 'SHOW_ENV=1', '-e', 'CCACHE_DIR=/var/tmp/ccache', '-v', '/home/patchew/.cache/qemu-docker-ccache:/var/tmp/ccache:z', '-v', '/var/tmp/patchew-tester-tmp-nyan6ktl/src/docker-src.2020-02-24-12.33.22.20519:/var/tmp/qemu:z,ro', 'qemu:centos7', '/var/tmp/qemu/run', 'test-quick']' returned non-zero exit status 2. filter=--filter=label=com.qemu.instance.uuid=7028e57d717b4b119d70b501375c2943
make[1]: *** [docker-run] Error 1
make[1]: Leaving directory `/var/tmp/patchew-tester-tmp-nyan6ktl/src'
make: *** [docker-run-test-quick@centos7] Error 2

real 14m3.450s
user 0m8.713s

The full log is available at
http://patchew.org/logs/[email protected]/testing.docker-quick@centos7/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]

Reviewed-by on v1 1/1
#2 lore raw
In reply to Max Reitz
Quoted 10 lines · Max Reitz

Some iotests leave behind some external data file when run for qcow2 with -o data_file. Fix that.

---
  tests/qemu-iotests/085 | 1 +
  tests/qemu-iotests/087 | 6 ++++++
  tests/qemu-iotests/279 | 2 +-
  3 files changed, 8 insertions(+), 1 deletion(-)

I'd LOVE for someone to take on a GSOC project to finish the work Jeff Cody once proposed on having iotests run each test in its own dedicated directory, such that files are left behind on failure for easy investigation, and cleanup is a snap of just deleting that directory on success.

But until then, adding manual cleanup where we missed it is correct.

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org
author
#3 lore raw
In reply to Max Reitz
Quoted 9 lines · Max Reitz

Some iotests leave behind some external data file when run for qcow2 with -o data_file. Fix that.

---
 tests/qemu-iotests/085 | 1 +
 tests/qemu-iotests/087 | 6 ++++++
 tests/qemu-iotests/279 | 2 +-
 3 files changed, 8 insertions(+), 1 deletion(-)

Thanks for the review, applied to my block branch.

Max