From patchwork Tue Apr 23 09:12:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Juraj_Linke=C5=A1?= X-Patchwork-Id: 139637 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1E5AE43EE8; Tue, 23 Apr 2024 11:13:02 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1F93040ED0; Tue, 23 Apr 2024 11:12:58 +0200 (CEST) Received: from mail-ed1-f45.google.com (mail-ed1-f45.google.com [209.85.208.45]) by mails.dpdk.org (Postfix) with ESMTP id 5838940E96 for ; Tue, 23 Apr 2024 11:12:55 +0200 (CEST) Received: by mail-ed1-f45.google.com with SMTP id 4fb4d7f45d1cf-57222fc625aso187186a12.3 for ; Tue, 23 Apr 2024 02:12:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pantheon.tech; s=google; t=1713863575; x=1714468375; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=JuzaMgheYjBzBqTWpCKrjQLAXSyUcU+mZIEr5lfmx7Y=; b=FF/k/juVkeY1CKllkFHDHKylXOnWATIVcn8oR+3Na9LuahII6H2JMQ4A2qS2YfgAbM klp2CczV0rMJ6CpOsd8f8oA7g3ndv1X4qqWVkZ5DBoUyiwnRgal5oPV87BZbidm7kXBk pIOd1GSAM7GhcxLtfNY1cdkETfxT1ld5/vhKwOt5rtr2TjRpYlTsi3BQYOsQxWx4o1O3 BIWuPq/ROkosql84vbYIAScBvkpqj7PJ2/rSk4w9nJYgrcydhKTzY6tVHvAv3VNQSh5w Nv4PjJRp/UrSbz8QRCcuIY8982AlbJt3DqMCSqjgYjwbVggUzsAskE+YVjxf+F8eq+SU yiww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713863575; x=1714468375; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JuzaMgheYjBzBqTWpCKrjQLAXSyUcU+mZIEr5lfmx7Y=; b=nVWeGTKNjAsdnnSWco0+O3awaHuY8On0t344YdniksyfLe2ES2izoPFG+qH50M2xu0 UylknnuLyuo9/6WYm5l/vk79teTGn+QtYfl4LTsvVIueMQo0nxoZ7jtTd5CJsSPfa7kP CfwQpUtliAsZC1hNkTqaSulzTjZQPTVPphgYxVyWZa31TC7amebLBXFsyps+Hn/UVkuM p1k+GuRiNBO7cHL7xDQyyF0aZhHNknb2ozLjRG+ks4mVADiv1jNfJzUzk1X+bKq97SaV PeouMNNOuqZA4pql2+y9FFR+fzhlMo3WFBCrTv/HWfFvrRC0CB5DvtWMJnyJT2Ugioby ZK4w== X-Gm-Message-State: AOJu0Yyn0+3FXZLLNhJMhBj26a3VtCs90Ksxt5xJZckNNmsdW3Nq9trN I5bAPGWb3L/i5gBrVNiIJNOSxWyh8/+E8910tOQYdQBsUJ3AaSLu/L2KTUnS9vA= X-Google-Smtp-Source: AGHT+IGphkBPx6YyFQ17fNlzhTifRYcVLjQtYAPw9yb6N8IP/rwfsgBm8M0tz1CkxWnTlWdg0okjvg== X-Received: by 2002:a50:9b07:0:b0:56b:a03c:4eb with SMTP id o7-20020a509b07000000b0056ba03c04ebmr12589736edi.31.1713863575037; Tue, 23 Apr 2024 02:12:55 -0700 (PDT) Received: from jlinkes-PT-Latitude-5530.pantheon.local (81.89.53.154.host.vnet.sk. [81.89.53.154]) by smtp.gmail.com with ESMTPSA id be12-20020a0564021a2c00b0056bf7f92346sm6440534edb.50.2024.04.23.02.12.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 02:12:54 -0700 (PDT) From: =?utf-8?q?Juraj_Linke=C5=A1?= To: thomas@monjalon.net, Honnappa.Nagarahalli@arm.com, jspewock@iol.unh.edu, probb@iol.unh.edu, paul.szczepanek@arm.com, Luca.Vizzarro@arm.com, npratte@iol.unh.edu Cc: dev@dpdk.org, =?utf-8?q?Juraj_Linke=C5=A1?= Subject: [PATCH v1 1/4] dts: add tg node execution setup and teardown Date: Tue, 23 Apr 2024 11:12:49 +0200 Message-Id: <20240423091252.62924-2-juraj.linkes@pantheon.tech> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240423091252.62924-1-juraj.linkes@pantheon.tech> References: <20240423091252.62924-1-juraj.linkes@pantheon.tech> MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org The setup and teardown for the execution stage was meant to be run on the tg node too, but was mistakenly omitted. Fixes: cecfe0aabf58 ("dts: add traffic generator abstractions") Signed-off-by: Juraj Linkeš Reviewed-by: Luca Vizzarro Reviewed-by: Jeremy Spewock --- dts/framework/runner.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dts/framework/runner.py b/dts/framework/runner.py index db8e3ba96b..2f25a3e941 100644 --- a/dts/framework/runner.py +++ b/dts/framework/runner.py @@ -422,6 +422,7 @@ def _run_execution( execution_result.add_sut_info(sut_node.node_info) try: sut_node.set_up_execution(execution) + tg_node.set_up_execution(execution) execution_result.update_setup(Result.PASS) except Exception as e: self._logger.exception("Execution setup failed.") @@ -438,6 +439,7 @@ def _run_execution( try: self._logger.set_stage(DtsStage.execution_teardown) sut_node.tear_down_execution() + tg_node.tear_down_execution() execution_result.update_teardown(Result.PASS) except Exception as e: self._logger.exception("Execution teardown failed.") From patchwork Tue Apr 23 09:12:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Juraj_Linke=C5=A1?= X-Patchwork-Id: 139638 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C1C2E43EE8; Tue, 23 Apr 2024 11:13:08 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 70E3F40ED6; Tue, 23 Apr 2024 11:12:59 +0200 (CEST) Received: from mail-lj1-f180.google.com (mail-lj1-f180.google.com [209.85.208.180]) by mails.dpdk.org (Postfix) with ESMTP id B4F4E40E96 for ; Tue, 23 Apr 2024 11:12:56 +0200 (CEST) Received: by mail-lj1-f180.google.com with SMTP id 38308e7fff4ca-2dd6c160eaaso25436361fa.1 for ; Tue, 23 Apr 2024 02:12:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pantheon.tech; s=google; t=1713863576; x=1714468376; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=POd0GSb2K63XKJkciMVY1iQ21SV6WsWHfpk4iSkhhL4=; b=hFdrA8kEzZoc+602wTT4X6KWBq4jzYp++2Qtp94R+YD20V5CUM36YZ59gVJu2E+Ey4 jUON5aW47SEsWrDoSypbK2S57NH5sgRpPagtgfInHWbZs2ec/4qcd6wihOf3ExTDf8nP yBFVKrLX7UumbtVD2ad/X0NLM3yyP6nwDD7FMCPFHIpr9xIPoZ80+NpcPCRHx1DXJtu4 drWCPpjCPntW6XsCVBeu03bG/65nniWugE+57vHJWNetFNmHrxlDyp7G7es+zqknLWgu 1Q1A9BcZb1wsyglOzjGC/jq5Ac9N8kmgWX4608s6bWJ+t1nOBN8zaEihDeLiZTwimhqW r5BQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713863576; x=1714468376; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=POd0GSb2K63XKJkciMVY1iQ21SV6WsWHfpk4iSkhhL4=; b=cx7aH44baKNg3zgYYBoZrZHHNGawuocjRxdWaSb++9HGdn+HGah7J4wJAr1ItUqT07 ab+zzqQmhi6oSbgm4VjvEr5GzDh5Tl0X3UAN6al53WMRF6d5q8el+Ge1GYFCx/ld7iFx pvPUnYin4qVTwk4OkX/SJJ8cs9/wX//jF5oG7rdffHrLUS/xhlW8h1B1ytbls8IuJRxT lPjx8NM8VclVX/8F2ENc1XrkpjtNxYiz7psshq+0773jWBkN/YaNCf+cBeOv2AewqdHZ G3NMIiAQUELWXHBPxpHlVFDzF1ceWrcnDtm42RtviwOmh+axkFBW6DnNh2MHL+HkjPrb pD/g== X-Gm-Message-State: AOJu0YyGl0e7oWGdukiIY4N5W4rgsOX8AUPBfFXxszIC/WZVBerDy3w+ y2SsFf3+x6IYeRhfryMSrTr9JMyY8ytH+dkZ5BDWQRLZsOJYYoXsDYki5bDlnV4= X-Google-Smtp-Source: AGHT+IGCI8A49iSIq68CiyLKMVQRF2pPweaUoAJvkqREUw6fnOYxfpiUtJCMh1IVxX6Dvkwt4GRk5w== X-Received: by 2002:a2e:9607:0:b0:2dc:b91f:81ce with SMTP id v7-20020a2e9607000000b002dcb91f81cemr10526922ljh.10.1713863576183; Tue, 23 Apr 2024 02:12:56 -0700 (PDT) Received: from jlinkes-PT-Latitude-5530.pantheon.local (81.89.53.154.host.vnet.sk. [81.89.53.154]) by smtp.gmail.com with ESMTPSA id be12-20020a0564021a2c00b0056bf7f92346sm6440534edb.50.2024.04.23.02.12.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 02:12:55 -0700 (PDT) From: =?utf-8?q?Juraj_Linke=C5=A1?= To: thomas@monjalon.net, Honnappa.Nagarahalli@arm.com, jspewock@iol.unh.edu, probb@iol.unh.edu, paul.szczepanek@arm.com, Luca.Vizzarro@arm.com, npratte@iol.unh.edu Cc: dev@dpdk.org, =?utf-8?q?Juraj_Linke=C5=A1?= Subject: [PATCH v1 2/4] dts: unify class inheritance from object Date: Tue, 23 Apr 2024 11:12:50 +0200 Message-Id: <20240423091252.62924-3-juraj.linkes@pantheon.tech> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240423091252.62924-1-juraj.linkes@pantheon.tech> References: <20240423091252.62924-1-juraj.linkes@pantheon.tech> MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org There are two ways we specify that a class inherits from object - implicitly and explicitly. There's no need to explicitly specify that a class inherits from object and is in fact mostly a remnant from Python2. Leaving it implicit is the standard in Python3 and offers a small bonus in cases where something would assign something else to the builtin object variable. Signed-off-by: Juraj Linkeš Reviewed-by: Luca Vizzarro Reviewed-by: Patrick Robb Reviewed-by: Jeremy Spewock --- dts/framework/remote_session/testpmd_shell.py | 2 +- dts/framework/test_result.py | 4 ++-- dts/framework/test_suite.py | 2 +- dts/framework/testbed_model/cpu.py | 4 ++-- dts/framework/testbed_model/sut_node.py | 2 +- dts/framework/testbed_model/virtual_device.py | 2 +- dts/framework/utils.py | 4 ++-- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/dts/framework/remote_session/testpmd_shell.py b/dts/framework/remote_session/testpmd_shell.py index cb2ab6bd00..9456de941d 100644 --- a/dts/framework/remote_session/testpmd_shell.py +++ b/dts/framework/remote_session/testpmd_shell.py @@ -27,7 +27,7 @@ from .interactive_shell import InteractiveShell -class TestPmdDevice(object): +class TestPmdDevice: """The data of a device that testpmd can recognize. Attributes: diff --git a/dts/framework/test_result.py b/dts/framework/test_result.py index 28f84fd793..83e637c280 100644 --- a/dts/framework/test_result.py +++ b/dts/framework/test_result.py @@ -96,7 +96,7 @@ def __bool__(self) -> bool: return self is self.PASS -class FixtureResult(object): +class FixtureResult: """A record that stores the result of a setup or a teardown. :attr:`~Result.FAIL` is a sensible default since it prevents false positives (which could happen @@ -132,7 +132,7 @@ def __bool__(self) -> bool: return bool(self.result) -class BaseResult(object): +class BaseResult: """Common data and behavior of DTS results. Stores the results of the setup and teardown portions of the corresponding stage. diff --git a/dts/framework/test_suite.py b/dts/framework/test_suite.py index 9c3b516002..7efa0eae44 100644 --- a/dts/framework/test_suite.py +++ b/dts/framework/test_suite.py @@ -27,7 +27,7 @@ from .utils import get_packet_summaries -class TestSuite(object): +class TestSuite: """The base class with building blocks needed by most test cases. * Test suite setup/cleanup methods to override, diff --git a/dts/framework/testbed_model/cpu.py b/dts/framework/testbed_model/cpu.py index 9e33b2825d..a50cf44c19 100644 --- a/dts/framework/testbed_model/cpu.py +++ b/dts/framework/testbed_model/cpu.py @@ -26,7 +26,7 @@ @dataclass(slots=True, frozen=True) -class LogicalCore(object): +class LogicalCore: """Representation of a logical CPU core. A physical core is represented in OS by multiple logical cores (lcores) @@ -50,7 +50,7 @@ def __int__(self) -> int: return self.lcore -class LogicalCoreList(object): +class LogicalCoreList: r"""A unified way to store :class:`LogicalCore`\s. Create a unified format used across the framework and allow the user to use diff --git a/dts/framework/testbed_model/sut_node.py b/dts/framework/testbed_model/sut_node.py index 97aa26d419..10d56eba8d 100644 --- a/dts/framework/testbed_model/sut_node.py +++ b/dts/framework/testbed_model/sut_node.py @@ -34,7 +34,7 @@ from .virtual_device import VirtualDevice -class EalParameters(object): +class EalParameters: """The environment abstraction layer parameters. The string representation can be created by converting the instance to a string. diff --git a/dts/framework/testbed_model/virtual_device.py b/dts/framework/testbed_model/virtual_device.py index e9b5e9c3be..569d67b007 100644 --- a/dts/framework/testbed_model/virtual_device.py +++ b/dts/framework/testbed_model/virtual_device.py @@ -7,7 +7,7 @@ """ -class VirtualDevice(object): +class VirtualDevice: """Base class for virtual devices used by DPDK. Attributes: diff --git a/dts/framework/utils.py b/dts/framework/utils.py index cc5e458cc8..f9ed1b562f 100644 --- a/dts/framework/utils.py +++ b/dts/framework/utils.py @@ -82,7 +82,7 @@ def __str__(self) -> str: return self.name -class MesonArgs(object): +class MesonArgs: """Aggregate the arguments needed to build DPDK.""" _default_library: str @@ -131,7 +131,7 @@ class _TarCompressionFormat(StrEnum): zstd = "zst" -class DPDKGitTarball(object): +class DPDKGitTarball: """Compressed tarball of DPDK from the repository. The class supports the :class:`os.PathLike` protocol, From patchwork Tue Apr 23 09:12:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Juraj_Linke=C5=A1?= X-Patchwork-Id: 139639 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id EC98F43EE8; Tue, 23 Apr 2024 11:13:17 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A391D40EE6; Tue, 23 Apr 2024 11:13:01 +0200 (CEST) Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com [209.85.208.46]) by mails.dpdk.org (Postfix) with ESMTP id B1AAB40E96 for ; Tue, 23 Apr 2024 11:12:57 +0200 (CEST) Received: by mail-ed1-f46.google.com with SMTP id 4fb4d7f45d1cf-572250b7704so153779a12.2 for ; Tue, 23 Apr 2024 02:12:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pantheon.tech; s=google; t=1713863577; x=1714468377; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=zt+cpwojCFJbjCPuJwpMn36SqLh8GxwGPDpi4h0aSQg=; b=C5i3k2Rqqt9YdjtH5Yoc+s8dOl6dbWUQF9e/mP94hjYHzH2IwXwWL+uvb8usXO6ARz 1/ae7TfMNbTo2b7htlzhSZzmZpEp726UMarIMVOPnopo3jgJZkN4k8CTmhJba98HbGX/ GPTkXsaWKdnUyzUppZ2tXtJ+0H2Uzu1auBxqVQqU2zoiRqcAl60rcSnRi62ATp/gmupQ 4OJo/WivP34J6v/Jghu6hyC46u1PLyhMdCKAO/yhChIchMzvr7V8TtGgbeT4+Pyve/UY gw1qBLor+PitD4KpC6vDkOWb7LMdTEONgecwqvkp2z3raoGHMnlAo1tLZiB8XmcOudJW r72Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713863577; x=1714468377; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zt+cpwojCFJbjCPuJwpMn36SqLh8GxwGPDpi4h0aSQg=; b=Mrck1LEWM3bir4rw2jBaZAVU7ekeIWQ8tG31g5GPoDEn7s6DO3UZcLLZRTWbh1buSO 7raFHQpeTHxA5nL24dvaGGO4EkPKLdYU+qm9wrLey6mFIIm8qY9n78h19udao6oXSO2U q8eZnebQTmBTl2q75mkuAjvhcl4i5MzEEQAmKg//Qh+leqpVk8GpCLwMRoiSE35cu9EL vodlP3yaNJlRdUVsijf1478+qi4Ce9xoXFRoLdZshYWAq2xOamTKKTiNjqRaHBrIZxH2 ZoUKfrzhVLiIizSuHlYiPWjsBy7amPnNebQrtaLDxg+zFVCwwrRCY7eBLcNYondF7xsv e6zQ== X-Gm-Message-State: AOJu0YxdsCteTQHEnqZUejAkPnH9PaNW1Xcm3mkoPAt+OAm62DigHVCr wTAKo1DMFJHPW4i313X7yL5sEoSCJCIGfyY9cvBU/Ed0Q/R0EyW5iitM0bspAas= X-Google-Smtp-Source: AGHT+IFDKitDc2B00CyMppJsVm9veakKcNGHmsuZStEuLMFQS4O9WI/bD7u9jXKmCFqPMcLTF6uA0Q== X-Received: by 2002:a50:c31c:0:b0:56c:2ef7:f3e6 with SMTP id a28-20020a50c31c000000b0056c2ef7f3e6mr8794717edb.0.1713863577304; Tue, 23 Apr 2024 02:12:57 -0700 (PDT) Received: from jlinkes-PT-Latitude-5530.pantheon.local (81.89.53.154.host.vnet.sk. [81.89.53.154]) by smtp.gmail.com with ESMTPSA id be12-20020a0564021a2c00b0056bf7f92346sm6440534edb.50.2024.04.23.02.12.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 02:12:56 -0700 (PDT) From: =?utf-8?q?Juraj_Linke=C5=A1?= To: thomas@monjalon.net, Honnappa.Nagarahalli@arm.com, jspewock@iol.unh.edu, probb@iol.unh.edu, paul.szczepanek@arm.com, Luca.Vizzarro@arm.com, npratte@iol.unh.edu Cc: dev@dpdk.org, =?utf-8?q?Juraj_Linke=C5=A1?= Subject: [PATCH v1 3/4] dts: unify super calls Date: Tue, 23 Apr 2024 11:12:51 +0200 Message-Id: <20240423091252.62924-4-juraj.linkes@pantheon.tech> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240423091252.62924-1-juraj.linkes@pantheon.tech> References: <20240423091252.62924-1-juraj.linkes@pantheon.tech> MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org We have two ways of calling super() in the codebase. For single inheritance, there's no benefit in listing the arguments, as the function will do exactly what we need it to do. Signed-off-by: Juraj Linkeš Reviewed-by: Luca Vizzarro Reviewed-by: Patrick Robb Reviewed-by: Jeremy Spewock --- dts/framework/test_result.py | 12 ++++++------ dts/framework/testbed_model/sut_node.py | 2 +- dts/framework/testbed_model/tg_node.py | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/dts/framework/test_result.py b/dts/framework/test_result.py index 83e637c280..0163893adf 100644 --- a/dts/framework/test_result.py +++ b/dts/framework/test_result.py @@ -249,7 +249,7 @@ def __init__(self, logger: DTSLogger): Args: logger: The logger instance the whole result will use. """ - super(DTSResult, self).__init__() + super().__init__() self.dpdk_version = None self._logger = logger self._errors = [] @@ -338,7 +338,7 @@ def __init__(self, execution: ExecutionConfiguration): Args: execution: The execution's test run configuration. """ - super(ExecutionResult, self).__init__() + super().__init__() self._config = execution self._test_suites_with_cases = [] @@ -430,7 +430,7 @@ def __init__( test_suites_with_cases: The test suites with test cases to be run in this build target. build_target: The build target's test run configuration. """ - super(BuildTargetResult, self).__init__() + super().__init__() self.arch = build_target.arch self.os = build_target.os self.cpu = build_target.cpu @@ -491,7 +491,7 @@ def __init__(self, test_suite_with_cases: TestSuiteWithCases): Args: test_suite_with_cases: The test suite with test cases. """ - super(TestSuiteResult, self).__init__() + super().__init__() self.test_suite_name = test_suite_with_cases.test_suite_class.__name__ self._test_suite_with_cases = test_suite_with_cases @@ -534,7 +534,7 @@ def __init__(self, test_case_name: str): Args: test_case_name: The test case's name. """ - super(TestCaseResult, self).__init__() + super().__init__() self.test_case_name = test_case_name def update(self, result: Result, error: Exception | None = None) -> None: @@ -592,7 +592,7 @@ def __init__(self, dpdk_version: str | None): Args: dpdk_version: The version of tested DPDK. """ - super(Statistics, self).__init__() + super().__init__() for result in Result: self[result.name] = 0 self["PASS RATE"] = 0.0 diff --git a/dts/framework/testbed_model/sut_node.py b/dts/framework/testbed_model/sut_node.py index 10d56eba8d..800fbef860 100644 --- a/dts/framework/testbed_model/sut_node.py +++ b/dts/framework/testbed_model/sut_node.py @@ -130,7 +130,7 @@ def __init__(self, node_config: SutNodeConfiguration): Args: node_config: The SUT node's test run configuration. """ - super(SutNode, self).__init__(node_config) + super().__init__(node_config) self._dpdk_prefix_list = [] self._build_target_config = None self._env_vars = {} diff --git a/dts/framework/testbed_model/tg_node.py b/dts/framework/testbed_model/tg_node.py index d3206e87e0..b0126e5e3d 100644 --- a/dts/framework/testbed_model/tg_node.py +++ b/dts/framework/testbed_model/tg_node.py @@ -48,7 +48,7 @@ def __init__(self, node_config: TGNodeConfiguration): Args: node_config: The TG node's test run configuration. """ - super(TGNode, self).__init__(node_config) + super().__init__(node_config) self.traffic_generator = create_traffic_generator(self, node_config.traffic_generator) self._logger.info(f"Created node: {self.name}") @@ -90,4 +90,4 @@ def close(self) -> None: This extends the superclass method with TG cleanup. """ self.traffic_generator.close() - super(TGNode, self).close() + super().close() From patchwork Tue Apr 23 09:12:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Juraj_Linke=C5=A1?= X-Patchwork-Id: 139640 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 25DA243EE8; Tue, 23 Apr 2024 11:13:24 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D280540F16; Tue, 23 Apr 2024 11:13:02 +0200 (CEST) Received: from mail-ed1-f52.google.com (mail-ed1-f52.google.com [209.85.208.52]) by mails.dpdk.org (Postfix) with ESMTP id B68AD40ED6 for ; Tue, 23 Apr 2024 11:12:58 +0200 (CEST) Received: by mail-ed1-f52.google.com with SMTP id 4fb4d7f45d1cf-56e1baf0380so6341177a12.3 for ; Tue, 23 Apr 2024 02:12:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pantheon.tech; s=google; t=1713863578; x=1714468378; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=D8KFfjKjySeDHyHvuEdeBQcDpTwTmqzSHRmB+Cnwggo=; b=vYiEkQ40c3nTjPBSFInb0WTrilEgOhAVwaynXgc2yk0b6Ht9UXORfiAESfyxh7KNdr 94RK9SKdsDSv+Z6IhrOILZS65lbYCrCBLFWMjC814v1/mBhrjWNKRX1k44eQaUL70N7s i8ASM80Cpiaa04VaWRf4fPmWeavnksdEPH3SSzTSNzqUij2ORUL7wb94AxOMSVsWHgyO CiTUXDDtC7KNumbYf7R0dkK1AdbHOhzakHaqOIAyheczxMtuzhQu/d6tLYI5FhJNoinA /GPzNpRohqwbrqawigH/30Lcs/+DxcTwXsocXGf9ZuKIJJ2Crcj0WNegd6OIk87klIrg Ybyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713863578; x=1714468378; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=D8KFfjKjySeDHyHvuEdeBQcDpTwTmqzSHRmB+Cnwggo=; b=LeUj7gA/ruSLkH+nQBUS7UO6iMdFhLRCzMgFp5FPRm9R2RHOqMg0fUeadb6wFufRRe 1i56XxyJVi2eR9gzraHZ6fj64zLRpDlbSV6ejgUrWvRBidhJkV1HLRIkc/0+oDCtKeUT 0X1DXwXP9PK6H6CFvKUJfH9r5NRR4AepQw7x/d+u8aKzL0AsZbj1Y6XUTwbduEPJcR6g g3/heHnTJjZ+b0Mh2LOygwjfImO3sOAi2AsQemWSOGv8DZ2RToM3qf8Do8iHXyzvcwgl uxF2QA4nQW/DuASwHiQVf6Ypv3ThBdo7A+Jud8qo6i3624oQ6mg0hMjsTQOkhoETQ7Zd aL0w== X-Gm-Message-State: AOJu0YxgYaUhmKY0cDRqsWBJnCU7D9DVqJuGJUOJ+5P4RuUlJwv5bZ52 jWbX5Hly9yMmYrgn6StmJHc/fqor1FT+L2UH7auqd8RT7CMVjJu+szE/kkDB1mqgmmrQLl76kxo +iso= X-Google-Smtp-Source: AGHT+IEofA+sGkb+sv4LYoii0OEbQ1PmechdFnInbYx3oh1Tev8MdhcIefsWHs9GUl5R00q6BcYdsA== X-Received: by 2002:a50:d5ce:0:b0:568:bfcd:e895 with SMTP id g14-20020a50d5ce000000b00568bfcde895mr6851427edj.41.1713863578401; Tue, 23 Apr 2024 02:12:58 -0700 (PDT) Received: from jlinkes-PT-Latitude-5530.pantheon.local (81.89.53.154.host.vnet.sk. [81.89.53.154]) by smtp.gmail.com with ESMTPSA id be12-20020a0564021a2c00b0056bf7f92346sm6440534edb.50.2024.04.23.02.12.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 02:12:57 -0700 (PDT) From: =?utf-8?q?Juraj_Linke=C5=A1?= To: thomas@monjalon.net, Honnappa.Nagarahalli@arm.com, jspewock@iol.unh.edu, probb@iol.unh.edu, paul.szczepanek@arm.com, Luca.Vizzarro@arm.com, npratte@iol.unh.edu Cc: dev@dpdk.org, =?utf-8?q?Juraj_Linke=C5=A1?= Subject: [PATCH v1 4/4] dts: refine pre-test setup and teardown steps Date: Tue, 23 Apr 2024 11:12:52 +0200 Message-Id: <20240423091252.62924-5-juraj.linkes@pantheon.tech> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240423091252.62924-1-juraj.linkes@pantheon.tech> References: <20240423091252.62924-1-juraj.linkes@pantheon.tech> MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org The major part is the removal of _set_up_execution() and _tear_down_execution() of Node in lieu of using super() in the superclasses, which simplifies the code while achieving the same thing. The minor changes are the move of virtual devices and build target setup/teardown into SutNode from Node since both are DPDK-related which are only going to run on the SutNode. Signed-off-by: Juraj Linkeš Reviewed-by: Luca Vizzarro Reviewed-by: Jeremy Spewock --- dts/framework/testbed_model/node.py | 65 ++----------------------- dts/framework/testbed_model/sut_node.py | 49 ++++++++++++++----- 2 files changed, 40 insertions(+), 74 deletions(-) diff --git a/dts/framework/testbed_model/node.py b/dts/framework/testbed_model/node.py index 74061f6262..1a98209822 100644 --- a/dts/framework/testbed_model/node.py +++ b/dts/framework/testbed_model/node.py @@ -16,12 +16,7 @@ from ipaddress import IPv4Interface, IPv6Interface from typing import Any, Callable, Type, Union -from framework.config import ( - OS, - BuildTargetConfiguration, - ExecutionConfiguration, - NodeConfiguration, -) +from framework.config import OS, ExecutionConfiguration, NodeConfiguration from framework.exception import ConfigurationError from framework.logger import DTSLogger, get_dts_logger from framework.settings import SETTINGS @@ -36,7 +31,6 @@ from .linux_session import LinuxSession from .os_session import InteractiveShellType, OSSession from .port import Port -from .virtual_device import VirtualDevice class Node(ABC): @@ -55,7 +49,6 @@ class Node(ABC): lcores: The list of logical cores that DTS can use on the node. It's derived from logical cores present on the node and the test run configuration. ports: The ports of this node specified in the test run configuration. - virtual_devices: The virtual devices used on the node. """ main_session: OSSession @@ -65,8 +58,6 @@ class Node(ABC): ports: list[Port] _logger: DTSLogger _other_sessions: list[OSSession] - _execution_config: ExecutionConfiguration - virtual_devices: list[VirtualDevice] def __init__(self, node_config: NodeConfiguration): """Connect to the node and gather info during initialization. @@ -94,7 +85,6 @@ def __init__(self, node_config: NodeConfiguration): ).filter() self._other_sessions = [] - self.virtual_devices = [] self._init_ports() def _init_ports(self) -> None: @@ -106,67 +96,20 @@ def _init_ports(self) -> None: def set_up_execution(self, execution_config: ExecutionConfiguration) -> None: """Execution setup steps. - Configure hugepages and call :meth:`_set_up_execution` where - the rest of the configuration steps (if any) are implemented. + Configure hugepages on all DTS node types. Additional steps can be added by + extending the method in subclasses with the use of super(). Args: execution_config: The execution test run configuration according to which the setup steps will be taken. """ self._setup_hugepages() - self._set_up_execution(execution_config) - self._execution_config = execution_config - for vdev in execution_config.vdevs: - self.virtual_devices.append(VirtualDevice(vdev)) - - def _set_up_execution(self, execution_config: ExecutionConfiguration) -> None: - """Optional additional execution setup steps for subclasses. - - Subclasses should override this if they need to add additional execution setup steps. - """ def tear_down_execution(self) -> None: """Execution teardown steps. There are currently no common execution teardown steps common to all DTS node types. - """ - self.virtual_devices = [] - self._tear_down_execution() - - def _tear_down_execution(self) -> None: - """Optional additional execution teardown steps for subclasses. - - Subclasses should override this if they need to add additional execution teardown steps. - """ - - def set_up_build_target(self, build_target_config: BuildTargetConfiguration) -> None: - """Build target setup steps. - - There are currently no common build target setup steps common to all DTS node types. - - Args: - build_target_config: The build target test run configuration according to which - the setup steps will be taken. - """ - self._set_up_build_target(build_target_config) - - def _set_up_build_target(self, build_target_config: BuildTargetConfiguration) -> None: - """Optional additional build target setup steps for subclasses. - - Subclasses should override this if they need to add additional build target setup steps. - """ - - def tear_down_build_target(self) -> None: - """Build target teardown steps. - - There are currently no common build target teardown steps common to all DTS node types. - """ - self._tear_down_build_target() - - def _tear_down_build_target(self) -> None: - """Optional additional build target teardown steps for subclasses. - - Subclasses should override this if they need to add additional build target teardown steps. + Additional steps can be added by extending the method in subclasses with the use of super(). """ def create_session(self, name: str) -> OSSession: diff --git a/dts/framework/testbed_model/sut_node.py b/dts/framework/testbed_model/sut_node.py index 800fbef860..ead6cc5a43 100644 --- a/dts/framework/testbed_model/sut_node.py +++ b/dts/framework/testbed_model/sut_node.py @@ -20,6 +20,7 @@ from framework.config import ( BuildTargetConfiguration, BuildTargetInfo, + ExecutionConfiguration, NodeInfo, SutNodeConfiguration, ) @@ -107,10 +108,12 @@ class SutNode(Node): or the git commit ID, tag ID or tree ID to test. Attributes: - config: The SUT node configuration + config: The SUT node configuration. + virtual_devices: The virtual devices used on the node. """ config: SutNodeConfiguration + virtual_devices: list[VirtualDevice] _dpdk_prefix_list: list[str] _dpdk_timestamp: str _build_target_config: BuildTargetConfiguration | None @@ -131,6 +134,7 @@ def __init__(self, node_config: SutNodeConfiguration): node_config: The SUT node's test run configuration. """ super().__init__(node_config) + self.virtual_devices = [] self._dpdk_prefix_list = [] self._build_target_config = None self._env_vars = {} @@ -228,25 +232,44 @@ def get_build_target_info(self) -> BuildTargetInfo: def _guess_dpdk_remote_dir(self) -> PurePath: return self.main_session.guess_dpdk_remote_dir(self._remote_tmp_dir) - def _set_up_build_target(self, build_target_config: BuildTargetConfiguration) -> None: - """Setup DPDK on the SUT node. + def set_up_execution(self, execution_config: ExecutionConfiguration) -> None: + """Extend the execution setup with vdev config. - Additional build target setup steps on top of those in :class:`Node`. + Args: + execution_config: The execution test run configuration according to which + the setup steps will be taken. + """ + super().set_up_execution(execution_config) + for vdev in execution_config.vdevs: + self.virtual_devices.append(VirtualDevice(vdev)) + + def tear_down_execution(self) -> None: + """Extend the execution teardown with virtual device teardown.""" + super().tear_down_execution() + self.virtual_devices = [] + + def set_up_build_target(self, build_target_config: BuildTargetConfiguration) -> None: + """Set up DPDK the SUT node and bind ports. + + DPDK setup includes setting all internals needed for the build, the copying of DPDK tarball + and then building DPDK. The drivers are bound to those that DPDK needs. + + Args: + build_target_config: The build target test run configuration according to which + the setup steps will be taken. """ - # we want to ensure that dpdk_version and compiler_version is reset for new - # build targets - self._dpdk_version = None - self._compiler_version = None self._configure_build_target(build_target_config) self._copy_dpdk_tarball() self._build_dpdk() self.bind_ports_to_driver() - def _tear_down_build_target(self) -> None: - """Bind ports to the operating system drivers. - - Additional build target teardown steps on top of those in :class:`Node`. - """ + def tear_down_build_target(self) -> None: + """Reset DPDK variables and bind port driver to the OS driver.""" + self._env_vars = {} + self._build_target_config = None + self.__remote_dpdk_dir = None + self._dpdk_version = None + self._compiler_version = None self.bind_ports_to_driver(for_dpdk=False) def _configure_build_target(self, build_target_config: BuildTargetConfiguration) -> None: