From patchwork Fri Jun 7 09:05:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 166111 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp423206ili; Fri, 7 Jun 2019 02:59:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqzIHe/H2t68RAAK8rgMGaFuID2Emzi4ay1dQM1YJHO6rhwmXRKncASgGV4MAgmFtrLpOMS0 X-Received: by 2002:a0c:984a:: with SMTP id e10mr23847859qvd.57.1559901566104; Fri, 07 Jun 2019 02:59:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559901566; cv=none; d=google.com; s=arc-20160816; b=jwdELjIRuHmoqhJRMKgyuyZ/5LfsvQjnKpZblTxzDuCl94Ugv2UHeslPdkSr0eMZyL UgaAORxC+7kyMRjp7xuzhDNLmBueA7vvAD4MYZE2SvIPyD7utOpnrjlpfVUdiubRuQD2 FEgcP1QuPs6r0402qp3m/4aDKnmNLjzsd76HvXIsbfSdEixbt2ryHbwD7uD9R80o5sQE huSA5qBJRjcUINR4tWlTM76sBRYxMaJnwYTW4nhaCL12epnzTM+U6PThOC/j7MFXRfds xilSdbuRV/KLF/7yu68elLnlfUHtnyvs7a7AWan3aDyyTwFQ9r9K2l/+VIlL30wLyb1o fBEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=OhQM4ORyyZtDRv68wtOcg3+xNW2e7yr94fMwCAempbk=; b=BjbNPruabnE+GU8zCH0Pl2i5PqmIEJl5/7+4HEfWhw861TqfhDTYRia+7H6JvFIpu7 yy7w0+MlMMUpocfxfzPAmwkSpYT5xS1GPHMjI2Sg2F0Vh6e0UR90sgxzO2zZepW/uoo4 fHNc2ilsiwly3TNfToZXqe+CJs2v3vJS6eFCHN7hrGR/CFEJI3f4MU60Gx+xQKMbwz3b 6NOrYODUYJ11OzO6XTvqZ0bDvTgxaV3xQz914+F7p6w0BXaTtgC7uRstC0iwQVtIsNgg L0Q79jYpLClZJw4YBFo2JLYRRqN5FIdyFgxpfPfAdaK3LE56H2/U7miJcNjIl23XPT+l qoeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=UMd1PW81; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.47]) by mx.google.com with ESMTPS id z35si999536qth.335.2019.06.07.02.59.26 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 02:59:26 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 as permitted sender) client-ip=209.51.188.47; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=UMd1PW81; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:47706 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZBef-0007d9-K5 for patch@linaro.org; Fri, 07 Jun 2019 05:59:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42203) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZAvT-0002FZ-Ak for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:12:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZAvQ-0004z0-P7 for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:12:43 -0400 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:36633) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hZAvQ-0004py-Dg for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:12:40 -0400 Received: by mail-wm1-x342.google.com with SMTP id u8so1159985wmm.1 for ; Fri, 07 Jun 2019 02:12:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=OhQM4ORyyZtDRv68wtOcg3+xNW2e7yr94fMwCAempbk=; b=UMd1PW81Nj/a3TRplm/lgKp2JXzvoHSJjTtZll+c7phGlQWKWg5mwWODsWvI8+kmDL IVHMaE9yVLb3cnlOZODLztG3EBldrEDme4wzEaQ6RetdQB3ATrDs8fiX4V74uRIHRQE0 xeDWyFzu8EUy+3VUQlgO19fHB25paTllhKVcUW0B7Gy9n9RMHMb3ExApVE/s9Pi84O/k eiSEk/o+oYhx9bGWDgw6+7R9+FJ25/mbhs0umEPjRB/hJGn6/nZprASBU9zzmmgMLNxf nBrwr1IBKPLeXIGEs3irxDU/JD2l3JZcbEpl5BX4xsuWbHXHZJBlNhAL1asmwwq91I5f Cucg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OhQM4ORyyZtDRv68wtOcg3+xNW2e7yr94fMwCAempbk=; b=DA3MzbaPsaMlAFZI+5j6xevFJ5uOu90sRUB4KMdfZ74Tmy+0xDx6Ty2cVAwn9zcqPk A+6zgfeV3FZ3Cy1wkVFYHdqGw4kbym2dOP9cYhqr3HKG8/RicouxdobG6OBnaxy9NFCw 3mEN7NQDbBHkrzK/BtBnIjrBpeh621lChGMVZEo6W5qFtXDQb+Uee2utX9WlNqifOO5W I0JwRmuAilA5zGxAmR309UunXoVSj9bSl1Dqil+SzxXBW8AYkXbO+E1bdjq9HSR9hN7d qwK9cDOaga1SxNIfLD0xK/r/AZYVvjMTud+aNXTb22RvT1g7m2SXlgjvX4VpLMXdNdCr hh0Q== X-Gm-Message-State: APjAAAWqUVjfrEuv6SoyUvw2AKwLgkFBhjoHzm0lPR8k3xqhpDB4w5lX cMSVKh7PAEdYuh8JGj0Ro8LZAA== X-Received: by 2002:a1c:5412:: with SMTP id i18mr2798141wmb.11.1559898756112; Fri, 07 Jun 2019 02:12:36 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id k13sm1066954wmj.10.2019.06.07.02.12.30 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 07 Jun 2019 02:12:32 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 0E0901FF87; Fri, 7 Jun 2019 10:05:53 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 7 Jun 2019 10:05:12 +0100 Message-Id: <20190607090552.12434-14-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190607090552.12434-1-alex.bennee@linaro.org> References: <20190607090552.12434-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::342 Subject: [Qemu-devel] [PULL 13/52] tests/vm: python3 fixes X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org, Gerd Hoffmann Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Gerd Hoffmann Add proper unicode handling when processing strings. Also need to explicitly say we want int not float. Signed-off-by: Gerd Hoffmann Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé Message-Id: <20190520124716.30472-3-kraxel@redhat.com> [AJB: fix conflicts with tests/vm: Port basevm to Python 3] Signed-off-by: Alex Bennée -- 2.20.1 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: