Skip to content

tests: pick the sshd child that arrived - #1225

Merged
philljj merged 1 commit into
wolfSSL:masterfrom
ejohnstown:sshd-idle-cpu-pid
Sep 3, 2026
Merged

tests: pick the sshd child that arrived#1225
philljj merged 1 commit into
wolfSSL:masterfrom
ejohnstown:sshd-idle-cpu-pid

Conversation

@ejohnstown

Copy link
Copy Markdown
Contributor

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.

  • 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, and print
    both pid sets when no child is found.

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

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fenrir Automated Review — PR #1225

No scan targets match the changed files in this PR. Review skipped.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread apps/wolfsshd/test/sshd_sftp_idle_cpu_test.sh
@philljj
philljj merged commit 3264022 into wolfSSL:master Sep 3, 2026
172 checks passed
@ejohnstown
ejohnstown deleted the sshd-idle-cpu-pid branch September 3, 2026 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants