[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 13/52] tests/vm: python3 fixes
From: |
Alex Bennée |
Subject: |
[Qemu-devel] [PULL 13/52] tests/vm: python3 fixes |
Date: |
Fri, 7 Jun 2019 10:05:12 +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>
diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py
index 083befce9f..4847549592 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
- [Qemu-devel] [PULL 32/52] cputlb: cast size_t to target_ulong before using for address masks, (continued)
- [Qemu-devel] [PULL 32/52] cputlb: cast size_t to target_ulong before using for address masks, Alex Bennée, 2019/06/07
- [Qemu-devel] [PULL 15/52] tests/vm: use ssh with pty unconditionally, Alex Bennée, 2019/06/07
- [Qemu-devel] [PULL 30/52] tests/tcg/x86_64: add a PVH crt.o for x86_64 system tests, Alex Bennée, 2019/06/07
- [Qemu-devel] [PULL 23/52] tests/vm: netbsd autoinstall, using serial console, Alex Bennée, 2019/06/07
- [Qemu-devel] [PULL 26/52] semihosting: split console_out into string and char versions, Alex Bennée, 2019/06/07
- [Qemu-devel] [PULL 45/52] gdbstub: Implement read all registers (g pkt) with new infra, Alex Bennée, 2019/06/07
- [Qemu-devel] [PULL 29/52] tests/tcg: clean-up VPATH/TESTS for i386, Alex Bennée, 2019/06/07
- [Qemu-devel] [PULL 40/52] gdbstub: Implement set register (P pkt) with new infra, Alex Bennée, 2019/06/07
- [Qemu-devel] [PULL 18/52] tests/vm: add vm-boot-{ssh, serial}-<guest> targets, Alex Bennée, 2019/06/07
- [Qemu-devel] [PULL 43/52] gdbstub: Implement read memory (m pkt) with new infra, Alex Bennée, 2019/06/07
- [Qemu-devel] [PULL 13/52] tests/vm: python3 fixes,
Alex Bennée <=
- [Qemu-devel] [PULL 25/52] tests/vm: ubuntu.i386: apt proxy setup, Alex Bennée, 2019/06/07
- [Qemu-devel] [PULL 27/52] cputlb: use uint64_t for interim values for unaligned load, Alex Bennée, 2019/06/07
- [Qemu-devel] [PULL 44/52] gdbstub: Implement write all registers (G pkt) with new infra, Alex Bennée, 2019/06/07
- [Qemu-devel] [PULL 50/52] gdbstub: Implement target halted (? pkt) with new infra, Alex Bennée, 2019/06/07
- [Qemu-devel] [PULL 28/52] tests/tcg: better detect truncated reads, Alex Bennée, 2019/06/07
- [Qemu-devel] [PULL 46/52] gdbstub: Implement file io (F pkt) with new infra, Alex Bennée, 2019/06/07
- [Qemu-devel] [PULL 33/52] gdbstub: Add infrastructure to parse cmd packets, Alex Bennée, 2019/06/07
- [Qemu-devel] [PULL 47/52] gdbstub: Implement step (s pkt) with new infra, Alex Bennée, 2019/06/07
- [Qemu-devel] [PULL 41/52] gdbstub: Implement get register (p pkt) with new infra, Alex Bennée, 2019/06/07
- [Qemu-devel] [PULL 35/52] gdbstub: Implement thread_alive (T pkt) with new infra, Alex Bennée, 2019/06/07