All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mattijs Korpershoek <mkorpershoek@kernel.org>
To: Simon Glass <sjg@chromium.org>
Cc: Igor Opaniuk <igor.opaniuk@gmail.com>,
	u-boot@lists.u-boot-project.org,
	Jan Kehren <jan.kehren@emteria.com>,
	Guillaume La Roque <glaroque@baylibre.com>,
	Tom Rini <trini@konsulko.com>, Simon Glass <sjg@chromium.org>,
	Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
Subject: Re: [PATCH v2 10/10] test/py: avb: Fix find() logic when matching response strings
Date: Thu, 22 Oct 2026 14:22:32 +0200	[thread overview]
Message-ID: <xhkdbecdhq60n.fsf@mkorpers-koolstof.csb> (raw)
In-Reply-To: <CAFLszTgWWB_ez_ue6WDToWdCKFAbTbh+5zoyY9mxfj72OyHrDg@mail.gmail.com>

Hi Simon,

Thank you for the review.

On Thu, Oct 22, 2026 at 01:26, Simon Glass <sjg@chromium.org> wrote:

> Hi Mattijs,
>
> On 2026-10-20T09:25:49, Mattijs Korpershoek <mkorpershoek@kernel.org> wrote:
>> test/py: avb: Fix find() logic when matching response strings
>>
>> The AVB test suite runs some avb commands (such as "avb verify") and
>> then parses the console output for success/failure.
>>
>> It does so by using the string.find() function which returns:
>> * -1 when the subsystring does not exist
>
> Typo: 'subsystring' should be 'substring'

Will fix in v3.

>
>> * 0/a positive number when the substring exists
>>
>> For example, here is the output of:
>> $ ./test/py/test.py --bd sandbox --build -k test_avb_verify -s -v
>>
>> Hit any key to stop autoboot: 0
>> => =>  avb init 1
>> => => avb verify
>> get_partition: no MMC device at slot 1
>> get_partition: no MMC device at slot 1
>> avb_slot_verify.c:644: ERROR: boot: Error loading footer.
>> Verification failed, reason: I/O error occurred while trying to load data
>> => PASSED
>> [...]
>>
>>  test/py/tests/test_android/test_avb.py | 12 ++++++------
>>  1 file changed, 6 insertions(+), 6 deletions(-)
>
>> diff --git a/test/py/tests/test_android/test_avb.py b/test/py/tests/test_android/test_avb.py
>> @@ -64,7 +64,7 @@ def test_avb_verify(ubman, avb_device_id):
>> -    assert response.find(success_str)
>> +    assert response.find(success_str) != -1
>
> It would be worth using the 'in' operator here and elsewhere, e.g.
> 'assert success_str in response', since that is the usual Python
> idiom. It also helps with debugging: pytest's assertion rewriting then
> shows both the expected string and the console output on failure,
> whereas '!= -1' just gives '-1 != -1'. What do you think?

Indeed, that's a good suggestion, thank you. Will do in v3.

>
> Regards,
> Simon

      reply	other threads:[~2026-10-22 12:22 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-20  9:25 [PATCH v2 00/10] Fix AVB pytest suite for sandbox Mattijs Korpershoek
2026-10-20  9:25 ` [PATCH v2 01/10] avb: Use map_to_sysmem() for flush_cache() address Mattijs Korpershoek
2026-10-22  8:25   ` Simon Glass
2026-10-20  9:25 ` [PATCH v2 02/10] test/py: android: Move android image creation to a dedicated file Mattijs Korpershoek
2026-10-22  8:25   ` Simon Glass
2026-10-20  9:25 ` [PATCH v2 03/10] test/py: android: Drop verbose printing and unused return Mattijs Korpershoek
2026-10-22  8:25   ` Simon Glass
2026-10-20  9:25 ` [PATCH v2 04/10] test/py: android: Use for loop to create the images / update disks Mattijs Korpershoek
2026-10-22  8:25   ` Simon Glass
2026-10-20  9:25 ` [PATCH v2 05/10] test/py: android: Add create_gpt_image() for image creation Mattijs Korpershoek
2026-10-20 15:07   ` Guillaume La Roque
2026-10-22  8:26   ` Simon Glass
2026-10-22 13:24     ` Mattijs Korpershoek
2026-10-20  9:25 ` [PATCH v2 06/10] test/py: android: Add setup_android_v{4,2}_image subfunctions Mattijs Korpershoek
2026-10-22  8:26   ` [PATCH v2 06/10] test/py: android: Add setup_android_v{4, 2}_image subfunctions Simon Glass
2026-10-20  9:25 ` [PATCH v2 07/10] test/py: avb: Use format specifiers instead of str() for mmc_dev Mattijs Korpershoek
2026-10-22  8:59   ` Simon Glass
2026-10-20  9:25 ` [PATCH v2 08/10] test/py: avb: Move mmc device number to a pytest fixture Mattijs Korpershoek
2026-10-22  8:26   ` Simon Glass
2026-10-20  9:25 ` [PATCH v2 09/10] test/py: avb: Add sandbox AVB testing with dedicated mmc12 device Mattijs Korpershoek
2026-10-22  8:26   ` Simon Glass
2026-10-22 12:53     ` Mattijs Korpershoek
2026-10-20  9:25 ` [PATCH v2 10/10] test/py: avb: Fix find() logic when matching response strings Mattijs Korpershoek
2026-10-20 15:07   ` Guillaume La Roque
2026-10-22  8:26   ` Simon Glass
2026-10-22 12:22     ` Mattijs Korpershoek [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=xhkdbecdhq60n.fsf@mkorpers-koolstof.csb \
    --to=mkorpershoek@kernel.org \
    --cc=glaroque@baylibre.com \
    --cc=igor.opaniuk@gmail.com \
    --cc=igor.opaniuk@oss.qualcomm.com \
    --cc=jan.kehren@emteria.com \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.u-boot-project.org \
    /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.