From patchwork Tue Nov 2 08:42:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1549519 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=Soycesse; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4Hk3Mh5Qkgz9sVc for ; Tue, 2 Nov 2021 19:43:27 +1100 (AEDT) Received: from localhost ([::1]:37512 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mhpO8-0006KR-8Q for incoming@patchwork.ozlabs.org; Tue, 02 Nov 2021 04:43:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60172) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mhpNT-0006HD-84 for qemu-devel@nongnu.org; Tue, 02 Nov 2021 04:42:43 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]:41765) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mhpNQ-0007Vc-Sq for qemu-devel@nongnu.org; Tue, 02 Nov 2021 04:42:42 -0400 Received: by mail-wm1-x335.google.com with SMTP id f7-20020a1c1f07000000b0032ee11917ceso1509798wmf.0 for ; Tue, 02 Nov 2021 01:42:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Im+Cf99LFyjhzp+sO6pePzS2IqjUlJiZTNDKG3hFU1M=; b=Soycesse4dQU9Tlkek37qRL7lCYw9L/at5sFFSlTx96vDIfktGh+SLQmAlh4yN3Ry0 MUPTK+HcDNUelOFXfMS9oO2oLBhyl4ODwmE6CDGSkSZH5MLru9GbuMJOWfgvKBSkEpcR ELwBsNZeChQFmfUADzuRSCJQG3s1w8GSbM/xM6s5mYxVrcqF/3vNaUk6e20cBDsumjLY +DoeJHuk3RUoOJypVBxPxwebcwooWYUjYj42Wh1EIdMbajsTBvQHOYezuchrmuVK8VuV /x3yW/10sZPpHeRpdFMM+texjlIi36tInyA7mGz/XQdMdsKvKcSiKqA8O1vQoND8Zz8o wqNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=Im+Cf99LFyjhzp+sO6pePzS2IqjUlJiZTNDKG3hFU1M=; b=XhL8h2sQZ+qcdP9/N8++Sq3CavBkUkOiWeLwiLfD21fTag/hu2YuHg0rXTfcz0Ihrm NWhpd9zXSe8Os/RUbbkDNJpUOqKLuO/DUEOmJ3Cl6D1rKoXznvrqbfJo8oDXye3d3Hrd zusmH6rQh7KPRJsBv2BWB0Os1e8Nu0rKQ4ZoSFzYzJzJQGBiUKSLrEmA+0UxQJpoXZuu oKugd/96GHH3MKJweEwWJfKs1KCeseItkotxV+CQteLG4qQz/nnt9oXNOWSRmDVKroE7 XI+K4J5D9z30PqXDPbj4Rq6KBg1OJNBnzsukM80Ro6iDSD540KaiGfVvpJ8HVqyk1CdF QIFA== X-Gm-Message-State: AOAM532pW+be3N55sB0WzIZBqmGlDqpViRFyBoapx+qLDTg95m1e2IcG Ud3XqQLAZ4es/fsEIa3UAAtHDb5HwC4= X-Google-Smtp-Source: ABdhPJyuNll1Lk840v5vN/twTkiFye5FBM4Yye2mLyLdwyYNFvrMH9JPXgArysXapraLV0zBJymKFg== X-Received: by 2002:a1c:ac86:: with SMTP id v128mr5216223wme.3.1635842559438; Tue, 02 Nov 2021 01:42:39 -0700 (PDT) Received: from x1w.. (62.red-83-57-168.dynamicip.rima-tde.net. [83.57.168.62]) by smtp.gmail.com with ESMTPSA id u15sm1932391wmq.12.2021.11.02.01.42.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Nov 2021 01:42:38 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v5 1/6] tests/acceptance: Extract QemuBaseTest from Test Date: Tue, 2 Nov 2021 09:42:27 +0100 Message-Id: <20211102084232.2965062-2-f4bug@amsat.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211102084232.2965062-1-f4bug@amsat.org> References: <20211102084232.2965062-1-f4bug@amsat.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-x335.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.248, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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: , Cc: Willian Rampazzo , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Wainer dos Santos Moschetta , Warner Losh , Cleber Rosa Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" The Avocado Test::fetch_asset() is handy to download artifacts before running tests. The current class is named Test but only tests system emulation. As we want to test user emulation, refactor the common code as QemuBaseTest. Reviewed-by: Willian Rampazzo Signed-off-by: Philippe Mathieu-Daudé --- v5: Use PEP3135 (Willian) --- tests/acceptance/avocado_qemu/__init__.py | 72 +++++++++++++---------- 1 file changed, 41 insertions(+), 31 deletions(-) diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py index 1841053e2c1..1ed381f5037 100644 --- a/tests/acceptance/avocado_qemu/__init__.py +++ b/tests/acceptance/avocado_qemu/__init__.py @@ -169,7 +169,7 @@ def exec_command_and_wait_for_pattern(test, command, """ _console_interaction(test, success_message, failure_message, command + '\r') -class Test(avocado.Test): +class QemuBaseTest(avocado.Test): def _get_unique_tag_val(self, tag_name): """ Gets a tag value, if unique for a key @@ -179,6 +179,46 @@ def _get_unique_tag_val(self, tag_name): return vals.pop() return None + def setUp(self): + self.arch = self.params.get('arch', + default=self._get_unique_tag_val('arch')) + + self.cpu = self.params.get('cpu', + default=self._get_unique_tag_val('cpu')) + + default_qemu_bin = pick_default_qemu_bin(arch=self.arch) + self.qemu_bin = self.params.get('qemu_bin', + default=default_qemu_bin) + if self.qemu_bin is None: + self.cancel("No QEMU binary defined or found in the build tree") + + def fetch_asset(self, name, + asset_hash=None, algorithm=None, + locations=None, expire=None, + find_only=False, cancel_on_missing=True): + return super().fetch_asset(name, + asset_hash=asset_hash, + algorithm=algorithm, + locations=locations, + expire=expire, + find_only=find_only, + cancel_on_missing=cancel_on_missing) + + +class Test(QemuBaseTest): + """Facilitates system emulation tests. + + TODO: Rename this class as `QemuSystemTest`. + """ + + def setUp(self): + self._vms = {} + + super().setUp() + + self.machine = self.params.get('machine', + default=self._get_unique_tag_val('machine')) + def require_accelerator(self, accelerator): """ Requires an accelerator to be available for the test to continue @@ -201,24 +241,6 @@ def require_accelerator(self, accelerator): self.cancel("%s accelerator does not seem to be " "available" % accelerator) - def setUp(self): - self._vms = {} - - self.arch = self.params.get('arch', - default=self._get_unique_tag_val('arch')) - - self.cpu = self.params.get('cpu', - default=self._get_unique_tag_val('cpu')) - - self.machine = self.params.get('machine', - default=self._get_unique_tag_val('machine')) - - default_qemu_bin = pick_default_qemu_bin(arch=self.arch) - self.qemu_bin = self.params.get('qemu_bin', - default=default_qemu_bin) - if self.qemu_bin is None: - self.cancel("No QEMU binary defined or found in the build tree") - def _new_vm(self, name, *args): self._sd = tempfile.TemporaryDirectory(prefix="avo_qemu_sock_") vm = QEMUMachine(self.qemu_bin, base_temp_dir=self.workdir, @@ -272,18 +294,6 @@ def tearDown(self): self._sd = None super().tearDown() - def fetch_asset(self, name, - asset_hash=None, algorithm=None, - locations=None, expire=None, - find_only=False, cancel_on_missing=True): - return super().fetch_asset(name, - asset_hash=asset_hash, - algorithm=algorithm, - locations=locations, - expire=expire, - find_only=find_only, - cancel_on_missing=cancel_on_missing) - class LinuxSSHMixIn: """Contains utility methods for interacting with a guest via SSH.""" From patchwork Tue Nov 2 08:42:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1549520 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=ZSRohisD; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4Hk3Mk2lrvz9sXS for ; Tue, 2 Nov 2021 19:43:30 +1100 (AEDT) Received: from localhost ([::1]:37742 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mhpOB-0006U8-UU for incoming@patchwork.ozlabs.org; Tue, 02 Nov 2021 04:43:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60214) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mhpNX-0006QC-Cx for qemu-devel@nongnu.org; Tue, 02 Nov 2021 04:42:47 -0400 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]:56248) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mhpNV-0007Wy-Hp for qemu-devel@nongnu.org; Tue, 02 Nov 2021 04:42:47 -0400 Received: by mail-wm1-x336.google.com with SMTP id v127so14910903wme.5 for ; Tue, 02 Nov 2021 01:42:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=EKG0tKklLgRk4YA9OrX5SnwD2Q874lcpxjeqTTiQFYw=; b=ZSRohisD6mlmpfGEQ8DIS9r6VlKaamZLe7J+qarvCpEgt8gsJoj8VDTL2JPojnm/du p3RcRsUJL/2SZ0Q27EzGdHFpZAqe3BFyIlU9A+3GwALf6zwCKW3W2fbi/Ynx2WuVsGZT 018xKFzGgxU/+RS70LjSLYbngdm57KRTqzHcE1XY7+e1JVEOZNgj1xcliaqNYpra87zZ 75upDlVcDcg4ZgXYmFcdqZ5ItbuWE4Fwufg1PytgS+XIBSgXeFSn3nmgYo2cC9MG7g3d GsFIxT6AMAuO7Tx4dnkt/hLfGsd+VjcnBv82haxeHFNvkG1oZBd+KpzL8zfCNzTRX6Pk BxoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=EKG0tKklLgRk4YA9OrX5SnwD2Q874lcpxjeqTTiQFYw=; b=jMjhqab+l1EVyEMyF1zbmfPjeZA7rG802xbxhZ2wHwWb1I2OWXLchR5ueGWvSr/IUm AwS0fgJqtXgXmDV4PQ2srNCiFgnkvh2ZeWV3OogI5oV/lgJkgBGRsSgoRdJScUmznOh2 N6wgSAoOtibHqJtM68fz9di9pkmzInr/gxIYnETRqDDq57wfK0z45o4+ulbNvBciiE5A KgIsJ8ZBsKC1UXcUXZg544DOf5xzQo9eYzjmx+UaiPkxKEVlGsHKRd7NJNEC8nwRIcbb s686R4skOSHNDRXTTKH/XTv4A/X9kLowxNluzB2SE20ZfL+3sh++kReiYaIGc3a7Eq7F Buvw== X-Gm-Message-State: AOAM530UgzUnRO/2IdYd/YFo3ONLo1c020Cyvib3MzSqpDfqkDoT9OuH fkBNL1FaoWjAah2JHyz0JBnCvHXO240= X-Google-Smtp-Source: ABdhPJyXOLftb+nJLPZ721ch6mwG+e6e6aYy78HfficcvGnenbAQ407KzDOqgxr+NWHWcQ3uFnuytQ== X-Received: by 2002:a1c:c90f:: with SMTP id f15mr5351047wmb.78.1635842564091; Tue, 02 Nov 2021 01:42:44 -0700 (PDT) Received: from x1w.. (62.red-83-57-168.dynamicip.rima-tde.net. [83.57.168.62]) by smtp.gmail.com with ESMTPSA id h22sm36426wmq.14.2021.11.02.01.42.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Nov 2021 01:42:43 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v5 2/6] tests/acceptance: Make pick_default_qemu_bin() more generic Date: Tue, 2 Nov 2021 09:42:28 +0100 Message-Id: <20211102084232.2965062-3-f4bug@amsat.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211102084232.2965062-1-f4bug@amsat.org> References: <20211102084232.2965062-1-f4bug@amsat.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-x336.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.248, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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: , Cc: Willian Rampazzo , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Wainer dos Santos Moschetta , Warner Losh , Cleber Rosa Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Make pick_default_qemu_bin() generic to find qemu-system or qemu-user binaries. Reviewed-by: Willian Rampazzo Signed-off-by: Philippe Mathieu-Daudé --- v5: Use PEP3135 --- tests/acceptance/avocado_qemu/__init__.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py index 1ed381f5037..9b2ea3b248a 100644 --- a/tests/acceptance/avocado_qemu/__init__.py +++ b/tests/acceptance/avocado_qemu/__init__.py @@ -45,7 +45,7 @@ def is_readable_executable_file(path): return os.path.isfile(path) and os.access(path, os.R_OK | os.X_OK) -def pick_default_qemu_bin(arch=None): +def pick_default_qemu_bin(bin_prefix='qemu-system-', arch=None): """ Picks the path of a QEMU binary, starting either in the current working directory or in the source tree root directory. @@ -64,7 +64,7 @@ def pick_default_qemu_bin(arch=None): # qemu binary path does not match arch for powerpc, handle it if 'ppc64le' in arch: arch = 'ppc64' - qemu_bin_relative_path = "./qemu-system-%s" % arch + qemu_bin_relative_path = os.path.join(".", bin_prefix + arch) if is_readable_executable_file(qemu_bin_relative_path): return qemu_bin_relative_path @@ -179,14 +179,14 @@ def _get_unique_tag_val(self, tag_name): return vals.pop() return None - def setUp(self): + def setUp(self, bin_prefix): self.arch = self.params.get('arch', default=self._get_unique_tag_val('arch')) self.cpu = self.params.get('cpu', default=self._get_unique_tag_val('cpu')) - default_qemu_bin = pick_default_qemu_bin(arch=self.arch) + default_qemu_bin = pick_default_qemu_bin(bin_prefix, arch=self.arch) self.qemu_bin = self.params.get('qemu_bin', default=default_qemu_bin) if self.qemu_bin is None: @@ -214,7 +214,7 @@ class Test(QemuBaseTest): def setUp(self): self._vms = {} - super().setUp() + super().setUp('qemu-system-') self.machine = self.params.get('machine', default=self._get_unique_tag_val('machine')) From patchwork Tue Nov 2 08:42:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1549526 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=KK2WQ/Ws; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4Hk3Qt1TMsz9sVc for ; Tue, 2 Nov 2021 19:46:13 +1100 (AEDT) Received: from localhost ([::1]:47526 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mhpQp-0004bf-NN for incoming@patchwork.ozlabs.org; Tue, 02 Nov 2021 04:46:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60242) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mhpNc-0006cf-Hc for qemu-devel@nongnu.org; Tue, 02 Nov 2021 04:42:52 -0400 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]:36819) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mhpNa-0007YC-Mp for qemu-devel@nongnu.org; Tue, 02 Nov 2021 04:42:52 -0400 Received: by mail-wm1-x32a.google.com with SMTP id z11-20020a1c7e0b000000b0030db7b70b6bso1190726wmc.1 for ; Tue, 02 Nov 2021 01:42:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Uvn3v2nfcIU2IgJuyBks/Pc2wix5ff6QgJODlQYTPKo=; b=KK2WQ/WsM2D1X3nNs/srpk1H/OWHNnvAVoq8u5KnJuM9DF6fTSaP5lnV9ByksDRn/C nO/q2zuJWKa1a5po1hBgA+p9VwrBtaVno7c1m6tAunhLeuS/7ova9ftQ0cY2J6tnalS8 2fMh/thQ3zQXzDYVl+l+2pUymibC2CZmBfc7i/MtwOYTXkypUk2TDiApkhyhFf6pjTpU nH99Ta6wtzoqSQmbF9BXLGwgvzNUPnD+bFgGeQ6feGCoDJbsb9RK8c2ep1/oBRNBezz9 I2J7Gwhyw4uPOTSYmuKYUehIooObDSoWH+dMcpXKXRgcRCsZpgAqm4JVwK3EL6FBYi2S aw6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=Uvn3v2nfcIU2IgJuyBks/Pc2wix5ff6QgJODlQYTPKo=; b=iJim/+UBW+Cc4ay9IMs2nCVOT+LhcanGgZK6+p6SZkPiKhSYM3KmJStKY1BIcVEGWY KwX0CH21Ni37Vi0H/hjRpbCMIvNyRpj/WlruLLXFaazmHFO0IMQ4kHnDxTbR6MUluhmo Q/s2sCJzRoMG746zYSkt6BnxCrlHkgHtml3/zYv8bDtjc8upT8mB1/sW8qOEfit0bPQo +MXkR22ZxcMXRciG7REXqo9CW/JgQUH6Pczx7CqFiu0Nwb+Jw6TQkFrYxTK0lHhgatej WI2wd+i4U7cOt0csGyCtATogmFYTWdbgyBsbbwBDwD35IPTGSBp2isEIoHNbFgPxnMHg TwFA== X-Gm-Message-State: AOAM531vM7LuPQ68jAkaA0BUMsPV/1vl5AVnjnZRvxs6lBnNYWbByWHQ CK6pqW5ks/biBKi+Jwnrw+hBXrrFqsw= X-Google-Smtp-Source: ABdhPJyDl7tPDpqZZ25sRVjNzAU5465nweEN/DRYY3ihABc2forb9D0mnPHZ2834uACzeg7cCkmidQ== X-Received: by 2002:a7b:cbd1:: with SMTP id n17mr5284354wmi.145.1635842568958; Tue, 02 Nov 2021 01:42:48 -0700 (PDT) Received: from x1w.. (62.red-83-57-168.dynamicip.rima-tde.net. [83.57.168.62]) by smtp.gmail.com with ESMTPSA id f3sm1735550wmb.12.2021.11.02.01.42.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Nov 2021 01:42:48 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v5 3/6] tests/acceptance: Introduce QemuUserTest base class Date: Tue, 2 Nov 2021 09:42:29 +0100 Message-Id: <20211102084232.2965062-4-f4bug@amsat.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211102084232.2965062-1-f4bug@amsat.org> References: <20211102084232.2965062-1-f4bug@amsat.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-x32a.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.248, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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: , Cc: Willian Rampazzo , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Wainer dos Santos Moschetta , Warner Losh , Cleber Rosa Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Similarly to the 'System' Test base class with methods for testing system emulation, the QemuUserTest class contains methods useful to test user-mode emulation. Reviewed-by: Wainer dos Santos Moschetta Reviewed-by: Willian Rampazzo Signed-off-by: Philippe Mathieu-Daudé --- v5: Use PEP3135, use self._ldpath.append() method (Willian) --- tests/acceptance/avocado_qemu/__init__.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py index 9b2ea3b248a..85bb3519969 100644 --- a/tests/acceptance/avocado_qemu/__init__.py +++ b/tests/acceptance/avocado_qemu/__init__.py @@ -17,7 +17,7 @@ import uuid import avocado -from avocado.utils import cloudinit, datadrainer, network, ssh, vmimage +from avocado.utils import cloudinit, datadrainer, network, process, ssh, vmimage from avocado.utils.path import find_command #: The QEMU build root directory. It may also be the source directory @@ -295,6 +295,23 @@ def tearDown(self): super().tearDown() +class QemuUserTest(QemuBaseTest): + """Facilitates user-mode emulation tests.""" + + def setUp(self): + self._ldpath = [] + super().setUp('qemu-') + + def add_ldpath(self, ldpath): + self._ldpath.append(os.path.abspath(ldpath)) + + def run(self, bin_path, args=[]): + qemu_args = " ".join(["-L %s" % ldpath for ldpath in self._ldpath]) + bin_args = " ".join(args) + return process.run("%s %s %s %s" % (self.qemu_bin, qemu_args, + bin_path, bin_args)) + + class LinuxSSHMixIn: """Contains utility methods for interacting with a guest via SSH.""" From patchwork Tue Nov 2 08:42:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1549524 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=L18uFuCD; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4Hk3QS4TmVz9sVc for ; Tue, 2 Nov 2021 19:45:52 +1100 (AEDT) Received: from localhost ([::1]:45830 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mhpQU-0003RX-Ga for incoming@patchwork.ozlabs.org; Tue, 02 Nov 2021 04:45:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60272) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mhpNh-0006qI-Vq for qemu-devel@nongnu.org; Tue, 02 Nov 2021 04:42:58 -0400 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:42506) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mhpNf-0007ZM-KS for qemu-devel@nongnu.org; Tue, 02 Nov 2021 04:42:57 -0400 Received: by mail-wr1-x434.google.com with SMTP id c4so2046989wrd.9 for ; Tue, 02 Nov 2021 01:42:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/GJnQqcSBpzJ9FdoSQJa+0mjU+wATrzkdQ7FymVRsE4=; b=L18uFuCDg4ETIcBgozDpwg5ZT8qi3vA8z1r1wFSrnpdIbfilO5GAKPesC5yncSdAbO +QBuRtQRq978c4J5VU42IUE4MY0X8z0JvEB4Y+P7LLRylMY/xJCYKNXmXzxrEHRHDb3X uXBPYUyxNwBBDVZcH1wjyZGzCPveStyZvf5FOQWUp3gsvxmELn42GDjHT9NdOBsz/1eK Ntq7inacRdBsH94LhXWh63kpHLJAY/E8u/f5UpmArP3DX1gOhFeIt6fjHYiYTrIAOalc FQLuiWnZPP+y/95M0OPWBwQa1XqXvBWS6BDCcXdKQ8FaGGPzR0+2J3yAzwyz3XQZ1Ne0 /9LQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=/GJnQqcSBpzJ9FdoSQJa+0mjU+wATrzkdQ7FymVRsE4=; b=B8N8+sZYd18nIvx+7P6uqGStUYtDMHE8NGPjBsmvqgEa8OL+ZpC0aP0RTtD9ZVSoRE Wp54ONlWfpo84tCopiSrzLWEzEMZFq6OKY0vRofLRGUYdYe1ZgFIYtPwIbHt+7dYBcJp RIdw+GnLi0c3XKSi3nryMx3ZslYLjegxAtur6pOUv9mq5PZmftLycoINkKxbytLOM1RW HUVG32ck+3L8jCQrBJzrPi8+mPtMgwkKv1zu1FyeEUYnuI/UOhWb+S/rMLWgDw9Mkd3c gnDSR8SKVI/Wym3cdBX3RZJkAZRQAaKYR8ANSdACKJpWepVYLB035OPWSNAK99ddmny9 qy1g== X-Gm-Message-State: AOAM532Tk4qAvwPuUZQm68KccVYpLRdqnhtemEh8Q3CtHL9PBzj78Fm0 VIvvUS/tZfRyEca4fUhVBF3GTKsmjvc= X-Google-Smtp-Source: ABdhPJx2bwdYjsWaDJ/lQOKax5vJidZarDIll5wfw9aDr9Nqv9svYQSd7Rwf+wsLJPYU4vvjY6HrmQ== X-Received: by 2002:a5d:6d07:: with SMTP id e7mr10471312wrq.311.1635842574127; Tue, 02 Nov 2021 01:42:54 -0700 (PDT) Received: from x1w.. (62.red-83-57-168.dynamicip.rima-tde.net. [83.57.168.62]) by smtp.gmail.com with ESMTPSA id z11sm6429172wrt.58.2021.11.02.01.42.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Nov 2021 01:42:53 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v5 4/6] tests/acceptance: Share useful helpers from virtiofs_submounts test Date: Tue, 2 Nov 2021 09:42:30 +0100 Message-Id: <20211102084232.2965062-5-f4bug@amsat.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211102084232.2965062-1-f4bug@amsat.org> References: <20211102084232.2965062-1-f4bug@amsat.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-x434.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.248, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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: , Cc: Willian Rampazzo , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Wainer dos Santos Moschetta , Warner Losh , Cleber Rosa Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Move the useful has_cmd()/has_cmds() helpers from the virtiofs test to the avocado_qemu public class. Reviewed-by: Wainer dos Santos Moschetta Reviewed-by: Willian Rampazzo Signed-off-by: Philippe Mathieu-Daudé --- tests/acceptance/avocado_qemu/__init__.py | 57 ++++++++++++++++++++++ tests/acceptance/virtiofs_submounts.py | 59 +---------------------- 2 files changed, 59 insertions(+), 57 deletions(-) diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py index 85bb3519969..0d0478374c3 100644 --- a/tests/acceptance/avocado_qemu/__init__.py +++ b/tests/acceptance/avocado_qemu/__init__.py @@ -11,6 +11,7 @@ import logging import os import shutil +import subprocess import sys import tempfile import time @@ -41,6 +42,62 @@ tcg_available) +def has_cmd(name, args=None): + """ + This function is for use in a @avocado.skipUnless decorator, e.g.: + + @skipUnless(*has_cmd('sudo -n', ('sudo', '-n', 'true'))) + def test_something_that_needs_sudo(self): + ... + """ + + if args is None: + args = ('which', name) + + try: + _, stderr, exitcode = run_cmd(args) + except Exception as e: + exitcode = -1 + stderr = str(e) + + if exitcode != 0: + cmd_line = ' '.join(args) + err = f'{name} required, but "{cmd_line}" failed: {stderr.strip()}' + return (False, err) + else: + return (True, '') + +def has_cmds(*cmds): + """ + This function is for use in a @avocado.skipUnless decorator and + allows checking for the availability of multiple commands, e.g.: + + @skipUnless(*has_cmds(('cmd1', ('cmd1', '--some-parameter')), + 'cmd2', 'cmd3')) + def test_something_that_needs_cmd1_and_cmd2(self): + ... + """ + + for cmd in cmds: + if isinstance(cmd, str): + cmd = (cmd,) + + ok, errstr = has_cmd(*cmd) + if not ok: + return (False, errstr) + + return (True, '') + +def run_cmd(args): + subp = subprocess.Popen(args, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + universal_newlines=True) + stdout, stderr = subp.communicate() + ret = subp.returncode + + return (stdout, stderr, ret) + def is_readable_executable_file(path): return os.path.isfile(path) and os.access(path, os.R_OK | os.X_OK) diff --git a/tests/acceptance/virtiofs_submounts.py b/tests/acceptance/virtiofs_submounts.py index 21ad7d792e7..e6dc32ffd4e 100644 --- a/tests/acceptance/virtiofs_submounts.py +++ b/tests/acceptance/virtiofs_submounts.py @@ -6,67 +6,12 @@ from avocado import skipUnless from avocado_qemu import LinuxTest, BUILD_DIR +from avocado_qemu import has_cmds +from avocado_qemu import run_cmd from avocado_qemu import wait_for_console_pattern from avocado.utils import ssh -def run_cmd(args): - subp = subprocess.Popen(args, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, - universal_newlines=True) - stdout, stderr = subp.communicate() - ret = subp.returncode - - return (stdout, stderr, ret) - -def has_cmd(name, args=None): - """ - This function is for use in a @avocado.skipUnless decorator, e.g.: - - @skipUnless(*has_cmd('sudo -n', ('sudo', '-n', 'true'))) - def test_something_that_needs_sudo(self): - ... - """ - - if args is None: - args = ('which', name) - - try: - _, stderr, exitcode = run_cmd(args) - except Exception as e: - exitcode = -1 - stderr = str(e) - - if exitcode != 0: - cmd_line = ' '.join(args) - err = f'{name} required, but "{cmd_line}" failed: {stderr.strip()}' - return (False, err) - else: - return (True, '') - -def has_cmds(*cmds): - """ - This function is for use in a @avocado.skipUnless decorator and - allows checking for the availability of multiple commands, e.g.: - - @skipUnless(*has_cmds(('cmd1', ('cmd1', '--some-parameter')), - 'cmd2', 'cmd3')) - def test_something_that_needs_cmd1_and_cmd2(self): - ... - """ - - for cmd in cmds: - if isinstance(cmd, str): - cmd = (cmd,) - - ok, errstr = has_cmd(*cmd) - if not ok: - return (False, errstr) - - return (True, '') - - class VirtiofsSubmountsTest(LinuxTest): """ :avocado: tags=arch:x86_64 From patchwork Tue Nov 2 08:42:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1549521 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=lP983CNJ; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4Hk3N22xR6z9sVc for ; Tue, 2 Nov 2021 19:43:46 +1100 (AEDT) Received: from localhost ([::1]:38504 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mhpOS-000726-7o for incoming@patchwork.ozlabs.org; Tue, 02 Nov 2021 04:43:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60332) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mhpNm-0006zW-S3 for qemu-devel@nongnu.org; Tue, 02 Nov 2021 04:43:02 -0400 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:42507) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mhpNk-0007Zp-AJ for qemu-devel@nongnu.org; Tue, 02 Nov 2021 04:43:02 -0400 Received: by mail-wr1-x434.google.com with SMTP id c4so2047309wrd.9 for ; Tue, 02 Nov 2021 01:42:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=u3NBrJ1OPNK57q3TFtPyewQdz3cOFKEL+wLt+Ik/B6U=; b=lP983CNJ0XXYwWaFqvEi0GzvjGRp/zBLGPL0x+IvzCdznbpVikVnc2ueYp8dXiy/5t CzqETTfSasfs9iP6UP7GUDCz4DlxvmWWQXsQPoXOupMLcs+XGApgofSdmIJRT3RfUkK0 v8Cm1a4i14WaLHMwuelk/tzRDIq0kR3jjFzliboS26lZsjkvLkoFLmQdLlQzJX0YwpB4 kXqUgASHkLu8cs6lSDyhiqQ5vVHsFTfeXeAjs6Sr+h49aabfcFb9umGPsMFuhFt0UMOS rPmiEvWuuLdSjEEuOz22c6Szd/86ICywSHS3B1GZtYWyd+PXRiwstJvWF5Q04I0Fd3XI HUnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=u3NBrJ1OPNK57q3TFtPyewQdz3cOFKEL+wLt+Ik/B6U=; b=539/1xQCtEG+V/HkcSmQ+kr8CGjeU5UqZ1q9HT9jucR3p9YzQdoR9gbn4j5uFQJzcX X3pfuh2sG/tUezAOhSVIoZuP6uO4ajPI42+BEfMLKZlNiNHfkeaENxxNEeGTw7L272XP PN+NCUsVOgztZ6tEls2iF3FzybKLNKRqwtdyIMMhzt2nhF2KNYD1J2KW5uLrDejdSUr9 yB1a2XPSMIHI7ysN6qGJBvOl7d5Pt8rPR6bzBppahru4+fVDqjJrmgw+ZK7KAC8qfBgv 763PkQOMAqF77BFdPD5PKjlRPgSGbdaBfIMDrr6nN+Zdi+A+h64yQ2AAs8CfhiCeqkxP AX3Q== X-Gm-Message-State: AOAM532lOVf1zh37nmRveXw0CK7TIbQy4tL85TymjG2o399uP6IPzwvi mvTsj81jY3MMPGdFJHHF+NxkKwUf7Nc= X-Google-Smtp-Source: ABdhPJyQ8kP6IhzUzumHrCMXjug9Pm6rVrEL3dRu5unacw/jYKdeg2BSaXP5QyvxMcg44fj5yqb4TQ== X-Received: by 2002:a05:6000:2a2:: with SMTP id l2mr11264283wry.110.1635842578929; Tue, 02 Nov 2021 01:42:58 -0700 (PDT) Received: from x1w.. (62.red-83-57-168.dynamicip.rima-tde.net. [83.57.168.62]) by smtp.gmail.com with ESMTPSA id k8sm1902997wms.41.2021.11.02.01.42.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Nov 2021 01:42:58 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v5 5/6] tests/acceptance: Add bFLT loader linux-user test Date: Tue, 2 Nov 2021 09:42:31 +0100 Message-Id: <20211102084232.2965062-6-f4bug@amsat.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211102084232.2965062-1-f4bug@amsat.org> References: <20211102084232.2965062-1-f4bug@amsat.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-x434.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.248, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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: , Cc: Willian Rampazzo , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Wainer dos Santos Moschetta , Warner Losh , Cleber Rosa Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Add a very quick test that runs a busybox binary in bFLT format: $ AVOCADO_ALLOW_UNTRUSTED_CODE=1 \ avocado --show=app run -t linux_user tests/acceptance/load_bflt.py JOB ID : db94d5960ce564c50904d666a7e259148c27e88f JOB LOG : ~/avocado/job-results/job-2019-06-25T10.52-db94d59/job.log (1/1) tests/acceptance/load_bflt.py:LoadBFLT.test_stm32: PASS (0.15 s) RESULTS : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0 JOB TIME : 0.54 s Reviewed-by: Willian Rampazzo Signed-off-by: Philippe Mathieu-Daudé --- v5: Use os.path.join() --- tests/acceptance/load_bflt.py | 54 +++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 tests/acceptance/load_bflt.py diff --git a/tests/acceptance/load_bflt.py b/tests/acceptance/load_bflt.py new file mode 100644 index 00000000000..bb50cec1ee8 --- /dev/null +++ b/tests/acceptance/load_bflt.py @@ -0,0 +1,54 @@ +# Test the bFLT loader format +# +# Copyright (C) 2019 Philippe Mathieu-Daudé +# +# SPDX-License-Identifier: GPL-2.0-or-later + +import os +import bz2 +import subprocess + +from avocado import skipUnless +from avocado_qemu import QemuUserTest +from avocado_qemu import has_cmd + + +class LoadBFLT(QemuUserTest): + + def extract_cpio(self, cpio_path): + """ + Extracts a cpio archive into the test workdir + + :param cpio_path: path to the cpio archive + """ + cwd = os.getcwd() + os.chdir(self.workdir) + with bz2.open(cpio_path, 'rb') as archive_cpio: + subprocess.run(['cpio', '-i'], input=archive_cpio.read(), + stderr=subprocess.DEVNULL) + os.chdir(cwd) + + @skipUnless(*has_cmd('cpio')) + @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code') + def test_stm32(self): + """ + :avocado: tags=arch:arm + :avocado: tags=linux_user + :avocado: tags=quick + """ + # See https://elinux.org/STM32#User_Space + rootfs_url = ('https://elinux.org/images/5/51/' + 'Stm32_mini_rootfs.cpio.bz2') + rootfs_hash = '9f065e6ba40cce7411ba757f924f30fcc57951e6' + rootfs_path_bz2 = self.fetch_asset(rootfs_url, asset_hash=rootfs_hash) + busybox_path = os.path.join(self.workdir, "/bin/busybox") + + self.extract_cpio(rootfs_path_bz2) + + res = self.run(busybox_path) + ver = 'BusyBox v1.24.0.git (2015-02-03 22:17:13 CET) multi-call binary.' + self.assertIn(ver, res.stdout_text) + + res = self.run(busybox_path, ['uname', '-a']) + unm = 'armv7l GNU/Linux' + self.assertIn(unm, res.stdout_text) From patchwork Tue Nov 2 08:42:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1549525 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=k5wmX9PG; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4Hk3Qh4PXyz9sVc for ; Tue, 2 Nov 2021 19:46:04 +1100 (AEDT) Received: from localhost ([::1]:46684 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mhpQf-00041i-RW for incoming@patchwork.ozlabs.org; Tue, 02 Nov 2021 04:46:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60374) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mhpNt-00076k-Jj for qemu-devel@nongnu.org; Tue, 02 Nov 2021 04:43:10 -0400 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]:45936) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mhpNq-0007as-Bs for qemu-devel@nongnu.org; Tue, 02 Nov 2021 04:43:09 -0400 Received: by mail-wr1-x42a.google.com with SMTP id o14so31912079wra.12 for ; Tue, 02 Nov 2021 01:43:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=knXTZpgWdBpvF/b8mOCMuicGRaCSbzmVVgQnaKtoKdg=; b=k5wmX9PGITMQLhGoAHXcC2ErqMqj06s81LO5XgZoxJAgsMkXE5RjtA6HoihmT99puZ Llf1D7fiz06/LfkH1fmDBIyKWwX2nQHlvHEcFeb2WtWHwzqrtvHSbxal5oiTLBgy+6cP Ry4PGTpc7/cyLmd29da+NapgxB9g3xs2+/u/qWWTbY457deeidXsbZITcIgzfs6es+V1 YmWoOSbh4nxMVxrMggLu7nqHRhgUCa3C4Jl0ig/j+vOX4WanJYgwQutKs5cpIAlOG+cR hhV0YPpmqRPdEEnds5m8egLyLs/+IcveY85nIoYbz1Hqg913JVNFugQze9lr9pEXwyRO plUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=knXTZpgWdBpvF/b8mOCMuicGRaCSbzmVVgQnaKtoKdg=; b=szXZYVPk2sPnmdb/mVcga5pzmR9mcXuw0eoPmFrDGIKtRA7TxKqEaVEHTgxeqz24C7 ALzzC0WXGaQovys9jGvryoDvP033ufaaGaXcG9IoIFxLFpPHKlhntNgSOmdBKgIFqX7l xvQTy2TjFJ0IpwgTmd/f2epujp/PclUihl6vfi14of1DJBWT93qAvL4Pk1I2XMzqjL1m RjjDOvRNEJPeV+Jg9tA1A40x0DBVnHa9ePCNgzW5tqMhNG0KCZeTFCj9JsnUSDbdLiGU P5maDd9vRBMQzvrMEhHRa5t5eytlWB84T2VDcvogt5ltImXe4WtI0WzP6kSENcFUUjwu x4Sg== X-Gm-Message-State: AOAM533uRh8+wfgLx77fcRaOgLqt6Ym5YAGO389YvV4jlgIHW9994JwI /TUNEc1YYmDSTU6hLsvHpF1Y5x6cHvk= X-Google-Smtp-Source: ABdhPJxyespqG4HYCtV3g2uH5UWu2BDHkB1YbBpVEga8WLd1LveWfxLWl9OJnzxvmfvCTddEcpRqzQ== X-Received: by 2002:a05:6000:18ae:: with SMTP id b14mr45020686wri.263.1635842584471; Tue, 02 Nov 2021 01:43:04 -0700 (PDT) Received: from x1w.. (62.red-83-57-168.dynamicip.rima-tde.net. [83.57.168.62]) by smtp.gmail.com with ESMTPSA id n66sm1847319wmn.2.2021.11.02.01.43.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Nov 2021 01:43:04 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v5 6/6] tests/acceptance: Rename avocado_qemu.Test -> QemuSystemTest Date: Tue, 2 Nov 2021 09:42:32 +0100 Message-Id: <20211102084232.2965062-7-f4bug@amsat.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211102084232.2965062-1-f4bug@amsat.org> References: <20211102084232.2965062-1-f4bug@amsat.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-x42a.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.248, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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: , Cc: Willian Rampazzo , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Wainer dos Santos Moschetta , Warner Losh , Cleber Rosa Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" To run user-mode emulation tests, we introduced the avocado_qemu.QemuUserTest which inherits from avocado_qemu.QemuBaseTest. System-mode emulation tests are based on the avocado_qemu.Test class, which also inherits avocado_qemu.QemuBaseTest. To avoid confusion, rename it as avocado_qemu.QemuSystemTest. Suggested-by: Wainer dos Santos Moschetta Reviewed-by: Willian Rampazzo Signed-off-by: Philippe Mathieu-Daudé --- docs/devel/testing.rst | 8 ++++---- tests/acceptance/avocado_qemu/__init__.py | 21 +++++++++----------- tests/acceptance/boot_linux_console.py | 4 ++-- tests/acceptance/cpu_queries.py | 4 ++-- tests/acceptance/empty_cpu_model.py | 4 ++-- tests/acceptance/info_usernet.py | 4 ++-- tests/acceptance/linux_initrd.py | 4 ++-- tests/acceptance/linux_ssh_mips_malta.py | 5 +++-- tests/acceptance/machine_arm_canona1100.py | 4 ++-- tests/acceptance/machine_arm_integratorcp.py | 4 ++-- tests/acceptance/machine_arm_n8x0.py | 4 ++-- tests/acceptance/machine_avr6.py | 4 ++-- tests/acceptance/machine_m68k_nextcube.py | 4 ++-- tests/acceptance/machine_microblaze.py | 4 ++-- tests/acceptance/machine_mips_fuloong2e.py | 4 ++-- tests/acceptance/machine_mips_loongson3v.py | 4 ++-- tests/acceptance/machine_mips_malta.py | 4 ++-- tests/acceptance/machine_rx_gdbsim.py | 4 ++-- tests/acceptance/machine_s390_ccw_virtio.py | 4 ++-- tests/acceptance/machine_sparc_leon3.py | 4 ++-- tests/acceptance/migration.py | 4 ++-- tests/acceptance/multiprocess.py | 4 ++-- tests/acceptance/pc_cpu_hotplug_props.py | 4 ++-- tests/acceptance/ppc_405.py | 4 ++-- tests/acceptance/ppc_bamboo.py | 4 ++-- tests/acceptance/ppc_mpc8544ds.py | 4 ++-- tests/acceptance/ppc_prep_40p.py | 4 ++-- tests/acceptance/ppc_pseries.py | 4 ++-- tests/acceptance/ppc_virtex_ml507.py | 4 ++-- tests/acceptance/version.py | 4 ++-- tests/acceptance/virtio-gpu.py | 4 ++-- tests/acceptance/virtio_check_params.py | 4 ++-- tests/acceptance/virtio_version.py | 4 ++-- tests/acceptance/vnc.py | 4 ++-- tests/acceptance/x86_cpu_model_versions.py | 4 ++-- 35 files changed, 80 insertions(+), 82 deletions(-) diff --git a/docs/devel/testing.rst b/docs/devel/testing.rst index 7500f076c21..ac7d0c7dc72 100644 --- a/docs/devel/testing.rst +++ b/docs/devel/testing.rst @@ -812,10 +812,10 @@ class. Here's a simple usage example: .. code:: - from avocado_qemu import Test + from avocado_qemu import QemuSystemTest - class Version(Test): + class Version(QemuSystemTest): """ :avocado: tags=quick """ @@ -860,10 +860,10 @@ and hypothetical example follows: .. code:: - from avocado_qemu import Test + from avocado_qemu import QemuSystemTest - class MultipleMachines(Test): + class MultipleMachines(QemuSystemTest): def test_multiple_machines(self): first_machine = self.get_vm() second_machine = self.get_vm() diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py index 0d0478374c3..0cb8e1c7bb6 100644 --- a/tests/acceptance/avocado_qemu/__init__.py +++ b/tests/acceptance/avocado_qemu/__init__.py @@ -176,7 +176,7 @@ def interrupt_interactive_console_until_pattern(test, success_message, :param test: an Avocado test containing a VM that will have its console read and probed for a success or failure message - :type test: :class:`avocado_qemu.Test` + :type test: :class:`avocado_qemu.QemuSystemTest` :param success_message: if this message appears, test succeeds :param failure_message: if this message appears, test fails :param interrupt_string: a string to send to the console before trying @@ -192,7 +192,7 @@ def wait_for_console_pattern(test, success_message, failure_message=None, :param test: an Avocado test containing a VM that will have its console read and probed for a success or failure message - :type test: :class:`avocado_qemu.Test` + :type test: :class:`avocado_qemu.QemuSystemTest` :param success_message: if this message appears, test succeeds :param failure_message: if this message appears, test fails """ @@ -204,7 +204,7 @@ def exec_command(test, command): the content. :param test: an Avocado test containing a VM. - :type test: :class:`avocado_qemu.Test` + :type test: :class:`avocado_qemu.QemuSystemTest` :param command: the command to send :type command: str """ @@ -219,7 +219,7 @@ def exec_command_and_wait_for_pattern(test, command, :param test: an Avocado test containing a VM that will have its console read and probed for a success or failure message - :type test: :class:`avocado_qemu.Test` + :type test: :class:`avocado_qemu.QemuSystemTest` :param command: the command to send :param success_message: if this message appears, test succeeds :param failure_message: if this message appears, test fails @@ -262,11 +262,8 @@ def fetch_asset(self, name, cancel_on_missing=cancel_on_missing) -class Test(QemuBaseTest): - """Facilitates system emulation tests. - - TODO: Rename this class as `QemuSystemTest`. - """ +class QemuSystemTest(QemuBaseTest): + """Facilitates system emulation tests.""" def setUp(self): self._vms = {} @@ -508,11 +505,11 @@ def default_kernel_params(self): return self._info.get('kernel_params', None) -class LinuxTest(LinuxSSHMixIn, Test): +class LinuxTest(LinuxSSHMixIn, QemuSystemTest): """Facilitates having a cloud-image Linux based available. - For tests that indend to interact with guests, this is a better choice - to start with than the more vanilla `Test` class. + For tests that indent to interact with guests, this is a better choice + to start with than the more vanilla `QemuSystemTest` class. """ timeout = 900 diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py index 06fc967f6c4..4ed01ed7893 100644 --- a/tests/acceptance/boot_linux_console.py +++ b/tests/acceptance/boot_linux_console.py @@ -15,7 +15,7 @@ from avocado import skip from avocado import skipUnless -from avocado_qemu import Test +from avocado_qemu import QemuSystemTest from avocado_qemu import exec_command from avocado_qemu import exec_command_and_wait_for_pattern from avocado_qemu import interrupt_interactive_console_until_pattern @@ -46,7 +46,7 @@ def image_pow2ceil_expand(path): with open(path, 'ab+') as fd: fd.truncate(size_aligned) -class LinuxKernelTest(Test): +class LinuxKernelTest(QemuSystemTest): KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 ' def wait_for_console_pattern(self, success_message, vm=None): diff --git a/tests/acceptance/cpu_queries.py b/tests/acceptance/cpu_queries.py index cc9e380cc7f..cf69f69b116 100644 --- a/tests/acceptance/cpu_queries.py +++ b/tests/acceptance/cpu_queries.py @@ -8,9 +8,9 @@ # This work is licensed under the terms of the GNU GPL, version 2 or # later. See the COPYING file in the top-level directory. -from avocado_qemu import Test +from avocado_qemu import QemuSystemTest -class QueryCPUModelExpansion(Test): +class QueryCPUModelExpansion(QemuSystemTest): """ Run query-cpu-model-expansion for each CPU model, and validate results """ diff --git a/tests/acceptance/empty_cpu_model.py b/tests/acceptance/empty_cpu_model.py index a1e59e45e4e..22f504418d2 100644 --- a/tests/acceptance/empty_cpu_model.py +++ b/tests/acceptance/empty_cpu_model.py @@ -7,9 +7,9 @@ # # This work is licensed under the terms of the GNU GPL, version 2 or # later. See the COPYING file in the top-level directory. -from avocado_qemu import Test +from avocado_qemu import QemuSystemTest -class EmptyCPUModel(Test): +class EmptyCPUModel(QemuSystemTest): def test(self): self.vm.add_args('-S', '-display', 'none', '-machine', 'none', '-cpu', '') self.vm.set_qmp_monitor(enabled=False) diff --git a/tests/acceptance/info_usernet.py b/tests/acceptance/info_usernet.py index 9c1fd903a0b..dc01f74150c 100644 --- a/tests/acceptance/info_usernet.py +++ b/tests/acceptance/info_usernet.py @@ -8,12 +8,12 @@ # This work is licensed under the terms of the GNU GPL, version 2 or # later. See the COPYING file in the top-level directory. -from avocado_qemu import Test +from avocado_qemu import QemuSystemTest from qemu.utils import get_info_usernet_hostfwd_port -class InfoUsernet(Test): +class InfoUsernet(QemuSystemTest): def test_hostfwd(self): self.vm.add_args('-netdev', 'user,id=vnet,hostfwd=:127.0.0.1:0-:22') diff --git a/tests/acceptance/linux_initrd.py b/tests/acceptance/linux_initrd.py index a249e2f14a2..25fba6a28a7 100644 --- a/tests/acceptance/linux_initrd.py +++ b/tests/acceptance/linux_initrd.py @@ -12,11 +12,11 @@ import logging import tempfile -from avocado_qemu import Test +from avocado_qemu import QemuSystemTest from avocado import skipIf -class LinuxInitrd(Test): +class LinuxInitrd(QemuSystemTest): """ Checks QEMU evaluates correctly the initrd file passed as -initrd option. diff --git a/tests/acceptance/linux_ssh_mips_malta.py b/tests/acceptance/linux_ssh_mips_malta.py index 4de19474188..c0f0be5adee 100644 --- a/tests/acceptance/linux_ssh_mips_malta.py +++ b/tests/acceptance/linux_ssh_mips_malta.py @@ -12,7 +12,8 @@ import time from avocado import skipUnless -from avocado_qemu import Test, LinuxSSHMixIn +from avocado_qemu import LinuxSSHMixIn +from avocado_qemu import QemuSystemTest from avocado_qemu import wait_for_console_pattern from avocado.utils import process from avocado.utils import archive @@ -21,7 +22,7 @@ @skipUnless(os.getenv('AVOCADO_TIMEOUT_EXPECTED'), 'Test might timeout') @skipUnless(ssh.SSH_CLIENT_BINARY, 'No SSH client available') -class LinuxSSH(Test, LinuxSSHMixIn): +class LinuxSSH(QemuSystemTest, LinuxSSHMixIn): timeout = 150 # Not for 'configure --enable-debug --enable-debug-tcg' diff --git a/tests/acceptance/machine_arm_canona1100.py b/tests/acceptance/machine_arm_canona1100.py index 0e5c43dbcf8..182a0b05134 100644 --- a/tests/acceptance/machine_arm_canona1100.py +++ b/tests/acceptance/machine_arm_canona1100.py @@ -8,11 +8,11 @@ # This work is licensed under the terms of the GNU GPL, version 2 or # later. See the COPYING file in the top-level directory. -from avocado_qemu import Test +from avocado_qemu import QemuSystemTest from avocado_qemu import wait_for_console_pattern from avocado.utils import archive -class CanonA1100Machine(Test): +class CanonA1100Machine(QemuSystemTest): """Boots the barebox firmware and checks that the console is operational""" timeout = 90 diff --git a/tests/acceptance/machine_arm_integratorcp.py b/tests/acceptance/machine_arm_integratorcp.py index 49c8ebff78b..1ffe1073ef8 100644 --- a/tests/acceptance/machine_arm_integratorcp.py +++ b/tests/acceptance/machine_arm_integratorcp.py @@ -12,7 +12,7 @@ import logging from avocado import skipUnless -from avocado_qemu import Test +from avocado_qemu import QemuSystemTest from avocado_qemu import wait_for_console_pattern @@ -29,7 +29,7 @@ CV2_AVAILABLE = False -class IntegratorMachine(Test): +class IntegratorMachine(QemuSystemTest): timeout = 90 diff --git a/tests/acceptance/machine_arm_n8x0.py b/tests/acceptance/machine_arm_n8x0.py index e5741f2d8d1..12e9a6803ba 100644 --- a/tests/acceptance/machine_arm_n8x0.py +++ b/tests/acceptance/machine_arm_n8x0.py @@ -11,10 +11,10 @@ import os from avocado import skipUnless -from avocado_qemu import Test +from avocado_qemu import QemuSystemTest from avocado_qemu import wait_for_console_pattern -class N8x0Machine(Test): +class N8x0Machine(QemuSystemTest): """Boots the Linux kernel and checks that the console is operational""" timeout = 90 diff --git a/tests/acceptance/machine_avr6.py b/tests/acceptance/machine_avr6.py index 6baf4e9c7f3..7536d83356f 100644 --- a/tests/acceptance/machine_avr6.py +++ b/tests/acceptance/machine_avr6.py @@ -19,9 +19,9 @@ import time -from avocado_qemu import Test +from avocado_qemu import QemuSystemTest -class AVR6Machine(Test): +class AVR6Machine(QemuSystemTest): timeout = 5 def test_freertos(self): diff --git a/tests/acceptance/machine_m68k_nextcube.py b/tests/acceptance/machine_m68k_nextcube.py index 09e2745cc52..6790e7d9cd1 100644 --- a/tests/acceptance/machine_m68k_nextcube.py +++ b/tests/acceptance/machine_m68k_nextcube.py @@ -8,7 +8,7 @@ import os import time -from avocado_qemu import Test +from avocado_qemu import QemuSystemTest from avocado import skipUnless from tesseract_utils import tesseract_available, tesseract_ocr @@ -20,7 +20,7 @@ PIL_AVAILABLE = False -class NextCubeMachine(Test): +class NextCubeMachine(QemuSystemTest): """ :avocado: tags=arch:m68k :avocado: tags=machine:next-cube diff --git a/tests/acceptance/machine_microblaze.py b/tests/acceptance/machine_microblaze.py index 7f6d18495d8..4928920f960 100644 --- a/tests/acceptance/machine_microblaze.py +++ b/tests/acceptance/machine_microblaze.py @@ -5,11 +5,11 @@ # This work is licensed under the terms of the GNU GPL, version 2 or # later. See the COPYING file in the top-level directory. -from avocado_qemu import Test +from avocado_qemu import QemuSystemTest from avocado_qemu import wait_for_console_pattern from avocado.utils import archive -class MicroblazeMachine(Test): +class MicroblazeMachine(QemuSystemTest): timeout = 90 diff --git a/tests/acceptance/machine_mips_fuloong2e.py b/tests/acceptance/machine_mips_fuloong2e.py index 0ac285e2af1..89291f47b24 100644 --- a/tests/acceptance/machine_mips_fuloong2e.py +++ b/tests/acceptance/machine_mips_fuloong2e.py @@ -10,10 +10,10 @@ import os from avocado import skipUnless -from avocado_qemu import Test +from avocado_qemu import QemuSystemTest from avocado_qemu import wait_for_console_pattern -class MipsFuloong2e(Test): +class MipsFuloong2e(QemuSystemTest): timeout = 60 diff --git a/tests/acceptance/machine_mips_loongson3v.py b/tests/acceptance/machine_mips_loongson3v.py index 85b131a40f0..5194cf18c9c 100644 --- a/tests/acceptance/machine_mips_loongson3v.py +++ b/tests/acceptance/machine_mips_loongson3v.py @@ -11,10 +11,10 @@ import time from avocado import skipUnless -from avocado_qemu import Test +from avocado_qemu import QemuSystemTest from avocado_qemu import wait_for_console_pattern -class MipsLoongson3v(Test): +class MipsLoongson3v(QemuSystemTest): timeout = 60 @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code') diff --git a/tests/acceptance/machine_mips_malta.py b/tests/acceptance/machine_mips_malta.py index b67d8cb141c..f1895d59f35 100644 --- a/tests/acceptance/machine_mips_malta.py +++ b/tests/acceptance/machine_mips_malta.py @@ -12,7 +12,7 @@ import logging from avocado import skipUnless -from avocado_qemu import Test +from avocado_qemu import QemuSystemTest from avocado_qemu import wait_for_console_pattern from avocado.utils import archive from avocado import skipIf @@ -33,7 +33,7 @@ @skipUnless(NUMPY_AVAILABLE, 'Python NumPy not installed') @skipUnless(CV2_AVAILABLE, 'Python OpenCV not installed') -class MaltaMachineFramebuffer(Test): +class MaltaMachineFramebuffer(QemuSystemTest): timeout = 30 diff --git a/tests/acceptance/machine_rx_gdbsim.py b/tests/acceptance/machine_rx_gdbsim.py index 32b737b6d85..6cd8704b016 100644 --- a/tests/acceptance/machine_rx_gdbsim.py +++ b/tests/acceptance/machine_rx_gdbsim.py @@ -11,13 +11,13 @@ import os from avocado import skipIf -from avocado_qemu import Test +from avocado_qemu import QemuSystemTest from avocado_qemu import exec_command_and_wait_for_pattern from avocado_qemu import wait_for_console_pattern from avocado.utils import archive -class RxGdbSimMachine(Test): +class RxGdbSimMachine(QemuSystemTest): timeout = 30 KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 ' diff --git a/tests/acceptance/machine_s390_ccw_virtio.py b/tests/acceptance/machine_s390_ccw_virtio.py index 4028c99afce..bd03d7160b4 100644 --- a/tests/acceptance/machine_s390_ccw_virtio.py +++ b/tests/acceptance/machine_s390_ccw_virtio.py @@ -13,12 +13,12 @@ import tempfile from avocado import skipIf -from avocado_qemu import Test +from avocado_qemu import QemuSystemTest from avocado_qemu import exec_command_and_wait_for_pattern from avocado_qemu import wait_for_console_pattern from avocado.utils import archive -class S390CCWVirtioMachine(Test): +class S390CCWVirtioMachine(QemuSystemTest): KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 ' timeout = 120 diff --git a/tests/acceptance/machine_sparc_leon3.py b/tests/acceptance/machine_sparc_leon3.py index 2405cd7a0d7..e61b223185a 100644 --- a/tests/acceptance/machine_sparc_leon3.py +++ b/tests/acceptance/machine_sparc_leon3.py @@ -5,12 +5,12 @@ # This work is licensed under the terms of the GNU GPL, version 2 or # later. See the COPYING file in the top-level directory. -from avocado_qemu import Test +from avocado_qemu import QemuSystemTest from avocado_qemu import wait_for_console_pattern from avocado import skip -class Leon3Machine(Test): +class Leon3Machine(QemuSystemTest): timeout = 60 diff --git a/tests/acceptance/migration.py b/tests/acceptance/migration.py index 792639cb693..584d6ef53f5 100644 --- a/tests/acceptance/migration.py +++ b/tests/acceptance/migration.py @@ -11,7 +11,7 @@ import tempfile -from avocado_qemu import Test +from avocado_qemu import QemuSystemTest from avocado import skipUnless from avocado.utils import network @@ -19,7 +19,7 @@ from avocado.utils.path import find_command -class Migration(Test): +class Migration(QemuSystemTest): """ :avocado: tags=migration """ diff --git a/tests/acceptance/multiprocess.py b/tests/acceptance/multiprocess.py index 96627f022a8..80a3b8f442b 100644 --- a/tests/acceptance/multiprocess.py +++ b/tests/acceptance/multiprocess.py @@ -7,12 +7,12 @@ import os import socket -from avocado_qemu import Test +from avocado_qemu import QemuSystemTest from avocado_qemu import wait_for_console_pattern from avocado_qemu import exec_command from avocado_qemu import exec_command_and_wait_for_pattern -class Multiprocess(Test): +class Multiprocess(QemuSystemTest): """ :avocado: tags=multiprocess """ diff --git a/tests/acceptance/pc_cpu_hotplug_props.py b/tests/acceptance/pc_cpu_hotplug_props.py index 2e86d5017a5..52b878188ed 100644 --- a/tests/acceptance/pc_cpu_hotplug_props.py +++ b/tests/acceptance/pc_cpu_hotplug_props.py @@ -20,9 +20,9 @@ # License along with this library; if not, see . # -from avocado_qemu import Test +from avocado_qemu import QemuSystemTest -class OmittedCPUProps(Test): +class OmittedCPUProps(QemuSystemTest): """ :avocado: tags=arch:x86_64 :avocado: tags=cpu:qemu64 diff --git a/tests/acceptance/ppc_405.py b/tests/acceptance/ppc_405.py index c534d5d32f2..a47f89b9346 100644 --- a/tests/acceptance/ppc_405.py +++ b/tests/acceptance/ppc_405.py @@ -6,11 +6,11 @@ # later. See the COPYING file in the top-level directory. from avocado.utils import archive -from avocado_qemu import Test +from avocado_qemu import QemuSystemTest from avocado_qemu import wait_for_console_pattern from avocado_qemu import exec_command_and_wait_for_pattern -class Ppc405Machine(Test): +class Ppc405Machine(QemuSystemTest): timeout = 90 diff --git a/tests/acceptance/ppc_bamboo.py b/tests/acceptance/ppc_bamboo.py index dd33bf66f32..40629e34789 100644 --- a/tests/acceptance/ppc_bamboo.py +++ b/tests/acceptance/ppc_bamboo.py @@ -6,11 +6,11 @@ # later. See the COPYING file in the top-level directory. from avocado.utils import archive -from avocado_qemu import Test +from avocado_qemu import QemuSystemTest from avocado_qemu import wait_for_console_pattern from avocado_qemu import exec_command_and_wait_for_pattern -class BambooMachine(Test): +class BambooMachine(QemuSystemTest): timeout = 90 diff --git a/tests/acceptance/ppc_mpc8544ds.py b/tests/acceptance/ppc_mpc8544ds.py index ce840600c1c..886f967b15a 100644 --- a/tests/acceptance/ppc_mpc8544ds.py +++ b/tests/acceptance/ppc_mpc8544ds.py @@ -6,10 +6,10 @@ # later. See the COPYING file in the top-level directory. from avocado.utils import archive -from avocado_qemu import Test +from avocado_qemu import QemuSystemTest from avocado_qemu import wait_for_console_pattern -class Mpc8544dsMachine(Test): +class Mpc8544dsMachine(QemuSystemTest): timeout = 90 KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 ' diff --git a/tests/acceptance/ppc_prep_40p.py b/tests/acceptance/ppc_prep_40p.py index 5e61e686bd0..4bd956584d6 100644 --- a/tests/acceptance/ppc_prep_40p.py +++ b/tests/acceptance/ppc_prep_40p.py @@ -8,11 +8,11 @@ import os from avocado import skipUnless -from avocado_qemu import Test +from avocado_qemu import QemuSystemTest from avocado_qemu import wait_for_console_pattern -class IbmPrep40pMachine(Test): +class IbmPrep40pMachine(QemuSystemTest): timeout = 60 diff --git a/tests/acceptance/ppc_pseries.py b/tests/acceptance/ppc_pseries.py index f14a884ee16..d8b04dc3ead 100644 --- a/tests/acceptance/ppc_pseries.py +++ b/tests/acceptance/ppc_pseries.py @@ -6,10 +6,10 @@ # later. See the COPYING file in the top-level directory. from avocado.utils import archive -from avocado_qemu import Test +from avocado_qemu import QemuSystemTest from avocado_qemu import wait_for_console_pattern -class pseriesMachine(Test): +class pseriesMachine(QemuSystemTest): timeout = 90 KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 ' diff --git a/tests/acceptance/ppc_virtex_ml507.py b/tests/acceptance/ppc_virtex_ml507.py index 27f7bf2d492..a6912ee5793 100644 --- a/tests/acceptance/ppc_virtex_ml507.py +++ b/tests/acceptance/ppc_virtex_ml507.py @@ -6,10 +6,10 @@ # later. See the COPYING file in the top-level directory. from avocado.utils import archive -from avocado_qemu import Test +from avocado_qemu import QemuSystemTest from avocado_qemu import wait_for_console_pattern -class VirtexMl507Machine(Test): +class VirtexMl507Machine(QemuSystemTest): timeout = 90 KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 ' diff --git a/tests/acceptance/version.py b/tests/acceptance/version.py index 79b923d4fc0..ded7f039c1b 100644 --- a/tests/acceptance/version.py +++ b/tests/acceptance/version.py @@ -9,10 +9,10 @@ # later. See the COPYING file in the top-level directory. -from avocado_qemu import Test +from avocado_qemu import QemuSystemTest -class Version(Test): +class Version(QemuSystemTest): """ :avocado: tags=quick """ diff --git a/tests/acceptance/virtio-gpu.py b/tests/acceptance/virtio-gpu.py index 4acc1e6d5fd..2a249a3a2c1 100644 --- a/tests/acceptance/virtio-gpu.py +++ b/tests/acceptance/virtio-gpu.py @@ -4,8 +4,8 @@ # later. See the COPYING file in the top-level directory. -from avocado_qemu import Test from avocado_qemu import BUILD_DIR +from avocado_qemu import QemuSystemTest from avocado_qemu import wait_for_console_pattern from avocado_qemu import exec_command_and_wait_for_pattern from avocado_qemu import is_readable_executable_file @@ -27,7 +27,7 @@ def pick_default_vug_bin(): return bld_dir_path -class VirtioGPUx86(Test): +class VirtioGPUx86(QemuSystemTest): """ :avocado: tags=virtio-gpu :avocado: tags=arch:x86_64 diff --git a/tests/acceptance/virtio_check_params.py b/tests/acceptance/virtio_check_params.py index 87e6c839d14..e869690473a 100644 --- a/tests/acceptance/virtio_check_params.py +++ b/tests/acceptance/virtio_check_params.py @@ -24,7 +24,7 @@ sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python')) from qemu.machine import QEMUMachine -from avocado_qemu import Test +from avocado_qemu import QemuSystemTest from avocado import skip #list of machine types and virtqueue properties to test @@ -41,7 +41,7 @@ 'driver=null-co,id=drive0,if=none']} -class VirtioMaxSegSettingsCheck(Test): +class VirtioMaxSegSettingsCheck(QemuSystemTest): @staticmethod def make_pattern(props): pattern_items = ['{0} = \w+'.format(prop) for prop in props] diff --git a/tests/acceptance/virtio_version.py b/tests/acceptance/virtio_version.py index 33593c29dd0..208910bb844 100644 --- a/tests/acceptance/virtio_version.py +++ b/tests/acceptance/virtio_version.py @@ -13,7 +13,7 @@ sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python')) from qemu.machine import QEMUMachine -from avocado_qemu import Test +from avocado_qemu import QemuSystemTest # Virtio Device IDs: VIRTIO_NET = 1 @@ -55,7 +55,7 @@ def get_pci_interfaces(vm, devtype): interfaces = ('pci-express-device', 'conventional-pci-device') return [i for i in interfaces if devtype_implements(vm, devtype, i)] -class VirtioVersionCheck(Test): +class VirtioVersionCheck(QemuSystemTest): """ Check if virtio-version-specific device types result in the same device tree created by `disable-modern` and diff --git a/tests/acceptance/vnc.py b/tests/acceptance/vnc.py index f301fbb4f56..096432988fb 100644 --- a/tests/acceptance/vnc.py +++ b/tests/acceptance/vnc.py @@ -8,10 +8,10 @@ # This work is licensed under the terms of the GNU GPL, version 2 or # later. See the COPYING file in the top-level directory. -from avocado_qemu import Test +from avocado_qemu import QemuSystemTest -class Vnc(Test): +class Vnc(QemuSystemTest): """ :avocado: tags=vnc,quick """ diff --git a/tests/acceptance/x86_cpu_model_versions.py b/tests/acceptance/x86_cpu_model_versions.py index 0e9feda62d4..a6edf74c1cc 100644 --- a/tests/acceptance/x86_cpu_model_versions.py +++ b/tests/acceptance/x86_cpu_model_versions.py @@ -24,7 +24,7 @@ import avocado_qemu import re -class X86CPUModelAliases(avocado_qemu.Test): +class X86CPUModelAliases(avocado_qemu.QemuSystemTest): """ Validation of PC CPU model versions and CPU model aliases @@ -239,7 +239,7 @@ def test_none_alias(self): self.validate_aliases(cpus) -class CascadelakeArchCapabilities(avocado_qemu.Test): +class CascadelakeArchCapabilities(avocado_qemu.QemuSystemTest): """ Validation of Cascadelake arch-capabilities