[U-Boot] [PATCH v4 2/2] test/py: add test for whitelist of variables while importing environment
Quentin Schulz
quentin.schulz at bootlin.com
Fri Jun 8 09:28:00 UTC 2018
Hi Stephen,
On Thu, Jun 07, 2018 at 05:21:19PM -0600, Stephen Warren wrote:
> On 06/04/2018 03:47 AM, Quentin Schulz wrote:
> > This tests that the importing of an environment with a specified
> > whitelist works as intended.
> >
> > If there are variables passed as parameter to the env import command,
> > those only should be imported in the current environment.
> >
> > For each variable passed as parameter, 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
> > passed as parameter), after importing exported env, foo shall be empty,
> >
> > Any variable not passed as parameter should be left untouched.
> >
> > Two other tests are made to test that size cannot be '-' if the checksum
> > protection is enabled.
>
> Reviewed-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_checksum_no_size(state_test_env):
> > + """Test that omitted ('-') size parameter with checksum validation fails the
> > + env import function.
> > + """
> > + c = state_test_env.u_boot_console
> > + ram_base = u_boot_utils.find_ram_base(state_test_env.u_boot_console)
> > + addr = '%08x' % ram_base
> > +
> > + with c.disable_check('error_notification'):
> > + response = c.run_command('env import -c %s -' % addr)
> > + assert(response == '## Error: external checksum format must pass size')
>
> I could imagine all kinds of other useful tests here, e.g. completely
> missing the size parameter rather than passing it explicitly as - for
> example. But we can add that later if need be.
Indeed. There are a lot of tests to be added to the sandbox for
environment handling. In this patch I focused on what I actually changed
rather than the environment handling as a whole.
That was the idea behind it. Let's get the feature merged with its tests
and then work separately on other tests in sandbox.
Thanks,
Quentin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180608/1f47bd18/attachment.sig>
More information about the U-Boot
mailing list