Hi Ilias,

On Mon, 26 May 2025 at 10:40, Ilias Apalodimas
<ilias.apalodi...@linaro.org> wrote:
>
> Hi Simon,
>
> On Sat May 24, 2025 at 4:06 PM EEST, Simon Glass wrote:
> > Some of the Python tests are a pain because they don't reset the TPM
> > state before each test. Driver model tests do this, so convert the
> > tests to C.
> >
> > This means that these tests won't run on real hardware, but we have
> > tests which do TPM init, so there is still enough coverage.
> >
>
> What's needed to run DM tests on real hardware?
>
> We have full coverage. The auto start command, which is not removed from the
> python tests, will run the selftest command so I think overall this is ok.

Yes, auto-start is good enough for most cases, so long as we are not
testing 'tpm init' or requiring a clean tpm state.  The
test_tpm2_pcr_read() test expects that the TPM has been reset. We
handle this at present by resetting the board after (before?) the
tests run.

For sandbox, I would like (with future work) the test system to do
that reset, in state_reset_for_test() so that we don't need to reset
U-Boot. That is how other sandbox tests work.

Of course, there are various things that are not reset in that
function, nor in test_pre/post_run(). But that's the direction I'd
like to head.

>
> > Rename and update the Python tpm_init test to use 'tpm autostart',
> > since this deals with starting up ready for the tests below.
>
> may 'since this fully initializes the TPM and performs the self tests'?
>
> Other than that it looks good to me.
> I can rewrite the commit message on my PR to Tom if you don't want to send a 
> v4.

Yes please.

>
> With the changes above
> Reviewed-by: Ilias Apalodimas <ilias.apalodi...@linaro.org>
>
> Thanks
> /Ilias
> >
> > Signed-off-by: Simon Glass <s...@chromium.org>
> > ---
> >
> > Changes in v3:
> > - Use 'check' instead of 'test' when naming test helpers
> > - Add missing tpm_self_test_full() call
> >
> > Changes in v2:
> > - Keep test_tpm2_continue_self_test()
> >
> >  test/dm/tpm.c              | 77 +++++++++++++++++++++++++++++++++++++-
> >  test/py/tests/test_tpm2.py | 38 +------------------
> >  2 files changed, 76 insertions(+), 39 deletions(-)
> >

Regards,
Simon

Reply via email to