[PATCH] fixup! test: Add pytest suite for NVMEM framework

Ahmad Fatoum a.fatoum at pengutronix.de
Tue Jun 24 01:17:12 PDT 2025


If CONFIG_DEBUG_PROBES is enabled, barebox will print an info log
whenever a device is probed. This breaks one test case in the newly
introduced nvmem tests, because running the nvmem command results in two
lines instead of one:

      probe-> rmem1
  rmem1

A better solution might be disabling stderr, but for now, let's just
have the test check all lines that appeared after running the command.

This fixes CI breakage in next.

Cc: Oleksij Rempel <o.rempel at pengutronix.de>
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 test/py/test_nvmem.py | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/test/py/test_nvmem.py b/test/py/test_nvmem.py
index 0eec93d65c4c..6070877a6868 100644
--- a/test/py/test_nvmem.py
+++ b/test/py/test_nvmem.py
@@ -257,13 +257,7 @@ def test_nvmem_create_dynamic_device_with_var(barebox, barebox_config):
 
     stdout_compound_raw = barebox.run_check(compound_cmd)
 
-    actual_dev_name_in_var = stdout_compound_raw[0].strip() if stdout_compound_raw else "'' (compound cmd gave no stdout lines)"
-
-    assert actual_dev_name_in_var == expected_dev_name_in_var, (
-        f"Environment variable {var_to_set_in_barebox} (from compound cmd) was "
-        f"'{actual_dev_name_in_var}', expected "
-        f"'{expected_dev_name_in_var}'"
-    )
+    assert expected_dev_name_in_var in stdout_compound_raw
 
     # Verify the device is listed by `nvmem`
     stdout_list_a, _, returncode = barebox.run('nvmem')
@@ -271,7 +265,7 @@ def test_nvmem_create_dynamic_device_with_var(barebox, barebox_config):
 
     # The 'nvmem' list might show "rmemX0" while the var stores "rmemX".
     # The pattern checks for this.
-    list_pattern_check = actual_dev_name_in_var
+    list_pattern_check = expected_dev_name_in_var
     pattern = re.compile(f"^{re.escape(list_pattern_check)}0?$")
     assert any(pattern.match(line.strip()) for line in stdout_list_a), (
         f"Device corresponding to '{list_pattern_check}' (pattern: '{pattern.pattern}') "
-- 
2.39.5




More information about the barebox mailing list