DPDK patches and discussions
 help / color / mirror / Atom feed
From: Luca Vizzarro <luca.vizzarro@arm.com>
To: dev@dpdk.org
Cc: Luca Vizzarro <luca.vizzarro@arm.com>,
	Paul Szczepanek <paul.szczepanek@arm.com>,
	Patrick Robb <probb@iol.unh.edu>
Subject: [PATCH 3/6] dts: add current test suite and cases to context
Date: Fri, 25 Jul 2025 16:11:38 +0100	[thread overview]
Message-ID: <20250725151503.87374-4-luca.vizzarro@arm.com> (raw)
In-Reply-To: <20250725151503.87374-1-luca.vizzarro@arm.com>

Add the current test suite and case to the context, so that they can be
accessed by helper functions, etc.

Signed-off-by: Luca Vizzarro <luca.vizzarro@arm.com>
Reviewed-by: Paul Szczepanek <paul.szczepanek@arm.com>
---
 dts/framework/context.py  | 7 ++++++-
 dts/framework/test_run.py | 2 ++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/dts/framework/context.py b/dts/framework/context.py
index 4360bc8699..b99a5a4a69 100644
--- a/dts/framework/context.py
+++ b/dts/framework/context.py
@@ -5,7 +5,7 @@
 
 import functools
 from dataclasses import MISSING, dataclass, field, fields
-from typing import TYPE_CHECKING, ParamSpec
+from typing import TYPE_CHECKING, ParamSpec, Union
 
 from framework.exception import InternalError
 from framework.remote_session.shell_pool import ShellPool
@@ -16,6 +16,7 @@
 
 if TYPE_CHECKING:
     from framework.remote_session.dpdk import DPDKBuildEnvironment, DPDKRuntimeEnvironment
+    from framework.test_suite import TestCase, TestSuite
     from framework.testbed_model.traffic_generator.traffic_generator import TrafficGenerator
 
 P = ParamSpec("P")
@@ -26,6 +27,8 @@ class LocalContext:
     """Updatable context local to test suites and cases.
 
     Attributes:
+        current_test_suite: The currently running test suite, if any.
+        current_test_case: The currently running test case, if any.
         lcore_filter_specifier: A number of lcores/cores/sockets to use or a list of lcore ids to
             use. The default will select one lcore for each of two cores on one socket, in ascending
             order of core ids.
@@ -37,6 +40,8 @@ class LocalContext:
             and no output is gathered within the timeout, an exception is thrown.
     """
 
+    current_test_suite: Union["TestSuite", None] = None
+    current_test_case: Union[type["TestCase"], None] = None
     lcore_filter_specifier: LogicalCoreCount | LogicalCoreList = field(
         default_factory=LogicalCoreCount
     )
diff --git a/dts/framework/test_run.py b/dts/framework/test_run.py
index 4355aeeb4b..614022e2b6 100644
--- a/dts/framework/test_run.py
+++ b/dts/framework/test_run.py
@@ -406,6 +406,7 @@ def next(self) -> State | None:
                 return self
 
             test_run.ctx.local.reset()
+            test_run.ctx.local.current_test_suite = test_suite
             return TestSuiteSetup(test_run, test_suite, test_suite_result)
         except IndexError:
             # No more test suites. We are done here.
@@ -529,6 +530,7 @@ def next(self) -> State | None:
                 test_case_result.mark_result_as(Result.SKIP, e)
                 return self
 
+            self.test_run.ctx.local.current_test_case = test_case
             return TestCaseSetup(
                 self.test_run,
                 self.test_suite,
-- 
2.43.0


  parent reply	other threads:[~2025-07-25 15:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-25 15:11 [PATCH 0/6] dts: add file management Luca Vizzarro
2025-07-25 15:11 ` [PATCH 1/6] dts: merge RemoteSession class Luca Vizzarro
2025-07-25 15:11 ` [PATCH 2/6] dts: add node retriever by identifier Luca Vizzarro
2025-07-25 15:11 ` Luca Vizzarro [this message]
2025-07-25 15:11 ` [PATCH 4/6] dts: add artifact module Luca Vizzarro
2025-07-25 15:11 ` [PATCH 5/6] dts: make log files into artifacts Luca Vizzarro
2025-07-25 15:11 ` [PATCH 6/6] dts: use artifacts in packet capture and softnic Luca Vizzarro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250725151503.87374-4-luca.vizzarro@arm.com \
    --to=luca.vizzarro@arm.com \
    --cc=dev@dpdk.org \
    --cc=paul.szczepanek@arm.com \
    --cc=probb@iol.unh.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).