Skip to content

Add test hook infrastructure

Zorro Lang fstests linux-btrfs linux-ext4 linux-xfs 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest6 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6common: add builtin test hook infrastructurecommon/hooks+175 -00 replies
2/6common: add out-of-process hook modecommon/hooks+81 -260 replies
3/6check: introduce pre-test hook and CLI optioncheck+11 -20 replies
4/6check: introduce post-test hook and CLI optioncheck+9 -10 replies
5/6check: introduce post-result hook and CLI optioncheck+10 -10 replies
6/6doc: document the test hooksREADME.hooks+156 -00 replies

Reviews trailers per patch

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

Read the v1 thread

Cover letter [PATCH 0/6] Add test hook infrastructure

Hi all,

This series adds test hook support to fstests, allowing users to customize a test run (e.g., collecting traces, capturing extra debug data, or reporting results to an external framework) without modifying fstests itself. It is inspired by Dave Chinner's earlier hook infrastructure RFC [1] and also addresses the use cases from a recent fstests mailing list discussion [2], supporting both in-process and out-of-process hooks as well as a post-result event.

Hooks are registered on the command line via --hook-pre-test, --hook-post-test, and --hook-post-result:

	--hook-<event> path=/path/to/hook[,mode=in|out][,match=<glob>]...

Options can be repeated and hooks run in the order given. Optional match=<glob> patterns restrict a hook to matching test names; without them, the hook runs for every test.

Two execution modes are supported:

- mode=in (default): a bash script defining hook_execute(), sourced in a subshell with full access to the test environment and fstests helpers.

- mode=out: a standalone executable written in any language, invoked via env(1) with the test variables in HOOK_ENV_LIST and the hook context.

All hook output is appended to $seqres.hooks, and hook failures are logged there without affecting the test result.

Series overview:

- Patch 1 adds the core hook infrastructure (mode=in) in common/hooks.
- Patch 2 adds out-of-process hook support (mode=out).
- Patches 3-5 wire up the pre-test, post-test, and post-result events and CLI options in check.
- Patch 6 adds README.hooks documenting usage and examples.

[1] https://lore.kernel.org/all/[email protected]/
[2] https://lore.kernel.org/fstests/[email protected]/

Feedback and reviews are welcome.

Thanks,
Zorro

Dave Chinner (1):
common: add builtin test hook infrastructure

Zorro Lang (5):
common: add out-of-process hook mode
check: introduce pre-test hook and CLI option
check: introduce post-test hook and CLI option
check: introduce post-result hook and CLI option
doc: document the test hooks

 README.hooks | 156 ++++++++++++++++++++++++++++++++++
 check        |  30 ++++++-
 common/hooks | 230 +++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 414 insertions(+), 2 deletions(-)
 create mode 100644 README.hooks
 create mode 100644 common/hooks
Signature · 1 line
2.56.0