From patchwork Thu Apr 27 15:45:03 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: 677531 Delivered-To: patch@linaro.org Received: by 2002:a5d:4a41:0:0:0:0:0 with SMTP id v1csp416557wrs; Thu, 27 Apr 2023 08:50:21 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4Qs1l8XPizgW8vkcjN7WUtUogA26531l57wsO2386Uidj9C6Cr/rDzX86g/G3GCkZsZnT4 X-Received: by 2002:a05:6214:c48:b0:5ef:8004:e0b0 with SMTP id r8-20020a0562140c4800b005ef8004e0b0mr2783014qvj.17.1682610620900; Thu, 27 Apr 2023 08:50:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682610620; cv=none; d=google.com; s=arc-20160816; b=dntUGwlYtNAqOPL+C7sz8KtvHWJKKlz2XaWxJ8c1JFsQazzhLHNS/FLKu4MxAndgBt QzFzVFDlRlxZMMQQkNQu1kXSbTIOXCENDctvce927+EfrPIwPbO8YJKZyBXi8cjHfJAI txcIXNhO/+VvIpmfPtdWotb0do5xzqO4KyTGVsouGO672nnR9LKbVhDKXfNRHU6GRda3 PAMOS3liwR5FIoIFcX0Qtpm6HMC0regGbgjCcngp3ZCb6UIuUJhYdY++lfMdnt/XTbSl a21HK/pPkAbWAxCw1PcioPc5vzXGEAu14Wlp6Pcbh8dXX7Or6YzQiGBU2mUJYAjsslF/ ir2Q== 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=BZ/8ey82+JXDwq7XVHlAwGozyCogXibvNckafjptj/k=; b=Wr2expjl3HJqLRCHBzgXfHzYFBM11iK5wbNr8CUeo8sF191+WM2WjR3+ntGOXnwxhY T1DRI1sqVUdhEEWKUHgaAtdkQkUtEP+l2RLIobt5zxyVketf8ee1TNVmxTy09lFF6dBZ rpCCFfPsilclMitWumwPr4o83aRxRre1y3+3wdHd8wpcBWvO39xFvtGn7ZGMechvoHlz PzJqE7hHywVdWSjHkHVZh5zVdlnsloc6vAsrWAHEftizM0oNp+RMq95ctoBr/SQRj5C/ bUKcuDGjkOeh21bY3GKewZVswSQhYbpFoO88UDTDkV9wS1s5WGzKngmDXD8hOrd65p5J RL4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PT587HoW; 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 u8-20020a05622a14c800b003e43016c09esi5622200qtx.52.2023.04.27.08.50.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 27 Apr 2023 08:50:20 -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=PT587HoW; 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 1ps3oh-0002RN-RB; Thu, 27 Apr 2023 11:45:55 -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 1ps3oA-0001rA-4f for qemu-devel@nongnu.org; Thu, 27 Apr 2023 11:45:22 -0400 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ps3o6-0004ls-RT for qemu-devel@nongnu.org; Thu, 27 Apr 2023 11:45:21 -0400 Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-2f4214b430aso5481352f8f.0 for ; Thu, 27 Apr 2023 08:45:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1682610317; x=1685202317; 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=BZ/8ey82+JXDwq7XVHlAwGozyCogXibvNckafjptj/k=; b=PT587HoWNj6m2phYFQqCQJuNsqTEndmVRQMMh6SH+wMlV3/8KCqV7FRcAP1uK8Md3v il8Y+SKmAtUQeuf0apcn8XHrv3SVw6Cs/dQXV7AdDrk4pNCQLMu8bJYcg9x9bOhX5RjV SuwU3xYfBbNflc8A3gCbQw/MZ6KxD8AUqgd0OXugyZBlfupwYabfLbASH7TpaUihzlLe s3gKAr2HnBNdeucBvVDbwhqw/GlLBO8q4wm84F5vg3YMYBhgxJKVuwb+ok/shHxlCv2P oqImzt9ihs/toj3oqOPPvKm/10nq0BI5Sm0CsbRghrIS4IxYU/FwwAn4TjVOnWMqQNez g+jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682610317; x=1685202317; 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=BZ/8ey82+JXDwq7XVHlAwGozyCogXibvNckafjptj/k=; b=BQjXhwg6GkkBCE7wsWL56sTGReJ5nL6Cxz4f/NTYlPUNBYBuHFIZCrSuflnufoFznt tmzYgDWX1ODW+qKOKlg0uQg1yWMG6wSXjekcQOH9SqaUMGUf7TYMmSCbcDeRcyfxa5fj 7sJg9RvL6KszoLN47kTqhplnyJece6c+wSY9JXaXwGf9QFxh5zHY5h6ftfottdlm5as0 Qz8JHDawtpTFCw1N+IpTCFKuAYYz4PHWxqo3MBunhHpTB4jTuZkYagbm2BsLy6aKLbkb 3oaCh5gO2Aop6k6DM++BQAINy7i6m50a0gfzL6mLsCOCftczySq9JOEOMPeHXJLE3f78 60EQ== X-Gm-Message-State: AC+VfDzjIRa8sSvB3exEgJ2wlEUytY2I/hDQJjJ7yBY6CLifxv+HUbF9 U4gTX0OkZXcqdQAD3M3jtEa4lA== X-Received: by 2002:a5d:460f:0:b0:2d8:47c7:7b50 with SMTP id t15-20020a5d460f000000b002d847c77b50mr1613453wrq.1.1682610317039; Thu, 27 Apr 2023 08:45:17 -0700 (PDT) Received: from zen.linaroharston ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id v12-20020adfe28c000000b0030497b3224bsm5707007wri.64.2023.04.27.08.45.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Apr 2023 08:45:16 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id C15A81FFB7; Thu, 27 Apr 2023 16:45:11 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, Kautuk Consul , Harsh Prateek Bora , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Alex?= =?utf-8?q?_Benn=C3=A9e?= , Cleber Rosa , Wainer dos Santos Moschetta , Beraldo Leal Subject: [PULL 11/18] avocado_qemu/__init__.py: factor out the qemu-img finding Date: Thu, 27 Apr 2023 16:45:03 +0100 Message-Id: <20230427154510.1791273-12-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230427154510.1791273-1-alex.bennee@linaro.org> References: <20230427154510.1791273-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::435; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x435.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=ham 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 Message-Id: <20230424092249.58552-12-alex.bennee@linaro.org> 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