Skip to content

RFC prepare patchtest to be run with b4 prep --check

Quentin Schulz openembedded-core 1 version New

Get series with b4
b4 am [email protected] change-id 20250203-b4-patchtest-86b35d7772ee

Versions newest first

  1. v1 RFC Latest6 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6patchtest: use logger instead of printing to stdoutscripts/patchtest+9 -50 replies
2/6patchtest: allow to pass patch from stdinscripts/patchtest+12 -30 replies
3/6patchtest: allow to silence non-error messagesmeta/lib/patchtest/patchtest_parser.py meta/lib/patchtest/tests/base.py scripts/patchtest+8 -20 replies
4/6patchtest: allow to not print summarymeta/lib/patchtest/patchtest_parser.py scripts/patchtest+7 -10 replies
5/6patchtest: allow malformed Mboxmeta/lib/patchtest/mbox.py meta/lib/patchtest/repo.py scripts/patchtest+18 -120 replies
6/6b4: enable patchtest as b4 prep --check step.b4-config+2 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH RFC 0/6] prepare patchtest to be run with b4 prep --check

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).

---
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,

Signature · 1 line
Quentin Schulz <[email protected]>