Skip to content

DON'T MERGE: Asynchronous shell_spawn() with removed test case #55

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

liambrady
Copy link
Contributor

@liambrady liambrady commented May 2, 2025

DON'T MERGE

This PR contains updates for shell_expect() that makes it async, however, such leads to an upstream pexpect OSError (bad socket descriptor). The specific test cases have been removed in this commit in order to test how much code coverage is lost.

spawn(), which conducts a send/expect process is
blocking due to the abscence of async_=True to
pexpect.expect() within the method's main
send/expect loop. This is undesirable due the
presence of other ongoing initialization
coroutines, since it will block their progress
for the entire time needed to complete either
the single nodes send/expect loop (or wait for
it to timeout).

This is particularly problematic in cases where
multiple VMs requiring custom console expect/send
prompts are required (e.g. routers). Since each
QEMU VM sets up both console logging and completes
an expect/send loop without yielding control to
the coroutine of the other QEMU VMs, only one VM
can ever have logging configured (and thus advance
in an expect/send loop) at any given time. Not
only is this inefficient given that all QEMU VMs
are running and waiting for input, but this can
be fatal if console logging is not set up on each
VM in time. If some mandatory console output is
missed, then there is no way to recover and the
setup of the QEMU VM will time out.

By changing spawn() such that is awaits for
pexpect.expect(), control can be properly passed
to coroutines of other QEMU VM nodes. This allows
for logging to be set up on all nodes immediately
and for independent progress to be made in each
VM's expect/send loop.

Signed-off-by: Liam Brady <[email protected]>
@liambrady liambrady force-pushed the liambrady/qemu_pexpect_async branch 3 times, most recently from 295d592 to c2d64de Compare May 2, 2025 19:49
Copy link

codecov bot commented May 2, 2025

Codecov Report

Attention: Patch coverage is 71.42857% with 2 lines in your changes missing coverage. Please review.

Project coverage is 59.10%. Comparing base (4ec7fe7) to head (987a634).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
munet/base.py 66.66% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #55      +/-   ##
==========================================
+ Coverage   58.84%   59.10%   +0.26%     
==========================================
  Files          19       19              
  Lines        5729     5732       +3     
==========================================
+ Hits         3371     3388      +17     
+ Misses       2358     2344      -14     

☔ View full report in Codecov by Sentry.
📢 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.

For some reason, PopenSpawn cannot be mixed
with .expect() when async_=True. This appears
to be an upstream issue with pexpect with no
known fix.

Signed-off-by: Liam Brady <[email protected]>
@liambrady liambrady force-pushed the liambrady/qemu_pexpect_async branch from c2d64de to 987a634 Compare May 5, 2025 13:34
@liambrady liambrady changed the title DON'T MERGE: Testing code coverage DON'T MERGE: Asynchronous shell_expect() with removed test case May 5, 2025
@liambrady liambrady changed the title DON'T MERGE: Asynchronous shell_expect() with removed test case DON'T MERGE: Asynchronous shell_spawn() with removed test case May 5, 2025
@liambrady
Copy link
Contributor Author

See #58 for the updated PR.

@liambrady liambrady closed this May 21, 2025
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.

1 participant