Marked as RFC because the second to last patch is very ewww but I don't
have a much better idea right now.

b4 prep --check can run an executable on each patch in a series, so it'd
be nice to be able to use patchtest with that so that we don't duplicate
tests run locally and those run on patches found on the ML by a bot.

b4 sends the patch to check over stdin, with the "From " field stripped
from the Mbox, c.f. 
https://git.kernel.org/pub/scm/utils/b4/b4.git/tree/src/b4/__init__.py?h=stable-0.14.y#n3494
This means we need to add to patchtest the ability to pass patches from
stdin and also tell it to ignore "malformed" Mboxes in some cases
(whenever the patch is passed via stdin for example).

b4 expects absolutely zero message on either stderr or stdout or it
interprets those as error messages. patchtest is currently quite
verbose, so we need to disable everything we can and only keep error
messages.

This would be a first step for using patchtest with b4 prep --check,
ideally we should also make it possible to use patchtest with other git
repos, specifically poky for example. This would allow people to run
tests for BitBake, OE-Core, Yocto-docs and poky source code. We're not
there yet but this is a step in that direction.

One can now use patchtest as b4 prep --check step with the following
.b4-config:

[b4]
   prep-perpatch-check-cmd = patchtest --patch - --quiet --no-summary

oe-init-buildenv needs to be sourced first to make patchtest available
in PATH and a few Python modules installed (e.g. unidiff, pylint, ...;
see meta/lib/patchtest/requirements.txt).

This series depends on
https://lore.kernel.org/openembedded-core/[email protected]/T/#m24b6594da5d57d0715e16636ad2936b1478f08ae
except if the last patch in this series is removed (the modification of
.b4-config).

Signed-off-by: Quentin Schulz <[email protected]>
---
Quentin Schulz (6):
      patchtest: use logger instead of printing to stdout
      patchtest: allow to pass patch from stdin
      patchtest: allow to silence non-error messages
      patchtest: allow to not print summary
      patchtest: allow malformed Mbox
      b4: enable patchtest as b4 prep --check step

 .b4-config                             |  3 +-
 meta/lib/patchtest/mbox.py             |  9 +++---
 meta/lib/patchtest/patchtest_parser.py |  8 +++++
 meta/lib/patchtest/repo.py             |  4 +--
 meta/lib/patchtest/tests/base.py       |  2 +-
 scripts/patchtest                      | 54 ++++++++++++++++++++++++----------
 6 files changed, 56 insertions(+), 24 deletions(-)
---
base-commit: ea18694110e68cdfd90984e0f7f2d4303fd12ff0
change-id: 20250203-b4-patchtest-86b35d7772ee

Best regards,
-- 
Quentin Schulz <[email protected]>

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#210659): 
https://lists.openembedded.org/g/openembedded-core/message/210659
Mute This Topic: https://lists.openembedded.org/mt/110973474/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to