summaryrefslogtreecommitdiffstats
path: root/tests/vm
diff options
context:
space:
mode:
authorCleber Rosa2019-06-13 15:07:16 +0200
committerAlex Bennée2019-07-04 20:22:58 +0200
commitfcd2060e8efff83b7bdef04323077f87e011fdc4 (patch)
treeac49becc308c34193731a232a2868551d1654eb1 /tests/vm
parenttests/vm: avoid extra compressed image copy (diff)
downloadqemu-fcd2060e8efff83b7bdef04323077f87e011fdc4.tar.gz
qemu-fcd2060e8efff83b7bdef04323077f87e011fdc4.tar.xz
qemu-fcd2060e8efff83b7bdef04323077f87e011fdc4.zip
tests/vm: avoid image presence check and removal
Python's os.rename() will silently replace an existing file, so there's no need for the extra check and removal. Reference: https://docs.python.org/3/library/os.html#os.rename Signed-off-by: Cleber Rosa <crosa@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20190613130718.3763-3-crosa@redhat.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Diffstat (limited to 'tests/vm')
-rwxr-xr-xtests/vm/centos2
-rwxr-xr-xtests/vm/freebsd2
-rwxr-xr-xtests/vm/netbsd2
-rwxr-xr-xtests/vm/openbsd2
-rwxr-xr-xtests/vm/ubuntu.i3862
5 files changed, 0 insertions, 10 deletions
diff --git a/tests/vm/centos b/tests/vm/centos
index b00b46a8dc..53976f1c4c 100755
--- a/tests/vm/centos
+++ b/tests/vm/centos
@@ -77,8 +77,6 @@ class CentosVM(basevm.BaseVM):
self.ssh_root_check("systemctl enable docker")
self.ssh_root("poweroff")
self.wait()
- if os.path.exists(img):
- os.remove(img)
os.rename(img_tmp, img)
return 0
diff --git a/tests/vm/freebsd b/tests/vm/freebsd
index 5575c23a6f..091be1a065 100755
--- a/tests/vm/freebsd
+++ b/tests/vm/freebsd
@@ -36,8 +36,6 @@ class FreeBSDVM(basevm.BaseVM):
sys.stderr.write("Extracting the image...\n")
subprocess.check_call(["ln", "-f", cimg, img_tmp_xz])
subprocess.check_call(["xz", "--keep", "-dvf", img_tmp_xz])
- if os.path.exists(img):
- os.remove(img)
os.rename(img_tmp, img)
if __name__ == "__main__":
diff --git a/tests/vm/netbsd b/tests/vm/netbsd
index d0508f4465..ee9eaeab50 100755
--- a/tests/vm/netbsd
+++ b/tests/vm/netbsd
@@ -36,8 +36,6 @@ class NetBSDVM(basevm.BaseVM):
sys.stderr.write("Extracting the image...\n")
subprocess.check_call(["ln", "-f", cimg, img_tmp_xz])
subprocess.check_call(["xz", "--keep", "-dvf", img_tmp_xz])
- if os.path.exists(img):
- os.remove(img)
os.rename(img_tmp, img)
if __name__ == "__main__":
diff --git a/tests/vm/openbsd b/tests/vm/openbsd
index 87ec982489..28c7d25e29 100755
--- a/tests/vm/openbsd
+++ b/tests/vm/openbsd
@@ -38,8 +38,6 @@ class OpenBSDVM(basevm.BaseVM):
sys.stderr.write("Extracting the image...\n")
subprocess.check_call(["ln", "-f", cimg, img_tmp_xz])
subprocess.check_call(["xz", "--keep", "-dvf", img_tmp_xz])
- if os.path.exists(img):
- os.remove(img)
os.rename(img_tmp, img)
if __name__ == "__main__":
diff --git a/tests/vm/ubuntu.i386 b/tests/vm/ubuntu.i386
index a22d137e76..12867b193f 100755
--- a/tests/vm/ubuntu.i386
+++ b/tests/vm/ubuntu.i386
@@ -80,8 +80,6 @@ class UbuntuX86VM(basevm.BaseVM):
self.ssh_root_check("apt-get install -y libfdt-dev flex bison")
self.ssh_root("poweroff")
self.wait()
- if os.path.exists(img):
- os.remove(img)
os.rename(img_tmp, img)
return 0