From patchwork Mon Apr 24 09:22:42 2023 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: 676560 Delivered-To: patch@linaro.org Received: by 2002:a5d:4a41:0:0:0:0:0 with SMTP id v1csp2054691wrs; Mon, 24 Apr 2023 02:24:54 -0700 (PDT) X-Google-Smtp-Source: AKy350Z9Uxn0ZNgTBqsASGgo0iTblgMsDnDHwFam7GxQ96ow1A5mcVMFpOD9j5poLh7kokOLM0oy X-Received: by 2002:a05:622a:2:b0:3ec:d85d:2afe with SMTP id x2-20020a05622a000200b003ecd85d2afemr23018172qtw.2.1682328293817; Mon, 24 Apr 2023 02:24:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682328293; cv=none; d=google.com; s=arc-20160816; b=vYQKmfH43+ushiGDr7hmLcF5rNiXoBNHoVATIaZBv0W4L5n5orkNmJX4DSl2lWDyg8 xxu3mnYvBDzuH/tV4bCka0OJEc9xtqhFdP3/R8LTg8xbcgUwCMDzh0PmO9Vnfj7mZmJ+ au/Z98+mk09VG3xevX4veQ4xa9relaPJU5pW+ThiWNnj8HwX9UluPZQPpHu21htG2sCB wWISIKkkVsX5fcrilLB1jAjmqPwv4olvo4LXh2a4OBxIxZBNtQIcQ9CjnNh7g7OXNUHP 0tBmrSxDBpfcv1eckipmds8HzhHzvDi6k85TCT+0HXz2cCb2Gnlg7ucrC9WgoZ40r6jt hIdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=k3CcGFsLs0X/rcB8rUBi4/9QeDN/ZK8Y25q/vvmaz/M=; b=vMoCZSJUq8+jKCGmIKbHfrVlAYi3Q2toNCFPf3UW7bslthTlnDI+k3O9ixQAp+1eys YE8pLvCOpkcul7A4VCzYqbexDyJ386A8FNzxlFwqyFBsZfjklckRURCHwcxstPIheqIZ bgjt2XT0dD/VWO14fVjubLOcFLukUZ8lWURUu41Qk4ggPNjePRAaZvE+2a2Cua422jIJ 21/fcQx6mcBQK3RgG96tWZ+6Ddqjz5jFl4f2+lCBCyOezSyJ2H6rz9GFt9gbJDjIu/cJ OoVWC0dQ7GjO9TdbQnatBGOkqfv3XIH+LAvfJAH0XPDycVuWpDbiQw3Wlb86c6VTxtgu veuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qQOz0BM1; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id k5-20020a05620a0b8500b0074ad9eb3b15si3966955qkh.325.2023.04.24.02.24.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 24 Apr 2023 02:24:53 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qQOz0BM1; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pqsQC-00087X-9P; Mon, 24 Apr 2023 05:23:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pqsPj-0007JY-TE for qemu-devel@nongnu.org; Mon, 24 Apr 2023 05:23:25 -0400 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pqsPR-0004oG-RS for qemu-devel@nongnu.org; Mon, 24 Apr 2023 05:23:14 -0400 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-2fddb442d47so3817410f8f.2 for ; Mon, 24 Apr 2023 02:22:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1682328176; x=1684920176; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=k3CcGFsLs0X/rcB8rUBi4/9QeDN/ZK8Y25q/vvmaz/M=; b=qQOz0BM1XgpF11Fnol50ZtckcMGGoW8Th7dj81dChwp5mcuZEIcf+pycRUOSdUlrOM iWQgJ6uNQX3P8gYYeWxzT6FEoNWIAUxeFkmAoq4ZXFe1dTzjsTTYXubo5VviaI4kzKf8 2G3BAzjapoYztFOsY63lyDlskGe67zrWezoTgs7RZWvItkZxLNdz/TLFjXwIVKK04nbX nwLunfjzYOsKOQznvpcy8ZJRXPVygCsxGjfdMmG/6VRyd4frvr5tOlf9ibq28OocKioy k2kgR2FX/arBGUjMg954Dt5yFotrYNNFeU4OVyFlbtWX1HVausFJFHWlu1XI+SG7cixG zeAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682328176; x=1684920176; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=k3CcGFsLs0X/rcB8rUBi4/9QeDN/ZK8Y25q/vvmaz/M=; b=KyrG3a2q+RsKTxEBOkxzu1Krfa5szDfizSdW83cf6NuKkJC935daM0fDsavY302Fpx eMx+t+dTC8M8B7ZGBWBVcILtNR8IJkMvbyYsv96EESN/qM+ZEbJ8+64vp9Y71gPPQ4+e jCd4H/B3/z2odHEKBGcYv8JcKno3XvpQ1o9v7OBH7zg48BLW5LMlFsYRqjmLIrE/rszf fLnKy9bFdA72Kq6o1HlsxUV4zGfJ32pAWMZ5qe5g9x6xEEe6TVdAJ76/ds4M8kRGhwas pkzOR8M1pnpzR0Sj9VT04mwE5eFq08r0vAeR6V+qik8pK9fdptj/UKPn/6JVRerypMfR rnMA== X-Gm-Message-State: AAQBX9ejYd3RklmGevG6yeCjpfNdYuHTCVQjsbxWHXtstAp/pKFqA3IT x0vzW5/sqJ6nKHm8GGX1Vj5gCQ== X-Received: by 2002:adf:eacc:0:b0:2f4:867e:efaa with SMTP id o12-20020adfeacc000000b002f4867eefaamr9543892wrn.53.1682328176281; Mon, 24 Apr 2023 02:22:56 -0700 (PDT) Received: from zen.linaroharston ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id r4-20020adfdc84000000b002f598008d50sm10341053wrj.34.2023.04.24.02.22.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Apr 2023 02:22:53 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id A848B1FFB8; Mon, 24 Apr 2023 10:22:50 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Wainer dos Santos Moschetta , Beraldo Leal , Thomas Huth , =?utf-8?q?Alex_Benn=C3=A9e?= , "Edgar E. Iglesias" , Paolo Bonzini , Aurelien Jarno , Peter Maydell , Juan Quintela , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Richard Henderson , Joel Stanley , Leif Lindholm , Markus Armbruster , Radoslaw Biernacki , Stefan Hajnoczi , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , John Snow , Andrew Jeffery , David Hildenbrand , Bastian Koppelmann , Max Filippov , qemu-s390x@nongnu.org, Cleber Rosa , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Dani?= =?utf-8?q?el_P=2E_Berrang=C3=A9?= , qemu-arm@nongnu.org, Eduardo Habkost , Ilya Leoshkevich , Kautuk Consul , Harsh Prateek Bora Subject: [PATCH 11/18] avocado_qemu/__init__.py: factor out the qemu-img finding Date: Mon, 24 Apr 2023 10:22:42 +0100 Message-Id: <20230424092249.58552-12-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230424092249.58552-1-alex.bennee@linaro.org> References: <20230424092249.58552-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42b; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Kautuk Consul Factor out the code that finds the qemu-img binary in the QemuSystemTest class and create a new get_qemu_img() function with it. This function will get called also from the new code in tuxrun_baselines.py avocado test-case. Signed-off-by: Kautuk Consul Reviewed-by: Harsh Prateek Bora Suggested-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20230421042322.684093-2-kconsul@linux.vnet.ibm.com> Signed-off-by: Alex Bennée --- tests/avocado/avocado_qemu/__init__.py | 27 +++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/tests/avocado/avocado_qemu/__init__.py b/tests/avocado/avocado_qemu/__init__.py index 6788837e1b..33090903f1 100644 --- a/tests/avocado/avocado_qemu/__init__.py +++ b/tests/avocado/avocado_qemu/__init__.py @@ -330,6 +330,19 @@ def _new_vm(self, name, *args): vm.add_args(*args) return vm + def get_qemu_img(self): + self.log.debug('Looking for and selecting a qemu-img binary') + + # If qemu-img has been built, use it, otherwise the system wide one + # will be used. + qemu_img = os.path.join(BUILD_DIR, 'qemu-img') + if not os.path.exists(qemu_img): + qemu_img = find_command('qemu-img', False) + if qemu_img is False: + self.cancel('Could not find "qemu-img"') + + return qemu_img + @property def vm(self): return self.get_vm(name='default') @@ -602,17 +615,9 @@ def set_up_existing_ssh_keys(self): return (ssh_public_key, ssh_private_key) def download_boot(self): - self.log.debug('Looking for and selecting a qemu-img binary to be ' - 'used to create the bootable snapshot image') - # If qemu-img has been built, use it, otherwise the system wide one - # will be used. If none is available, the test will cancel. - qemu_img = os.path.join(BUILD_DIR, 'qemu-img') - if not os.path.exists(qemu_img): - qemu_img = find_command('qemu-img', False) - if qemu_img is False: - self.cancel('Could not find "qemu-img", which is required to ' - 'create the bootable image') - vmimage.QEMU_IMG = qemu_img + # Set the qemu-img binary. + # If none is available, the test will cancel. + vmimage.QEMU_IMG = super().get_qemu_img() self.log.info('Downloading/preparing boot image') # Fedora 31 only provides ppc64le images