Hi Heinrich,

On 2026-10-12T14:00:39, Heinrich Schuchardt
<[email protected]> wrote:
> test: env: allow optional date field in ls output assertion
>
> fs_ls_generic() now prints a date between the file size and filename
> when the filesystem sets FS_CAP_DATE (currently FAT and ext4).
>
> Adjust the assert in test_env.py().

test_env.py is a file, not a function, so the brackets are wrong. I
think you mean test_env_ext4(). Please can you also say why the old
string match fails, as in the previous patch: with a date present
there is no longer a run of three spaces between the size and the
name.

>
> Signed-off-by: Heinrich Schuchardt <[email protected]>
>
> test/py/tests/test_env.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

> diff --git a/test/py/tests/test_env.py b/test/py/tests/test_env.py
> @@ -523,7 +523,7 @@ def test_env_ext4(state_test_env):
> -        assert '8192   uboot.env' in response
> +        assert(re.search('8192 .*uboot.env', ''.join(response)))

run_command() returns a string, not a list, so ''.join(response) does
nothing and can be dropped. The rest of this file writes 'assert
re.search(...)' without the outer brackets (see line 197), so please
follow that.

As with patch 7, ' .*' no longer checks the layout. With patch 5 in
place the ext4 file should always have a valid date, so the test can
check for it:

    assert re.search(r'8192 +\d{4}-\d\d-\d\d \d\d:\d\d +uboot\.env', response)

If you want the test to also pass on builds without the date, make the
date group optional with '(...)?'. What do you think?

Regards,
Simon

Reply via email to