[PATCH 2/2] test: report used Labgrid environment and build dir

Ahmad Fatoum a.fatoum at pengutronix.de
Mon Feb 16 00:39:02 PST 2026


We have custom logic for populating LG_ENV and LG_BUILDDIR if they
are not set. Let's print out this information at start to help avoid
surprises.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 conftest.py | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/conftest.py b/conftest.py
index 40c93d2f0473..8c76f8ddf3cf 100644
--- a/conftest.py
+++ b/conftest.py
@@ -76,6 +76,9 @@ def guess_lg_env():
     return None
 
 
+lg_env = lg_builddir = None
+
+
 def pytest_configure(config):
     if 'LG_BUILDDIR' not in os.environ:
         if 'KBUILD_OUTPUT' in os.environ:
@@ -88,6 +91,10 @@ def pytest_configure(config):
     if os.environ['LG_BUILDDIR'] is not None:
         os.environ['LG_BUILDDIR'] = os.path.realpath(os.environ['LG_BUILDDIR'])
 
+    global lg_env
+    global lg_builddir
+
+    lg_builddir = os.environ['LG_BUILDDIR']
     lg_env = config.option.lg_env
     if lg_env is None:
         lg_env = os.environ.get('LG_ENV')
@@ -96,6 +103,15 @@ def pytest_configure(config):
             os.environ['LG_ENV'] = lg_env
 
 
+def pytest_report_header(config):
+    report = []
+    if lg_builddir is not None:
+        report += [f"Build diectory: {lg_builddir}"]
+    if lg_env is not None:
+        report += [f"Labgrid Environment: {lg_env}"]
+    return "\n".join(report)
+
+
 def pytest_addoption(parser):
     def assignment(arg):
         return arg.split('=', 1)
-- 
2.47.3




More information about the barebox mailing list