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 D30BA45837; Wed, 21 Aug 2024 20:43:46 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 962D542C24; Wed, 21 Aug 2024 20:43:35 +0200 (CEST) Received: from mail-qv1-f41.google.com (mail-qv1-f41.google.com [209.85.219.41]) by mails.dpdk.org (Postfix) with ESMTP id E431342831 for ; Wed, 21 Aug 2024 20:43:33 +0200 (CEST) Received: by mail-qv1-f41.google.com with SMTP id 6a1803df08f44-6bf8a06f06dso2845376d6.0 for ; Wed, 21 Aug 2024 11:43:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1724265813; x=1724870613; 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=Rxms07s99umtKV7niSOI0SugT45gVE2r7u7vB03qjqk=; b=QqYheS6Ne9qo1KqaZI6NgNMc0pxnDaXWzFv5BvzhxajtOAoUg1cYdfMbTSLjMlLeOS YbT5YcwTQl9U5y7rkXrGX7/yR/3wVjwlb0KzSo/gxqhrhQydSkWdN+LCyapfkbDHmW9H pwWZslkNjx2Zv4hchoVE51bkRspA4ss6RPMYA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724265813; x=1724870613; 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=Rxms07s99umtKV7niSOI0SugT45gVE2r7u7vB03qjqk=; b=g/q2IbLUWRptXDG/EcIS+58+KRX5IJcGe6Iaq3KhMoCu/Gve9yc+UW56jZKcxqEiBV V3sTBZHphue9oXeXgFj788VLRsBw0UY2xf/Wxwp0WvddqovlHqZDYWm6uW8oXVsC2s0/ +mRfiD1MrKu8y4CRenjUxeJJ8JpFdX0uWu6VxmsPuEVAngoekzF1pXNTCg5ZPewCDiUO qf6bTOmVeonjGbq6S3z0isM+TBHBHMnnHer1yOWmwP1O/hVqe5ni4N0HSlI/uNQqBJ/U 66ctczsTpPiT6yXCvGGRC4zzcVTyt54P52TxLKOJ47gnrtLMhWbBHRM4N9oXvvtKGdrF LF6A== X-Gm-Message-State: AOJu0YxUsC+VLQkCJmdkMlEbf5X0UalEaXyOLXTduHD/kSBdUm5pU/1H FApjWmnktbz1mjLZemy1OLTCiK/djWDLYThbCjgPbRSOT4AMxvGKUYrWjB8gzuI= X-Google-Smtp-Source: AGHT+IEn5GdOVPFSvIny+Npne0y5PksE8wLncSbbbOCt94UFBeSYg8fmSjPguCzFliwR5wbPqfViaw== X-Received: by 2002:a05:6214:cc7:b0:6bf:6722:aab3 with SMTP id 6a1803df08f44-6c155e1ceccmr23118836d6.5.1724265813216; Wed, 21 Aug 2024 11:43:33 -0700 (PDT) Received: from localhost.unh.edu ([2606:4100:3880:1271:e2f8:4ec3:8bf3:864c]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6bf6fef7079sm64251216d6.126.2024.08.21.11.43.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Aug 2024 11:43:32 -0700 (PDT) From: Nicholas Pratte To: yoan.picchi@foss.arm.com, luca.vizzarro@arm.com, probb@iol.unh.edu, paul.szczepanek@arm.com, Honnappa.Nagarahalli@arm.com, juraj.linkes@pantheon.tech, dmarx@iol.unh.edu, jspewock@iol.unh.edu, alex.chapman@arm.com Cc: dev@dpdk.org, Nicholas Pratte Subject: [PATCH v1 3/3] dts: rework test suite and dts runner to include test_run configs Date: Wed, 21 Aug 2024 14:43:06 -0400 Message-ID: <20240821184305.28028-5-npratte@iol.unh.edu> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240821184305.28028-2-npratte@iol.unh.edu> References: <20240821184305.28028-2-npratte@iol.unh.edu> MIME-Version: 1.0 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 object needs to access the running test run config in order to identify the ports that need to be linked. To do this, DTSRunner needs to be tweaked to accept test run configs to test suites, and the TestSuite constructor needs to be reworked to accept test run configs. Bugzilla ID: 1478 Signed-off-by: Nicholas Pratte --- dts/framework/runner.py | 16 +++++++++++++--- dts/framework/test_suite.py | 33 +++++++++++++++++++++------------ 2 files changed, 34 insertions(+), 15 deletions(-) diff --git a/dts/framework/runner.py b/dts/framework/runner.py index 6b6f6a05f5..a5629c2072 100644 --- a/dts/framework/runner.py +++ b/dts/framework/runner.py @@ -444,6 +444,7 @@ def _run_test_run( tg_node, build_target_config, build_target_result, + test_run_config, test_suites_with_cases, ) @@ -463,6 +464,7 @@ def _run_build_target( tg_node: TGNode, build_target_config: BuildTargetConfiguration, build_target_result: BuildTargetResult, + test_run_config: TestRunConfiguration, test_suites_with_cases: Iterable[TestSuiteWithCases], ) -> None: """Run the given build target. @@ -477,6 +479,7 @@ def _run_build_target( build_target_config: A build target's test run configuration. build_target_result: The build target level result object associated with the current build target. + test_run_config: The current test run configuration to be used by test suites. test_suites_with_cases: The test suites with test cases to run. """ self._logger.set_stage(DtsStage.build_target_setup) @@ -492,7 +495,9 @@ def _run_build_target( build_target_result.update_setup(Result.FAIL, e) else: - self._run_test_suites(sut_node, tg_node, build_target_result, test_suites_with_cases) + self._run_test_suites( + sut_node, tg_node, build_target_result, test_suites_with_cases, test_run_config + ) finally: try: @@ -509,6 +514,7 @@ def _run_test_suites( tg_node: TGNode, build_target_result: BuildTargetResult, test_suites_with_cases: Iterable[TestSuiteWithCases], + test_run_config: TestRunConfiguration, ) -> None: """Run `test_suites_with_cases` with the current build target. @@ -524,12 +530,15 @@ def _run_test_suites( build_target_result: The build target level result object associated with the current build target. test_suites_with_cases: The test suites with test cases to run. + test_run_config: The current test run config running the test suites. """ end_build_target = False for test_suite_with_cases in test_suites_with_cases: test_suite_result = build_target_result.add_test_suite(test_suite_with_cases) try: - self._run_test_suite(sut_node, tg_node, test_suite_result, test_suite_with_cases) + self._run_test_suite( + sut_node, tg_node, test_suite_result, test_run_config, test_suite_with_cases + ) except BlockingTestSuiteError as e: self._logger.exception( f"An error occurred within {test_suite_with_cases.test_suite_class.__name__}. " @@ -546,6 +555,7 @@ def _run_test_suite( sut_node: SutNode, tg_node: TGNode, test_suite_result: TestSuiteResult, + test_run_config: TestRunConfiguration, test_suite_with_cases: TestSuiteWithCases, ) -> None: """Set up, execute and tear down `test_suite_with_cases`. @@ -572,7 +582,7 @@ def _run_test_suite( self._logger.set_stage( DtsStage.test_suite_setup, Path(SETTINGS.output_dir, test_suite_name) ) - test_suite = test_suite_with_cases.test_suite_class(sut_node, tg_node) + test_suite = test_suite_with_cases.test_suite_class(sut_node, tg_node, test_run_config) try: self._logger.info(f"Starting test suite setup: {test_suite_name}") test_suite.set_up_suite() diff --git a/dts/framework/test_suite.py b/dts/framework/test_suite.py index 694b2eba65..fd51796a06 100644 --- a/dts/framework/test_suite.py +++ b/dts/framework/test_suite.py @@ -20,6 +20,7 @@ from scapy.layers.l2 import Ether # type: ignore[import-untyped] from scapy.packet import Packet, Padding # type: ignore[import-untyped] +from framework.config import TestRunConfiguration from framework.testbed_model.port import Port, PortLink from framework.testbed_model.sut_node import SutNode from framework.testbed_model.tg_node import TGNode @@ -64,6 +65,7 @@ class TestSuite: sut_node: SutNode tg_node: TGNode + test_run_config: TestRunConfiguration #: Whether the test suite is blocking. A failure of a blocking test suite #: will block the execution of all subsequent test suites in the current build target. is_blocking: ClassVar[bool] = False @@ -78,11 +80,7 @@ class TestSuite: _tg_ip_address_ingress: Union[IPv4Interface, IPv6Interface] _tg_ip_address_egress: Union[IPv4Interface, IPv6Interface] - def __init__( - self, - sut_node: SutNode, - tg_node: TGNode, - ): + def __init__(self, sut_node: SutNode, tg_node: TGNode, test_run_config: TestRunConfiguration): """Initialize the test suite testbed information and basic configuration. Find links between ports and set up default IP addresses to be used when @@ -91,9 +89,11 @@ def __init__( Args: sut_node: The SUT node where the test suite will run. tg_node: The TG node where the test suite will run. + test_run_config: The test run configuration that the test suite is running in. """ self.sut_node = sut_node self.tg_node = tg_node + self.test_run_config = test_run_config self._logger = get_dts_logger(self.__class__.__name__) self._port_links = [] self._process_links() @@ -112,13 +112,22 @@ def __init__( def _process_links(self) -> None: """Construct links between SUT and TG ports.""" - for sut_port in self.sut_node.ports: - for tg_port in self.tg_node.ports: - if (sut_port.identifier, sut_port.peer) == ( - tg_port.peer, - tg_port.identifier, - ): - self._port_links.append(PortLink(sut_port=sut_port, tg_port=tg_port)) + sut_ports = [] + for port in self.sut_node.ports: + if port.name in [ + sut_port.name for sut_port in self.test_run_config.system_under_test_node.ports + ]: + sut_ports.append(port) + tg_ports = [] + for port in self.tg_node.ports: + if port.name in [ + tg_port.name for tg_port in self.test_run_config.traffic_generator_node.ports + ]: + tg_ports.append(port) + + # Both the TG and SUT nodes will have an equal number of ports. + for i in range(len(sut_ports)): + self._port_links.append(PortLink(sut_ports[i], tg_ports[i])) def set_up_suite(self) -> None: """Set up test fixtures common to all test cases. -- 2.44.0