summary refs log tree commit diff stats
path: root/tests/qemu-iotests/iotests.py
diff options
context:
space:
mode:
authorNir Soffer <nirsof@gmail.com>2020-08-29 02:21:48 +0300
committerMax Reitz <mreitz@redhat.com>2020-09-15 11:05:12 +0200
commita7971702f473d0461b527bfda476d164d3f2feff (patch)
treecfb00cf7dc8c8a8559193c78f70be36dc6482d8c /tests/qemu-iotests/iotests.py
parent2d2c73d0e3d504a61f868e46e6abd5643f38091b (diff)
downloadfocaccia-qemu-a7971702f473d0461b527bfda476d164d3f2feff.tar.gz
focaccia-qemu-a7971702f473d0461b527bfda476d164d3f2feff.zip
qemu-iotests: Fix FilePaths cleanup
If os.remove() fails to remove one of the paths, for example if the file
was removed by the test, the cleanup loop would exit silently, without
removing the rest of the files.

Fixes: de263986b5dc
Signed-off-by: Nir Soffer <nsoffer@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Message-Id: <20200828232152.205833-2-nsoffer@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'tests/qemu-iotests/iotests.py')
-rw-r--r--tests/qemu-iotests/iotests.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
index 64ccaf9061..36814daf84 100644
--- a/tests/qemu-iotests/iotests.py
+++ b/tests/qemu-iotests/iotests.py
@@ -468,11 +468,11 @@ class FilePaths:
         return self.paths
 
     def __exit__(self, exc_type, exc_val, exc_tb):
-        try:
-            for path in self.paths:
+        for path in self.paths:
+            try:
                 os.remove(path)
-        except OSError:
-            pass
+            except OSError:
+                pass
         return False
 
 class FilePath(FilePaths):