From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id AF3CEA00C4; Mon, 14 Nov 2022 17:56:03 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 49F8B42D59; Mon, 14 Nov 2022 17:54:57 +0100 (CET) Received: from lb.pantheon.sk (lb.pantheon.sk [46.229.239.20]) by mails.dpdk.org (Postfix) with ESMTP id 1B60442D44 for ; Mon, 14 Nov 2022 17:54:54 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by lb.pantheon.sk (Postfix) with ESMTP id 6DD67243CCC; Mon, 14 Nov 2022 17:54:53 +0100 (CET) X-Virus-Scanned: amavisd-new at siecit.sk Received: from lb.pantheon.sk ([127.0.0.1]) by localhost (lb.pantheon.sk [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id sZGmlLkky3bw; Mon, 14 Nov 2022 17:54:52 +0100 (CET) Received: from entguard.lab.pantheon.local (unknown [46.229.239.141]) by lb.pantheon.sk (Postfix) with ESMTP id E600C1703B8; Mon, 14 Nov 2022 17:54:44 +0100 (CET) From: =?UTF-8?q?Juraj=20Linke=C5=A1?= To: thomas@monjalon.net, Honnappa.Nagarahalli@arm.com, ohilyard@iol.unh.edu, lijuan.tu@intel.com, bruce.richardson@intel.com Cc: dev@dpdk.org, =?UTF-8?q?Juraj=20Linke=C5=A1?= Subject: [RFC PATCH v2 10/10] dts: add hello world testsuite Date: Mon, 14 Nov 2022 16:54:38 +0000 Message-Id: <20221114165438.1133783-11-juraj.linkes@pantheon.tech> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221114165438.1133783-1-juraj.linkes@pantheon.tech> References: <20220824162454.394285-1-juraj.linkes@pantheon.tech> <20221114165438.1133783-1-juraj.linkes@pantheon.tech> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 testsuite implements the testcases defined in the corresponding test plan. Signed-off-by: Juraj Linkeš --- dts/framework/remote_session/os/os_session.py | 16 +++++- dts/framework/testbed_model/__init__.py | 1 + dts/framework/testbed_model/node/sut_node.py | 11 ++++ dts/tests/TestSuite_hello_world.py | 53 +++++++++++++++++++ 4 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 dts/tests/TestSuite_hello_world.py diff --git a/dts/framework/remote_session/os/os_session.py b/dts/framework/remote_session/os/os_session.py index f84f3ce63c..1548e3c6c8 100644 --- a/dts/framework/remote_session/os/os_session.py +++ b/dts/framework/remote_session/os/os_session.py @@ -9,7 +9,7 @@ from framework.config import CPU, Architecture, NodeConfiguration from framework.logger import DTSLOG from framework.remote_session.factory import create_remote_session -from framework.remote_session.remote_session import RemoteSession +from framework.remote_session.remote_session import CommandResult, RemoteSession from framework.settings import SETTINGS from framework.utils import EnvVarsDict @@ -49,6 +49,20 @@ def is_alive(self) -> bool: """ return self.remote_session.is_alive() + def send_command( + self, + command: str, + timeout: float, + verify: bool = False, + env: EnvVarsDict | None = None, + ) -> CommandResult: + """ + An all-purpose API in case the command to be executed is already + OS-agnostic, such as when the path to the executed command has been + constructed beforehand. + """ + return self.remote_session.send_command(command, timeout, verify, env) + @abstractmethod def guess_dpdk_remote_dir(self, remote_dir) -> PurePath: """ diff --git a/dts/framework/testbed_model/__init__.py b/dts/framework/testbed_model/__init__.py index 13c29c59c8..0a4862d7d6 100644 --- a/dts/framework/testbed_model/__init__.py +++ b/dts/framework/testbed_model/__init__.py @@ -8,4 +8,5 @@ # pylama:ignore=W0611 +from .hw import CPUAmount, CPUAmountFilter, CPUListFilter, CPUList from .node import Node, SutNode diff --git a/dts/framework/testbed_model/node/sut_node.py b/dts/framework/testbed_model/node/sut_node.py index ff3be845b4..d56f7467ba 100644 --- a/dts/framework/testbed_model/node/sut_node.py +++ b/dts/framework/testbed_model/node/sut_node.py @@ -9,6 +9,7 @@ from framework.config import CPU, BuildTargetConfiguration, CPUList, NodeConfiguration from framework.remote_session import OSSession +from framework.remote_session.remote_session import CommandResult from framework.settings import SETTINGS from framework.testbed_model.hw import CPUAmount, CPUListFilter from framework.utils import EnvVarsDict, skip_setup @@ -224,6 +225,16 @@ def create_eal_parameters( return eal_str + def run_dpdk_app( + self, app_path: PurePath, eal_args: str, timeout: float = 30 + ) -> CommandResult: + """ + Run DPDK application on the remote node. + """ + return self.main_session.send_command( + f"{app_path} {eal_args}", timeout, verify=True + ) + class _EalParameter(object): def __init__( diff --git a/dts/tests/TestSuite_hello_world.py b/dts/tests/TestSuite_hello_world.py new file mode 100644 index 0000000000..d3661bb243 --- /dev/null +++ b/dts/tests/TestSuite_hello_world.py @@ -0,0 +1,53 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2014 Intel Corporation + +""" +DPDK Test suite. +Test HelloWorld example. +""" + +from framework.test_case import TestCase +from framework.testbed_model import CPUAmount, CPUAmountFilter, CPUList + + +class TestHelloWorld(TestCase): + def set_up_all(self): + """ + Run at the start of each test suite. + hello_world Prerequisites: + helloworld build pass + """ + self.app_helloworld_path = self.sut_node.build_dpdk_app("helloworld") + + def test_hello_world_single_core(self): + """ + Run hello world on single lcores + Only received hello message from core0 + """ + + # get the mask for the first core + cpu_amount = CPUAmount(1, 1, 1) + cores = CPUAmountFilter(self.sut_node.cpus, cpu_amount).filter() + eal_para = self.sut_node.create_eal_parameters(core_filter_specifier=cpu_amount) + result = self.sut_node.run_dpdk_app(self.app_helloworld_path, eal_para) + self.verify( + f"hello from core {str(cores[0]) in result.stdout}", + f"EAL not started on core{cores[0]}", + ) + + def test_hello_world_all_cores(self): + """ + Run hello world on all lcores + Received hello message from all lcores + """ + + # get the maximum logical core number + eal_para = self.sut_node.create_eal_parameters( + core_filter_specifier=CPUList(self.sut_node.cpus) + ) + result = self.sut_node.run_dpdk_app(self.app_helloworld_path, eal_para, 50) + for core in self.sut_node.cpus: + self.verify( + f"hello from core {str(core) in result.stdout}", + f"EAL not started on core{core}", + ) -- 2.30.2