From nobody Thu Apr 18 22:24:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1552510088735234.93536503299129; Wed, 13 Mar 2019 13:48:08 -0700 (PDT) Received: from localhost ([127.0.0.1]:50658 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h4AnF-0000n9-9J for importer@patchew.org; Wed, 13 Mar 2019 16:48:05 -0400 Received: from eggs.gnu.org ([209.51.188.92]:47029) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h4AlZ-0008Ls-FI for qemu-devel@nongnu.org; Wed, 13 Mar 2019 16:46:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h4AlY-0000xu-9n for qemu-devel@nongnu.org; Wed, 13 Mar 2019 16:46:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34818) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h4AlY-0000x7-1H for qemu-devel@nongnu.org; Wed, 13 Mar 2019 16:46:20 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 36214C074132; Wed, 13 Mar 2019 20:46:19 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-121-71.rdu2.redhat.com [10.10.121.71]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3F0E45F9D7; Wed, 13 Mar 2019 20:46:18 +0000 (UTC) From: Cleber Rosa To: qemu-devel@nongnu.org Date: Wed, 13 Mar 2019 16:46:07 -0400 Message-Id: <20190313204611.21041-2-crosa@redhat.com> In-Reply-To: <20190313204611.21041-1-crosa@redhat.com> References: <20190313204611.21041-1-crosa@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 13 Mar 2019 20:46:19 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v5 1/5] Acceptance tests: use relative location for tests X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Samuel Ortiz , Cornelia Huck , Wainer dos Santos Moschetta , Cleber Rosa , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eduardo Habkost Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" An Avocado Test ID[1] is composed by a number of components, but it starts with the Test Name, usually a file system location that was given to the loader. Because the source directory is being given as a prefix to the "tests/acceptance" directory containing the acceptance tests, the test names will needlessly include the directory the user is using to host the QEMU sources (and/or build tree). Let's remove the source dir (or a build dir) from the path given to the test loader. This should give more constant names, and when using result servers and databases, it should give the same test names across executions from different people or from different directories. [1] - https://avocado-framework.readthedocs.io/en/69.0/ReferenceGuide.html#= test-id Signed-off-by: Cleber Rosa Reviewed-by: Wainer dos Santos Moschetta --- tests/Makefile.include | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Makefile.include b/tests/Makefile.include index a5719551dd..546c101a14 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -1163,7 +1163,7 @@ check-acceptance: check-venv $(TESTS_RESULTS_DIR) $(call quiet-command, \ $(TESTS_VENV_DIR)/bin/python -m avocado \ --show=3D$(AVOCADO_SHOW) run --job-results-dir=3D$(TESTS_RESUL= TS_DIR) \ - --failfast=3Don $(SRC_PATH)/tests/acceptance, \ + --failfast=3Don tests/acceptance, \ "AVOCADO", "tests/acceptance") =20 # Consolidated targets --=20 2.20.1 From nobody Thu Apr 18 22:24:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1552510090517381.3180341640044; Wed, 13 Mar 2019 13:48:10 -0700 (PDT) Received: from localhost ([127.0.0.1]:50660 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h4AnH-0000ol-9M for importer@patchew.org; Wed, 13 Mar 2019 16:48:07 -0400 Received: from eggs.gnu.org ([209.51.188.92]:47048) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h4Ala-0008Lw-Lz for qemu-devel@nongnu.org; Wed, 13 Mar 2019 16:46:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h4AlZ-0000yv-F3 for qemu-devel@nongnu.org; Wed, 13 Mar 2019 16:46:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54998) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h4AlZ-0000y9-55 for qemu-devel@nongnu.org; Wed, 13 Mar 2019 16:46:21 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 58526307E04C; Wed, 13 Mar 2019 20:46:20 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-121-71.rdu2.redhat.com [10.10.121.71]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6238D5F9D7; Wed, 13 Mar 2019 20:46:19 +0000 (UTC) From: Cleber Rosa To: qemu-devel@nongnu.org Date: Wed, 13 Mar 2019 16:46:08 -0400 Message-Id: <20190313204611.21041-3-crosa@redhat.com> In-Reply-To: <20190313204611.21041-1-crosa@redhat.com> References: <20190313204611.21041-1-crosa@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Wed, 13 Mar 2019 20:46:20 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v5 2/5] Acceptance tests: keep a stable reference to the QEMU build dir X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Samuel Ortiz , Cornelia Huck , Wainer dos Santos Moschetta , Cleber Rosa , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eduardo Habkost Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" This is related to the the differences in in-tree and out-of-tree builds in QEMU. For simplification, means my build directory. Currently, by running a `make check-acceptance` one gets (in tests/acceptance/avocado_qemu/__init__.py): SRC_ROOT_DIR: /tests/acceptance/avocado_qemu/../../.. This in itself is problematic, because after the parent directories are applied, one may be left not with a pointer to the build directory as intended, but with the location of the source tree (assuming they differ). Built binaries, such as qemu-img, are of course not there and can't be found. Given that a Python '__file__' will contain the absolute path to the file backing the module, say: __file__: /tests/acceptance/avocado_qemu/__init__.py | 4 | 3 | 2 | 1 | A solution is to not "evaluate" the third parent dir (marked as 4 here) because that ends up following the "tests" directory symlink to the source tree. In fact, there's no need to keep or evaluate any of the parent directories, we can just drop the rightmost 4 components, and we'll keep a stable reference to the build directory (with no symlink being followed). This works for either a dedicated build directory or also a combined source and build tree. Signed-off-by: Cleber Rosa Reviewed-by: Wainer dos Santos Moschetta --- tests/acceptance/avocado_qemu/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/a= vocado_qemu/__init__.py index a66ec72daa..7b5d828584 100644 --- a/tests/acceptance/avocado_qemu/__init__.py +++ b/tests/acceptance/avocado_qemu/__init__.py @@ -14,7 +14,7 @@ import uuid =20 import avocado =20 -SRC_ROOT_DIR =3D os.path.join(os.path.dirname(__file__), '..', '..', '..') +SRC_ROOT_DIR =3D os.path.dirname(os.path.dirname(os.path.dirname(os.path.d= irname(__file__)))) sys.path.append(os.path.join(SRC_ROOT_DIR, 'python')) =20 from qemu import QEMUMachine --=20 2.20.1 From nobody Thu Apr 18 22:24:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1552510306861446.08077500144793; Wed, 13 Mar 2019 13:51:46 -0700 (PDT) Received: from localhost ([127.0.0.1]:50724 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h4Aqf-0003Zu-UF for importer@patchew.org; Wed, 13 Mar 2019 16:51:37 -0400 Received: from eggs.gnu.org ([209.51.188.92]:47064) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h4Alb-0008M8-QE for qemu-devel@nongnu.org; Wed, 13 Mar 2019 16:46:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h4Ala-000103-Gn for qemu-devel@nongnu.org; Wed, 13 Mar 2019 16:46:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47714) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h4Ala-0000zF-85 for qemu-devel@nongnu.org; Wed, 13 Mar 2019 16:46:22 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7A8C73067201; Wed, 13 Mar 2019 20:46:21 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-121-71.rdu2.redhat.com [10.10.121.71]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 83EB95F9D7; Wed, 13 Mar 2019 20:46:20 +0000 (UTC) From: Cleber Rosa To: qemu-devel@nongnu.org Date: Wed, 13 Mar 2019 16:46:09 -0400 Message-Id: <20190313204611.21041-4-crosa@redhat.com> In-Reply-To: <20190313204611.21041-1-crosa@redhat.com> References: <20190313204611.21041-1-crosa@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Wed, 13 Mar 2019 20:46:21 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v5 3/5] Acceptance tests: add the build directory to the system PATH X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Samuel Ortiz , Cornelia Huck , Wainer dos Santos Moschetta , Cleber Rosa , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eduardo Habkost Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" So that when binaries such as qemu-img are searched for, those in the build tree will be favored. As a clarification, SRC_ROOT_DIR is dependent on the location from where tests are executed, so they are equal to the build directory if one is being used. The original motivation is that Avocado libraries such as avocado.utils.vmimage.get() may use the matching binaries, but it may also apply to any other binary that test code may eventually attempt to execute. Signed-off-by: Cleber Rosa Reviewed-by: Wainer dos Santos Moschetta --- tests/acceptance/avocado_qemu/__init__.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/a= vocado_qemu/__init__.py index 7b5d828584..a91e1202b8 100644 --- a/tests/acceptance/avocado_qemu/__init__.py +++ b/tests/acceptance/avocado_qemu/__init__.py @@ -42,6 +42,12 @@ def pick_default_qemu_bin(): =20 class Test(avocado.Test): def setUp(self): + # Some utility code uses binaries from the system's PATH. For + # instance, avocado.utils.vmimage.get() uses qemu-img, to + # create a snapshot image. This is a transparent way of + # making sure those utilities find and use binaries on the + # build tree by default. + os.environ['PATH'] =3D '%s:%s' % (SRC_ROOT_DIR, os.environ['PATH']) self._vms =3D {} self.qemu_bin =3D self.params.get('qemu_bin', default=3Dpick_default_qemu_bin()) --=20 2.20.1 From nobody Thu Apr 18 22:24:06 2024 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1552510228076368.07687148918524; Wed, 13 Mar 2019 13:50:28 -0700 (PDT) Received: from localhost ([127.0.0.1]:50676 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h4ApF-0002OQ-VJ for importer@patchew.org; Wed, 13 Mar 2019 16:50:10 -0400 Received: from eggs.gnu.org ([209.51.188.92]:47076) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h4Ald-0008NL-0n for qemu-devel@nongnu.org; Wed, 13 Mar 2019 16:46:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h4Alb-00010s-Kn for qemu-devel@nongnu.org; Wed, 13 Mar 2019 16:46:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34860) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h4Alb-00010J-Ct for qemu-devel@nongnu.org; Wed, 13 Mar 2019 16:46:23 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9F268C049E24; Wed, 13 Mar 2019 20:46:22 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-121-71.rdu2.redhat.com [10.10.121.71]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A7F815C57A; Wed, 13 Mar 2019 20:46:21 +0000 (UTC) From: Cleber Rosa To: qemu-devel@nongnu.org Date: Wed, 13 Mar 2019 16:46:10 -0400 Message-Id: <20190313204611.21041-5-crosa@redhat.com> In-Reply-To: <20190313204611.21041-1-crosa@redhat.com> References: <20190313204611.21041-1-crosa@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 13 Mar 2019 20:46:22 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v5 4/5] Acceptance tests: depend on qemu-img X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Samuel Ortiz , Cornelia Huck , Wainer dos Santos Moschetta , Cleber Rosa , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eduardo Habkost Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Tests using the avocado.utils.vmimage library make use of qemu-img, and because it makes sense to use the version matching the rest of the source code, let's make sure it gets built. Its selection, instead of a possible qemu-img binary installed system wide, is already dealt with by the change that adds the build dir to the PATH during the test execution. This is based on the same work for qemu-iotests, and suggested by its author: - https://lists.gnu.org/archive/html/qemu-devel/2019-02/msg00951.html CC: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Cleber Rosa Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Wainer dos Santos Moschetta --- tests/Makefile.include | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Makefile.include b/tests/Makefile.include index 546c101a14..77d71086f3 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -1159,7 +1159,7 @@ $(TESTS_RESULTS_DIR): =20 check-venv: $(TESTS_VENV_DIR) =20 -check-acceptance: check-venv $(TESTS_RESULTS_DIR) +check-acceptance: check-venv $(TESTS_RESULTS_DIR) qemu-img$(EXESUF) $(call quiet-command, \ $(TESTS_VENV_DIR)/bin/python -m avocado \ --show=3D$(AVOCADO_SHOW) run --job-results-dir=3D$(TESTS_RESUL= TS_DIR) \ --=20 2.20.1 From nobody Thu Apr 18 22:24:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1552510095938233.90225172823273; Wed, 13 Mar 2019 13:48:15 -0700 (PDT) Received: from localhost ([127.0.0.1]:50662 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h4AnM-0000ti-VY for importer@patchew.org; Wed, 13 Mar 2019 16:48:13 -0400 Received: from eggs.gnu.org ([209.51.188.92]:47091) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h4Ale-0008OH-3Q for qemu-devel@nongnu.org; Wed, 13 Mar 2019 16:46:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h4Alc-00011y-TQ for qemu-devel@nongnu.org; Wed, 13 Mar 2019 16:46:26 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53626) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h4Alc-00011J-GO for qemu-devel@nongnu.org; Wed, 13 Mar 2019 16:46:24 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BF58CF95E1; Wed, 13 Mar 2019 20:46:23 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-121-71.rdu2.redhat.com [10.10.121.71]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C9D135C57A; Wed, 13 Mar 2019 20:46:22 +0000 (UTC) From: Cleber Rosa To: qemu-devel@nongnu.org Date: Wed, 13 Mar 2019 16:46:11 -0400 Message-Id: <20190313204611.21041-6-crosa@redhat.com> In-Reply-To: <20190313204611.21041-1-crosa@redhat.com> References: <20190313204611.21041-1-crosa@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 13 Mar 2019 20:46:23 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v5 5/5] Add "boot_linux" acceptance test for x86_64 and pc machine type X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Samuel Ortiz , Cornelia Huck , Wainer dos Santos Moschetta , Cleber Rosa , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eduardo Habkost Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" This acceptance test, validates that a full blown Linux guest can successfully boot in QEMU. In this specific case, the guest chosen is Fedora version 29. The method for checking the successful boot is based on "cloudinit" and its "phone home" feature. The guest is given an ISO image with the location of the phone home server, and the information to post (the instance ID). Upon receiving the correct information, from the guest, the test is considered to have PASSed. This test is currently limited to user mode networking only, and instructs the guest to connect to the "router" address that is hard coded in QEMU. To create the cloudinit ISO image that will be used to configure the guest, the pycdlib library is also required and has been added as requirement to the virtual environment created by "check-venv". Signed-off-by: Cleber Rosa Reviewed-by: Wainer dos Santos Moschetta --- tests/acceptance/boot_linux.py | 58 ++++++++++++++++++++++++++++++++++ tests/requirements.txt | 1 + 2 files changed, 59 insertions(+) create mode 100644 tests/acceptance/boot_linux.py diff --git a/tests/acceptance/boot_linux.py b/tests/acceptance/boot_linux.py new file mode 100644 index 0000000000..639acf7795 --- /dev/null +++ b/tests/acceptance/boot_linux.py @@ -0,0 +1,58 @@ +# Functional test that boots a complete Linux system via a cloud image +# +# Copyright (c) 2018-2019 Red Hat, Inc. +# +# Author: +# Cleber Rosa +# +# This work is licensed under the terms of the GNU GPL, version 2 or +# later. See the COPYING file in the top-level directory. + +import os + +from avocado_qemu import Test + +from avocado.utils import cloudinit +from avocado.utils import network +from avocado.utils import vmimage + + +class BootLinux(Test): + """ + Boots a Linux system, checking for a successful initialization + """ + + timeout =3D 600 + + def setUp(self): + super(BootLinux, self).setUp() + try: + self.log.info('Downloading and preparing boot image') + self.boot =3D vmimage.get( + 'fedora', arch=3D'x86_64', version=3D'29', + checksum=3D'7109d23215a3911b260a3b9bf3a07aac3436253a', + cache_dir=3Dself.cache_dirs[0], + snapshot_dir=3Dself.workdir) + except: + self.cancel('Failed to download boot image') + + def test_x86_64_pc(self): + """ + :avocado: tags=3Darch:x86_64 + :avocado: tags=3Dmachine:pc + """ + self.vm.set_machine('pc') + self.vm.add_args('-m', '1024') + self.vm.add_args('-drive', 'file=3D%s' % self.boot.path) + + cloudinit_iso =3D os.path.join(self.workdir, 'cloudinit.iso') + phone_home_port =3D network.find_free_port() + cloudinit.iso(cloudinit_iso, self.name, + # QEMU's hard coded usermode router address + phone_home_host=3D'10.0.2.2', + phone_home_port=3Dphone_home_port) + self.vm.add_args('-drive', 'file=3D%s' % cloudinit_iso) + + self.vm.launch() + self.log.info('VM launched, waiting for boot confirmation from gue= st') + cloudinit.wait_for_phone_home(('0.0.0.0', phone_home_port), self.n= ame) diff --git a/tests/requirements.txt b/tests/requirements.txt index 002ded6a22..57213b8b72 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -2,3 +2,4 @@ # in the tests/venv Python virtual environment. For more info, # refer to: https://pip.pypa.io/en/stable/user_guide/#id1 avocado-framework=3D=3D68.0 +pycdlib=3D=3D1.6.0 --=20 2.20.1