* [PATCH v1 1/2] test: test_nvmem: remove "protect" error tests
@ 2025-06-17 13:20 Oleksij Rempel
2025-06-17 13:20 ` [PATCH v1 2/2] sandbox: configs: enable CMD_NVMEM and NVMEM_RMEM Oleksij Rempel
0 siblings, 1 reply; 2+ messages in thread
From: Oleksij Rempel @ 2025-06-17 13:20 UTC (permalink / raw)
To: barebox; +Cc: Oleksij Rempel
With current patch stack we can't pass this tests. To avoid noise,
remove this tests for now.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
test/py/test_nvmem.py | 87 -------------------------------------------
1 file changed, 87 deletions(-)
diff --git a/test/py/test_nvmem.py b/test/py/test_nvmem.py
index fdb3c8eb6022..0eec93d65c4c 100644
--- a/test/py/test_nvmem.py
+++ b/test/py/test_nvmem.py
@@ -827,93 +827,6 @@ def test_nvmem_write_at_start_and_end_exact(barebox, barebox_config,
)
assert ret_mw_past != 0, "mw write past end should fail."
-def test_nvmem_protect_beyond_end_fail(barebox, barebox_config,
- created_nvmem_device_name):
- """
- Tests attempting to protect a range that extends beyond the device's
- boundaries or starts entirely outside. Expects these operations to fail
- with a non-zero return code from the `protect` command.
-
- Manual Reproduction (assuming rmem0 is created, size 1024 bytes):
- 1. Create device: `nvmem -c 1k`
- 2. Case 1 (partially out): `protect /dev/rmem0 0x3f0+32`
- Expected: Command fails, `echo $?` is non-zero. Observe error message.
- 3. Case 2 (fully out): `protect /dev/rmem0 0x400+4`
- Expected: Command fails, `echo $?` is non-zero. Observe error message.
- """
- actual_dev_name = created_nvmem_device_name
- if not actual_dev_name:
- pytest.fail(f"Fixture created_nvmem_device_name returned empty for test_nvmem_protect_beyond_end_fail.")
- dev_path = f"/dev/{actual_dev_name}"
-
- device_size = DEFAULT_DEVICE_SIZE
- # Case 1: Protection starts within bounds but length extends beyond.
- prot_addr1_hex = f"0x{device_size - 16:x}"
- prot_len1_requested = 32
-
- protect_cmd1 = f'protect {dev_path} {prot_addr1_hex}+{prot_len1_requested}'
- stdout_protect1, stderr_protect1, ret1 = barebox.run(protect_cmd1)
-
- assert ret1 != 0, (
- f"Protect partially beyond boundary expected to fail (non-zero return), "
- f"but got {ret1}. Stdout: {stdout_protect1!r}, Stderr: {stderr_protect1!r}"
- )
- # Error message check removed as per user request.
-
- # Case 2: Protection starts entirely outside the device.
- prot_addr2_hex = f"0x{device_size:x}"
- prot_len2 = 4
- protect_cmd2 = f'protect {dev_path} {prot_addr2_hex}+{prot_len2}'
- stdout_protect2, stderr_protect2, ret2 = barebox.run(protect_cmd2)
-
- assert ret2 != 0, (
- f"Protect starting entirely beyond boundary expected to fail (non-zero return), "
- f"but got {ret2}. Stdout: {stdout_protect2!r}, Stderr: {stderr_protect2!r}"
- )
- # Error message check removed as per user request.
-
-
-def test_nvmem_protect_zero_length_noop(barebox, barebox_config,
- created_nvmem_device_name):
- """
- Tests protecting a range with zero length (`protect <dev> <addr>+0`).
- This is expected to be an invalid operation and should fail with a non-zero
- return code. The area should remain writable.
-
- Manual Reproduction (assuming rmem0 is created):
- 1. Create device: `nvmem -c 1k`
- 2. Attempt protect with zero length: `protect /dev/rmem0 0x50+0`
- Expected: Command fails, `echo $?` is non-zero. Observe error message.
- 3. Verify writable: `mw -d /dev/rmem0 -l 0x50 0xCAFED00D` (should succeed)
- 4. Read back: `md -s /dev/rmem0 -l 0x50+4` (should show CAFED00D)
- """
- actual_dev_name = created_nvmem_device_name
- if not actual_dev_name:
- pytest.fail(f"Fixture created_nvmem_device_name returned empty for test_nvmem_protect_zero_length_noop.")
- dev_path = f"/dev/{actual_dev_name}"
-
- addr_hex = "0x50"
- val_hex = "0xCAFED00D"
- protect_cmd = f'protect {dev_path} {addr_hex}+0'
- stdout_prot, stderr_prot, ret_prot = barebox.run(protect_cmd)
-
- assert ret_prot != 0, "Protect with zero length should now fail (return non-zero)."
- # Error message check removed as per user request.
-
- # Since protection should have failed, the area should still be writable.
- try:
- barebox.run_check(
- f'mw -d {dev_path} -l {addr_hex} {val_hex}'
- )
- except Exception as e:
- pytest.fail(f"mw command failed in test_nvmem_protect_zero_length_noop after failed protect: {e}")
-
- stdout_md = barebox.run_check(
- f'md -s {dev_path} -l {addr_hex}+4'
- )
- assert parse_md_long_value(stdout_md) == int(val_hex, 16), \
- "Value should be writable after failed zero-length protect."
-
def test_nvmem_protect_merge_overlapping(barebox, barebox_config,
created_nvmem_device_name):
"""
--
2.39.5
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH v1 2/2] sandbox: configs: enable CMD_NVMEM and NVMEM_RMEM
2025-06-17 13:20 [PATCH v1 1/2] test: test_nvmem: remove "protect" error tests Oleksij Rempel
@ 2025-06-17 13:20 ` Oleksij Rempel
0 siblings, 0 replies; 2+ messages in thread
From: Oleksij Rempel @ 2025-06-17 13:20 UTC (permalink / raw)
To: barebox; +Cc: Oleksij Rempel
This options are needed to active test/py/test_nvmem.py
tests.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
arch/sandbox/configs/sandbox_defconfig | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/sandbox/configs/sandbox_defconfig b/arch/sandbox/configs/sandbox_defconfig
index f8897afa19b1..691b5da0edff 100644
--- a/arch/sandbox/configs/sandbox_defconfig
+++ b/arch/sandbox/configs/sandbox_defconfig
@@ -18,6 +18,7 @@ CONFIG_LONGHELP=y
CONFIG_CMD_IOMEM=y
CONFIG_CMD_IMD=y
CONFIG_CMD_MEMINFO=y
+CONFIG_CMD_NVMEM=y
CONFIG_CMD_POLLER=y
CONFIG_CMD_SLICE=y
CONFIG_CMD_GO=y
@@ -124,6 +125,7 @@ CONFIG_EEPROM_AT24=y
CONFIG_WATCHDOG=y
CONFIG_WATCHDOG_POLLER=y
# CONFIG_PINCTRL is not set
+CONFIG_NVMEM_RMEM=y
CONFIG_RTC_CLASS=y
CONFIG_RTC_DRV_DS1307=y
CONFIG_SYSCON_REBOOT_MODE=y
--
2.39.5
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-06-17 14:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-06-17 13:20 [PATCH v1 1/2] test: test_nvmem: remove "protect" error tests Oleksij Rempel
2025-06-17 13:20 ` [PATCH v1 2/2] sandbox: configs: enable CMD_NVMEM and NVMEM_RMEM Oleksij Rempel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox