[U-Boot] [PATCH v2 2/2] test/py: add test for whitelist of variables while importing environment
Stephen Warren
swarren at wwwdotorg.org
Fri May 18 16:04:05 UTC 2018
On 05/18/2018 08:45 AM, Quentin Schulz wrote:
> This tests that the importing of an environment with a specified
> whitelist works as intended.
>
> If the variable whitelisted_vars is not set, the env importing should
> fail with a given message.
>
> For each variable separated by spaces in whitelisted_vars, if
> - foo is bar in current env and bar2 in exported env, after importing
> exported env, foo shall be bar2,
> - foo does not exist in current env and foo is bar2 in exported env,
> after importing exported env, foo shall be bar2,
> - foo is bar in current env and does not exist in exported env (but is
> in the whitelisted_vars), after importing exported env, foo shall be
> empty,
>
> Any variable not in whitelisted_vars should be left untouched.
Acked-by: Stephen Warren <swarren at nvidia.com>
> diff --git a/test/py/tests/test_env.py b/test/py/tests/test_env.py
> +def test_env_import_whitelist(state_test_env):
> + state_test_env.u_boot_console.run_command('env import -w %s' % addr)
> +
> + validate_set(state_test_env, "foo1", "bar1")
> + validate_set(state_test_env, "foo2", "bar2")
> + validate_set(state_test_env, "foo3", "bar3")
> + validate_empty(state_test_env, "foo4")
It might make sense to iterate over *all* variables and make sure that
they have the same value before/after the import. But, the current code
seems to cover the basic cases, so it's probably not strictly necessary
to do that.
More information about the U-Boot
mailing list