From patchwork Tue Aug 4 10:46:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukas Straub X-Patchwork-Id: 11700223 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D2AE113B1 for ; Tue, 4 Aug 2020 10:54:37 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C365C206D7 for ; Tue, 4 Aug 2020 10:54:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=web.de header.i=@web.de header.b="lAJ2Und+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C365C206D7 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=web.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:36622 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k2uaX-0006Gw-2d for patchwork-qemu-devel@patchwork.kernel.org; Tue, 04 Aug 2020 06:54:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43620) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k2uTT-0000pZ-Lw for qemu-devel@nongnu.org; Tue, 04 Aug 2020 06:47:15 -0400 Received: from mout.web.de ([212.227.17.12]:44291) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k2uTR-0003Zf-U4 for qemu-devel@nongnu.org; Tue, 04 Aug 2020 06:47:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=dbaedf251592; t=1596538009; bh=qv/5xayjAYXqpeYnwgPYY0OgvSh+N7XscqU3e7q3x5c=; h=X-UI-Sender-Class:Date:From:To:Cc:Subject:In-Reply-To:References; b=lAJ2Und+grdyffvxSbOKGq4imtyCr6byGkY+dkmckGNF4IQPh/P+Im+19zC52T67r veGF0tckBOMn9AG8oedRT3mlXJ17+ADgsPldV97u+ch+h6ixlCoZ4/AjrMLZjOnfjz EoBOk7XHhlTTbKoxH/KDcVIY2/dsHgzjqMjEKbgI= X-UI-Sender-Class: c548c8c5-30a9-4db5-a2e7-cb6cb037b8f9 Received: from luklap ([89.247.255.220]) by smtp.web.de (mrweb103 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MgOCo-1kQbkd0sdC-00Nk32; Tue, 04 Aug 2020 12:46:49 +0200 Date: Tue, 4 Aug 2020 12:46:48 +0200 From: Lukas Straub To: qemu-devel Subject: [PATCH v3 2/7] avocado_qemu: Introduce pick_qemu_util to pick qemu utility binaries Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Provags-ID: V03:K1:v+8x6PHYu/0EInerpsZm7Y9E779xUOy0Ra3svE6DvdeH1mfOE4d GnMcnp5rn5CXXsFv1giuk/HqdXkQ5Tij1MxSTwaVwZ97VnQe8l4Q2dl3E3I1s+rOvB7knTb j3ScdzWCcBwgCLobuDlfiNa3lMHi+ge3s2df6hOOkT/GIFcxrQE2NNc9ui7eUrCjHCRDZsO AQlCcD+8ZfvPojCldBdpQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:+cLejGJF30c=:XDYbSLDZixBctgzeF2i9ty 38vSjGf6Dg1iAG5L5jrfrhpWD6AvdqxPNO/F4bezq21l5HqNkawEzbjODDFX+PHCGPl3FwJQG +mw5I49BcXwuZnX3EGWUK6EJpIz04+JoJUEvvK1DvthbpWXtlVZ8XUEAviseHNRwgjmHPILXh uCH66DxcFqv/akE54YZ4N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MBJoMPcy4qtO Vb1BfNXE+TUWltQidqWwc8aSuxpoGl+6QzZJWtw== Received-SPF: pass client-ip=212.227.17.12; envelope-from=lukasstraub2@web.de; helo=mout.web.de X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/04 06:47:07 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: Kevin Wolf , Alberto Garcia , "Dr. David Alan Gilbert" , Wainer dos Santos Moschetta , Max Reitz , Zhang Chen , Cleber Rosa , Philippe =?utf-8?q?Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" This introduces a generic function to pick qemu utility binaries from the build dir, system or via test parameter. Signed-off-by: Lukas Straub --- tests/acceptance/avocado_qemu/__init__.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) -- 2.20.1 diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py index 77d1c1d9ff..fbc47ccb3d 100644 --- a/tests/acceptance/avocado_qemu/__init__.py +++ b/tests/acceptance/avocado_qemu/__init__.py @@ -15,6 +15,7 @@ import uuid import tempfile import avocado +from avocado.utils.path import find_command #: The QEMU build root directory. It may also be the source directory #: if building from the source dir, but it's safer to use BUILD_DIR for @@ -147,6 +148,20 @@ def exec_command_and_wait_for_pattern(test, command, _console_interaction(test, success_message, failure_message, command + '\r') class Test(avocado.Test): + def pick_qemu_util(self, util): + default = os.path.join(BUILD_DIR, util) + if not os.path.exists(default): + default = find_command(default, False) + if not default: + default = None + + ret = self.params.get(util, default=default) + + if ret is None: + self.cancel("Could not find \"%s\"" % util) + + return ret + def _get_unique_tag_val(self, tag_name): """ Gets a tag value, if unique for a key