[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v1 14/26] tests/vm: python3 fixes
From: |
Alex Bennée |
Subject: |
[Qemu-devel] [PATCH v1 14/26] tests/vm: python3 fixes |
Date: |
Thu, 30 May 2019 11:15:51 +0100 |
From: Gerd Hoffmann <address@hidden>
Add proper unicode handling when processing strings.
Also need to explicitly say we want int not float.
Signed-off-by: Gerd Hoffmann <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Tested-by: Philippe Mathieu-Daudé <address@hidden>
Message-Id: <address@hidden>
[AJB: fix conflicts with tests/vm: Port basevm to Python 3]
Signed-off-by: Alex Bennée <address@hidden>
---
tests/vm/basevm.py | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py
index 083befce9f5..4847549592d 100755
--- a/tests/vm/basevm.py
+++ b/tests/vm/basevm.py
@@ -73,7 +73,7 @@ class BaseVM(object):
"-vnc", "127.0.0.1:0,to=20",
"-serial", "file:%s" % os.path.join(self._tmpdir, "serial.out")]
if vcpus and vcpus > 1:
- self._args += ["-smp", str(vcpus)]
+ self._args += ["-smp", "%d" % vcpus]
if kvm_available(self.arch):
self._args += ["-enable-kvm"]
else:
@@ -85,12 +85,13 @@ class BaseVM(object):
if not sha256sum:
return True
checksum = subprocess.check_output(["sha256sum", fname]).split()[0]
- return sha256sum == checksum.decode()
+ return sha256sum == checksum.decode("utf-8")
cache_dir = os.path.expanduser("~/.cache/qemu-vm/download")
if not os.path.exists(cache_dir):
os.makedirs(cache_dir)
- fname = os.path.join(cache_dir, hashlib.sha1(url.encode()).hexdigest())
+ fname = os.path.join(cache_dir,
+ hashlib.sha1(url.encode("utf-8")).hexdigest())
if os.path.exists(fname) and check_sha256sum(fname):
return fname
logging.debug("Downloading %s to %s...", url, fname)
@@ -134,7 +135,7 @@ class BaseVM(object):
raise NotImplementedError
def add_source_dir(self, src_dir):
- name = "data-" + hashlib.sha1(src_dir.encode()).hexdigest()[:5]
+ name = "data-" + hashlib.sha1(src_dir.encode("utf-8")).hexdigest()[:5]
tarfile = os.path.join(self._tmpdir, name + ".tar")
logging.debug("Creating archive %s for src_dir dir: %s", tarfile,
src_dir)
subprocess.check_call(["./scripts/archive-source.sh", tarfile],
@@ -256,7 +257,7 @@ def main(vmcls):
vm.add_source_dir(args.build_qemu)
cmd = [vm.BUILD_SCRIPT.format(
configure_opts = " ".join(argv),
- jobs=args.jobs,
+ jobs=int(args.jobs),
target=args.build_target,
verbose = "V=1" if args.verbose else "")]
else:
--
2.20.1
- Re: [Qemu-devel] [PATCH v1 12/26] tests/vm: Add missing variables on help, (continued)
- [Qemu-devel] [PATCH v1 13/26] scripts: use git archive in archive-source, Alex Bennée, 2019/05/30
- [Qemu-devel] [PATCH v1 11/26] tests/vm: Fix build-centos docker-based tests run, Alex Bennée, 2019/05/30
- [Qemu-devel] [PATCH v1 18/26] tests/vm: proper guest shutdown, Alex Bennée, 2019/05/30
- [Qemu-devel] [PATCH v1 25/26] tests/vm: fedora autoinstall, using serial console, Alex Bennée, 2019/05/30
- [Qemu-devel] [PATCH v1 16/26] tests/vm: use ssh with pty unconditionally, Alex Bennée, 2019/05/30
- [Qemu-devel] [PATCH v1 15/26] tests/vm: send proxy environment variables over ssh, Alex Bennée, 2019/05/30
- [Qemu-devel] [PATCH v1 26/26] tests/vm: ubuntu.i386: apt proxy setup, Alex Bennée, 2019/05/30
- [Qemu-devel] [PATCH v1 24/26] tests/vm: netbsd autoinstall, using serial console, Alex Bennée, 2019/05/30
- [Qemu-devel] [PATCH v1 22/26] tests/vm: openbsd autoinstall, using serial console, Alex Bennée, 2019/05/30
- [Qemu-devel] [PATCH v1 14/26] tests/vm: python3 fixes,
Alex Bennée <=
- [Qemu-devel] [PATCH v1 19/26] tests/vm: add vm-boot-{ssh, serial}-<guest> targets, Alex Bennée, 2019/05/30
- [Qemu-devel] [PATCH v1 17/26] tests/vm: run test builds on snapshot, Alex Bennée, 2019/05/30
- [Qemu-devel] [PATCH v1 20/26] tests/vm: add DEBUG=1 to help text, Alex Bennée, 2019/05/30
- [Qemu-devel] [PATCH v1 21/26] tests/vm: serial console support helpers, Alex Bennée, 2019/05/30
- [Qemu-devel] [PATCH v1 23/26] tests/vm: freebsd autoinstall, using serial console, Alex Bennée, 2019/05/30