From patchwork Sat Jun 6 19:17:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukas Straub X-Patchwork-Id: 11591327 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 7E9A0913 for ; Sat, 6 Jun 2020 19:21:54 +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 54E4D2067B for ; Sat, 6 Jun 2020 19:21:54 +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="eZ2v6eR/" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 54E4D2067B 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]:37658 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jheO9-0006jq-CF for patchwork-qemu-devel@patchwork.kernel.org; Sat, 06 Jun 2020 15:21:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40764) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jheKy-0004VY-Sp for qemu-devel@nongnu.org; Sat, 06 Jun 2020 15:18:37 -0400 Received: from mout.web.de ([212.227.17.12]:40629) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jheKy-0005bY-0m for qemu-devel@nongnu.org; Sat, 06 Jun 2020 15:18:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=dbaedf251592; t=1591471078; bh=pt9EkwFNNdSEgpLYZHULMnvivuY+bmJWAt3j33lN1f4=; h=X-UI-Sender-Class:Date:From:To:Cc:Subject:In-Reply-To:References; b=eZ2v6eR/9uiUfkwXOhJkOs4fXeraBPUh8KJZW1pYbbsnlO2S8aki6u2pECTDVhKZC +zahAa9aZkDipPnYFIGmcjuZX7AAZY3cdfEouxoMQlUxUmk+0fYfR5ipmsZ8gmi3gw V3PCImcfDL2xX5EIMKh2S975l6V3IjDVlzP9lkgA= X-UI-Sender-Class: c548c8c5-30a9-4db5-a2e7-cb6cb037b8f9 Received: from luklap ([87.123.206.73]) by smtp.web.de (mrweb102 [213.165.67.124]) with ESMTPSA (Nemesis) id 0Mg7I1-1jMQYF2ITN-00NQvU; Sat, 06 Jun 2020 21:17:58 +0200 Date: Sat, 6 Jun 2020 21:17:57 +0200 From: Lukas Straub To: qemu-devel Subject: [PATCH v2 2/7] avocado_qemu: Introduce pick_qemu_util to pick qemu utility binaries Message-ID: <3bf59de49c6d97d457e9955efe401335cf28930a.1591456338.git.lukasstraub2@web.de> In-Reply-To: References: MIME-Version: 1.0 X-Provags-ID: V03:K1:5v9ACSDUWM+V0dvUq18Xd/bgtoXuTBUBeOwhR5VnaSK1bapmP7i U0MVaxTplKQDDUSZQUEErbhuznjFFG83fPFLdODFsZ+TjRR5jJx6eS/4H4D2orEz02MBmri 4rziNL96p97ITuzAAjl+S27I3wBBmBk3HSbFNNE4+qJINukaJF5vNJKDpvRsJl1mLIfbl97 xpQDeYTTivyM4kBpl9Zww== X-UI-Out-Filterresults: notjunk:1;V03:K0:EVNUZvtHjJ4=:CUjtx16pwyq4UEU+6HLuVE UCZJYmG2Hpd+bhEOm1Fo4QaHq5x4ayaEt/iCtlD23pZbVMlRfCTVGa+ns9id/CGDoGqvEbNrp 3/+0d4/RVxXJNpAVi05lpKcGwXRTEbeCI3usoSsLlZpocH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Cs8tFTuybxYq9YBp0f75GRnh5thHRCenHNshvX2kbrl28Lng9JHQhbsU/ ZY/DMae0CBlBrVJUv 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/06/06 15:18:34 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 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.001, RCVD_IN_MSPIKE_WL=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN 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 59e7b4f763..d0529dca6c 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 @@ -144,6 +145,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