mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Oleksij Rempel <o.rempel@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Oleksij Rempel <o.rempel@pengutronix.de>
Subject: [PATCH v1 1/2] test: test_nvmem: remove "protect" error tests
Date: Tue, 17 Jun 2025 15:20:22 +0200	[thread overview]
Message-ID: <20250617132023.2081589-1-o.rempel@pengutronix.de> (raw)

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




             reply	other threads:[~2025-06-17 13:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-17 13:20 Oleksij Rempel [this message]
2025-06-17 13:20 ` [PATCH v1 2/2] sandbox: configs: enable CMD_NVMEM and NVMEM_RMEM Oleksij Rempel

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=20250617132023.2081589-1-o.rempel@pengutronix.de \
    --to=o.rempel@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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