tests: pick the sshd child that arrived - #1225
Merged
Merged
Conversation
sshd_sftp_idle_cpu_test.sh measures the connection process it forked, so it takes the wolfsshd present after the connection and not before. The old symmetric difference offered a pid that left during the window just as readily, and the smallest one wins, so an earlier test's departing child was measured through a /proc entry that no longer existed. - compare the pid sets one way, and poll for the fork rather than sampling a fixed five seconds in - let the handshake and SFTP setup finish before the baseline, so their ticks land outside the measurement rather than inside it - print both pid sets when no child is found, since the failure says nothing about which pids were considered
ejohnstown
requested review from
wolfSSL-Fenrir-bot
and
a lite review from Copilot
September 3, 2026 00:18
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #1225
No scan targets match the changed files in this PR. Review skipped.
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The changes are low-risk test-script adjustments that address a real race; remaining feedback is limited to clarity/diagnostic accuracy improvements.
Pull request overview
This PR hardens sshd_sftp_idle_cpu_test.sh so it consistently measures the CPU usage of the wolfSSHd child process spawned by the test’s own connection, avoiding races with earlier tests’ exiting children and missing /proc entries.
Changes:
- Switches from symmetric PID-set diffing to a one-way “new PID since baseline” selection to avoid choosing departed processes.
- Replaces a fixed post-connect sleep with polling to detect the forked child promptly and deterministically.
- Adds a post-connect settling delay so handshake/auth/SFTP setup CPU ticks are excluded from the idle baseline, and improves diagnostics when the child PID cannot be found.
File summaries
| File | Description |
|---|---|
| apps/wolfsshd/test/sshd_sftp_idle_cpu_test.sh | Makes the idle CPU test select the correct post-connection wolfSSHd child PID via one-way comparison + polling, and improves failure diagnostics. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
philljj
approved these changes
Sep 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
sshd_sftp_idle_cpu_test.sh measures the wolfsshd present after the
connection it forked, not before, so an earlier test's departing child is
no longer picked and then read through a /proc entry that is gone.
sampling a fixed five seconds in.
both pid sets when no child is found.