All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick DELAUNAY <patrick.delaunay@st.com>
To: u-boot@lists.denx.de
Subject: [PATCH v4 4/4] test: env: add test for env info sub-command
Date: Thu, 18 Jun 2020 09:41:58 +0000	[thread overview]
Message-ID: <aad19cd162744215871ae9b52e6d90e4@SFHDAG6NODE3.st.com> (raw)
In-Reply-To: <2306274c-b93c-2934-b4d8-7e803a88a9e8@wwwdotorg.org>

Hi Stephen,

> From: Stephen Warren <swarren@wwwdotorg.org>
> Sent: jeudi 18 juin 2020 00:32
> 
> On 6/16/20 2:01 AM, Patrick DELAUNAY wrote:
> > Hi Stephen,
> >
> >> From: Stephen Warren <swarren@wwwdotorg.org>
> >> Sent: mardi 16 juin 2020 00:09
> >>
> >> On 6/15/20 8:01 AM, Patrick Delaunay wrote:
> >>> Add a pytest for testing the env info sub-command:
> >>>
> >>> test_env_info: test command with several option
> >>>
> >>> test_env_info_quiet: test the result of the sub-command with quiet
> >>> option, '-q' as used for support in shell test; for example:
> >>>   if env info -p -d -q; then env save; fi
> >>
> >>> diff --git a/test/py/tests/test_env.py b/test/py/tests/test_env.py
> >>
> >>> + at pytest.mark.boardspec('sandbox')
> >>> + at pytest.mark.buildconfigspec('cmd_nvedit_info')
> >>> +def test_env_info(state_test_env):
> >>
> >> The body of these tests doesn't look like it tests something that's
> >> specific to sandbox, so I'm not sure why the test function is marked to only run
> on sandbox.
> >> Is it simply because other boards may store the environment
> >> differently and/or have valid saved environment in flash, so the
> >> responses to e.g. "env info" aren't the same everywhere? If so, I
> >> imagine that test_env_info_quiet() doesn't need to be sandbox-only, since
> there's no output in that case.
> >
> > The test is not really sandbox specific but I don't have easy way to
> > know on real board the ENV configuration (for the resut of command env info -p
> -d).
> >
> > In the test, I assume that  at least  CONFIG_ENV_IS_.... is activated
> > (for persistent storage) and if this target is selected in the weak function
> env_get_location.
> > And "env save" as be not be executed (default environment is used).
> >
> > And with quiet option, the test  the environment if is persistent
> > (result of "env -p -q" is 0) or using default ("env -d -q" result is 0).
> >
> > And in the next patch
> > http://patchwork.ozlabs.org/project/uboot/patch/20200616074048.7898-10
> > -patrick.delaunay at st.com/
> >
> > As the command "env erase" is not always supported according he environment
> target.
> >
> > I could test on real hardware but I need to check if I test all the possible result.
> 
> OK, I guess that makes sense for a start.

But I will propose a V5  to check command on real hardware
Just modify test_env_info to check the all possible strings.
 
> For testing on real HW, the typical approach would be to require that the board's
> test configuration define some env__xxx variables that define its capabilities.
> Then, the test can be made to depend on those values, or whether those variables
> are set at all.

For the next steps, I need to thinks about tests because ENV location is not only impacted
by CONFIG_ENV_IS_IN_.... or CONFIG_ENV_IS_NOWHERE 

These defined can be activated simultaneously and env location is detected at run
time: so it is difficult to predict the 'env info' result on real hardware.

On sandbox it is fixed because ENVL_NOWHERE is selected by default.

Patrick

      reply	other threads:[~2020-06-18  9:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-15 14:01 [PATCH v4 0/4] cmd: env: add option for quiet output on env info Patrick Delaunay
2020-06-15 14:01 ` [PATCH v4 1/4] " Patrick Delaunay
2020-06-15 14:01 ` [PATCH v4 2/4] cmd: env: check real location for env info command Patrick Delaunay
2020-06-15 14:01 ` [PATCH v4 3/4] configs: sandbox: Enable sub command 'env info' Patrick Delaunay
2020-06-15 14:01 ` [PATCH v4 4/4] test: env: add test for env info sub-command Patrick Delaunay
2020-06-15 22:09   ` Stephen Warren
2020-06-16  8:01     ` Patrick DELAUNAY
2020-06-17 22:31       ` Stephen Warren
2020-06-18  9:41         ` Patrick DELAUNAY [this message]

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=aad19cd162744215871ae9b52e6d90e4@SFHDAG6NODE3.st.com \
    --to=patrick.delaunay@st.com \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.