Skip to content

munet/mutest: Background command API - #102

Open
liambrady wants to merge 2 commits into
LabNConsulting:mainfrom
liambrady:liambrady/background_step-v3b
Open

liambrady wants to merge 2 commits into
LabNConsulting:mainfrom
liambrady:liambrady/background_step-v3b

Conversation

@liambrady

Copy link
Copy Markdown
Contributor

This PR introduces support for running and managing background commands in munet, along with new mutest APIs for validating their output.

Changes (Munet):

  1. Add background command lifecycle management, including process-group termination, reaping, and stdout/stderr capture.
  2. Moves pcap captures into background commands
  3. Add unit tests covering process cleanup and background command lifecycle.

Changes (Mutest):

  1. Introduce background_start(), background_step(), background_match_step(), and their JSON variants in mutest.
  2. Refactor mutest output matching logic to share functionality between foreground and background commands.
  3. Add mutests covering output matching and API usage.
  4. Document the new mutest background command API.

closes #79

@liambrady
liambrady requested a review from choppsv1 November 16, 2026 16:56
@liambrady liambrady added enhancement New feature or request mutest mutest related item labels Nov 16, 2026
This new background command API allows for generic commands to be
started in the background and cleaned up later. The cleanup_pid
API is refactored to allow for the best-effort cleanup of process
groups.

Fixes LabNConsulting#79

Signed-off-by: Liam Brady <lbrady@labn.net>
Background steps are started with background_start(). The provided cmd
runs in the background while execution continues on with the next mutest
step. Running cmds can be ended with the background_* variant of the
familiar mutest step API. Such steps interrupt or terminate the cmd if
it hasn't yet ended.

Signed-off-by: Liam Brady <lbrady@labn.net>
@liambrady
liambrady force-pushed the liambrady/background_step-v3b branch from 932d296 to 71f955e Compare November 16, 2026 17:01
@codecov

codecov Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 86.19048% with 29 lines in your changes missing coverage. Please review.
✅ Project coverage is 61.32%. Comparing base (e7ed4d5) to head (71f955e).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
munet/base.py 85.32% 27 Missing ⚠️
munet/native.py 86.66% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #102      +/-   ##
==========================================
+ Coverage   60.55%   61.32%   +0.77%     
==========================================
  Files          19       19              
  Lines        5990     6169     +179     
==========================================
+ Hits         3627     3783     +156     
- Misses       2363     2386      +23     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request mutest mutest related item

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pcap should work w/o requiring a window system

1 participant