[Concept,23/24] test/py: Add an add option to skip flat-tree tests

Message ID 20260103011908.149445-24-sjg@u-boot.org
State New
Headers
Series Malloc debugging and test/py improvements |

Commit Message

Simon Glass Jan. 3, 2026, 1:18 a.m. UTC
  From: Simon Glass <simon.glass@canonical.com>

Add a --no-full option to pytest that passes -F to sandbox, skipping
flat-tree tests. This allows running only live-tree tests for faster
iteration during development.

The default is to run full tests (both live and flat tree). Use
--no-full to run only live-tree tests.

Signed-off-by: Simon Glass <simon.glass@canonical.com>
---

 test/py/conftest.py        | 6 ++++++
 test/py/console_sandbox.py | 4 ++++
 2 files changed, 10 insertions(+)
  

Patch

diff --git a/test/py/conftest.py b/test/py/conftest.py
index 0060f3da986..bd0c226276a 100644
--- a/test/py/conftest.py
+++ b/test/py/conftest.py
@@ -102,6 +102,10 @@  def pytest_addoption(parser):
                      help='Show info on test timing')
     parser.addoption('-P', '--persist', default=False, action='store_true',
                      help='Persist test artifacts (do not clean up after tests)')
+    parser.addoption('--no-timeout', default=False, action='store_true',
+                     help='Disable console timeout (useful for debugging)')
+    parser.addoption('--no-full', default=False, action='store_true',
+                     help='Skip flat-tree tests (run live-tree only)')
 
 
 def run_build(config, source_dir, build_dir, board_type, log):
@@ -352,6 +356,8 @@  def pytest_configure(config):
     ubconfig.persist = config.getoption('persist')
     ubconfig.role = config.getoption('role')
     ubconfig.allow_exceptions = config.getoption('allow_exceptions')
+    ubconfig.no_timeout = config.getoption('no_timeout')
+    ubconfig.no_full = config.getoption('no_full')
 
     env_vars = (
         'board_type',
diff --git a/test/py/console_sandbox.py b/test/py/console_sandbox.py
index 565dce27e56..3bd109acef5 100644
--- a/test/py/console_sandbox.py
+++ b/test/py/console_sandbox.py
@@ -53,6 +53,10 @@  class ConsoleSandbox(ConsoleBase):
             cmd += ['-d', self.config.dtb]
         cmd += self.sandbox_flags
 
+        # Skip flat-tree tests if --no-full was passed
+        if self.config.no_full:
+            cmd.append('-F')
+
         # Always disable the pager
         cmd.append('-P')