fix(renode): address review follow-ups from PR #533#558
Merged
Conversation
Closes #556 MEDIUM fixes: - Fix close() SocketStream leak: add RenodeMonitor.close_sync() using SocketAttribute.raw_socket for best-effort synchronous cleanup - Eliminate private attribute traversal across sibling drivers: add RenodePower.is_running property and send_monitor_command() public method so RenodeFlasher and Renode no longer access _process/_monitor - Make shared firmware state explicit: add Renode.set_firmware() method instead of directly writing parent._firmware_path/_load_command - Fix off() inconsistent state on terminate() failure: wrap process cleanup in try/finally so _process is always reset to None - Add error/cleanup path tests: on() mid-startup failure cleanup, connect() persistent OSError timeout, _read_until_prompt empty receive - Fix idempotency tests: add assertions that Popen/RenodeMonitor are NOT called on duplicate on()/off() calls LOW fixes: - Replace dead hasattr guard with power.is_running check - Extract _configure_simulation() from on() to reduce method length - Add TOCTOU race comment to _find_free_port() - Remove decorative separator comments from tests - Add test coverage: _find_renode not on PATH, read() NotImplementedError, monitor_cmd() success path, close() timeout-kill, close_sync(), is_running property, set_firmware() Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ProcessLookupError is expected when the process has already exited. The try/finally ensures _process is reset to None, but the exception must also be caught to prevent it from propagating to callers. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove spurious '@' prefix from LoadELF file path argument that caused a parameter mismatch error in Renode - Add "There was an error" and "Parameters did not match" to monitor error markers so these failures are caught immediately - Strip leading whitespace from response lines before checking error markers so indented error messages are not missed - Add tests for parameter mismatch detection and leading whitespace Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
|
Important Review skippedBot user detected. To trigger a single review, invoke the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
mangelajo
approved these changes
Apr 15, 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.
Summary
Addresses the open follow-up items from issue #556 (Renode driver review of PR #533).
MEDIUM fixes
close()leaks SocketStream: AddedRenodeMonitor.close_sync()that usesSocketAttribute.raw_socketfor best-effort synchronous socket cleanup during driver teardownRenodePower.is_runningproperty andsend_monitor_command()public method —RenodeFlasher.flash()andRenode.monitor_cmd()no longer access_process/_monitordirectlyRenode.set_firmware()method as the explicit interface instead ofRenodeFlasherwritingparent._firmware_path/_load_commanddirectlyoff()inconsistent state onterminate()failure: Wrapped process cleanup intry/finallyso_processis always reset toNone, even ifterminate()raisesProcessLookupErroron()mid-startup failure cleanup,connect()persistentOSError→TimeoutError,_read_until_promptwith emptyreceive()→ConnectionErrortest_power_on_idempotentandtest_power_off_idempotentnow assert thatPopen/RenodeMonitorwere NOT calledLOW fixes
hasattrguard: Replaced withpower.is_running(which checks_process is not None and _monitor is not None)on()method too long: Extracted monitor setup into_configure_simulation()_find_free_port(): Added comment documenting the race and noting Renode doesn't yet support Unix domain sockets# 5.x ...section separators_find_renode()when binary not on PATH,RenodePower.read()NotImplementedError,monitor_cmd()success path,close()timeout-kill branch,close_sync(),is_runningproperty,set_firmware()Test plan
ruff checkpasses on all changed filesruff format --checkpasses on all changed filestest_driver_renode_e2e) where Renode is installedCloses #556
🤖 Generated with Claude Code