-
Notifications
You must be signed in to change notification settings - Fork 183
windows_update_perf: support VBS #4332
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
base: master
Are you sure you want to change the base?
Conversation
WalkthroughAdds a new Windows-oriented QEMU performance test: a test configuration file Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Tester as Avocado/Test Runner
participant QEMU as QEMU VM
participant Guest as Windows Guest
participant PS as PowerShell/Tools
participant WSL as WSL2/RHEL Distro
Tester->>QEMU: Boot VM (params: CPU/IOMMU/nesting)
QEMU->>Guest: Start guest OS
Tester->>Guest: Open session
Note over Guest,PS: Set execution policy, prepare paths
Tester->>PS: Check Secure Boot / VBS readiness
Tester->>Guest: Copy DG Readiness Tool
Tester->>PS: Run DG commands (dg_command)
alt VBS enabled/required
Tester->>QEMU: Reboot VM (sync)
QEMU->>Guest: Guest up
Tester->>Guest: Reconnect session
end
Tester->>PS: Enable WSL + VM Platform, set default v2
Tester->>WSL: Install RHEL distro
Note right of WSL: Validate distro availability
Tester-->>QEMU: Optional VBS disable and reboot
Tester->>Guest: Final checks and cleanup
Tester-->>Tester: Report result (pass/fail)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Potential focus areas:
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
🧰 Additional context used🧬 Code graph analysis (1)qemu/tests/win_virtio_perf_test.py (1)
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
qemu/tests/cfg/win_virtio_perf_test.cfg (1)
21-23: Keep the ExecutionPolicy relaxation scoped to the session
Set-ExecutionPolicywithout-Scopedefaults toLocalMachine, permanently dropping the host’s PowerShell policy to Unrestricted. That weakens security for subsequent scenarios on the same worker. Please either scope it to the current process (-Scope Process -ExecutionPolicy Bypass) or restore the original policy once the readiness script finishes so the machine isn’t left wide open.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
qemu/tests/cfg/win_virtio_perf_test.cfg(1 hunks)qemu/tests/win_virtio_perf_test.py(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
qemu/tests/win_virtio_perf_test.py (1)
qemu/deps/win_driver_install/win_driver_install.py (1)
cmd_output(12-28)
| """ | ||
| Set PowerShell execution policy using the provided session. | ||
| It is used when creating a new session. | ||
|
|
||
| :param cmd: The PowerShell command to set execution policy. | ||
| """ | ||
| error_context.context("Setting PowerShell execution policy.") | ||
| status, output = session.cmd_status_output(executionPolicy_command) | ||
| if status != 0: | ||
| test.fail("Failed to set PowerShell execution policy: %s" % output) | ||
|
|
||
| def check_secure_boot_enabled(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix PowerShell policy helper to use the active session
After the WSL reboot we create new_session, but set_powershell_execute_policy() still dereferences the old session captured from the outer scope. That handle is already invalid once the guest reboots, so the execution-policy command either fails outright or silently never updates the new session, breaking the rest of the workflow. Pass the live session object into the helper so that every call (including the one right after the reboot) runs against the correct connection.
@@
- def set_powershell_execute_policy():
- """
- Set PowerShell execution policy using the provided session.
- It is used when creating a new session.
-
- :param cmd: The PowerShell command to set execution policy.
- """
+ def set_powershell_execute_policy(current_session):
+ """
+ Set PowerShell execution policy on the given session.
+ """
@@
- status, output = session.cmd_status_output(executionPolicy_command)
+ status, output = current_session.cmd_status_output(executionPolicy_command)
@@
- set_powershell_execute_policy()
+ set_powershell_execute_policy(session)
@@
- set_powershell_execute_policy()
+ set_powershell_execute_policy(session)
@@
- set_powershell_execute_policy()
+ set_powershell_execute_policy(new_session)Also applies to: 111-114, 174-183
🤖 Prompt for AI Agents
In qemu/tests/win_virtio_perf_test.py around lines 24-35 (also apply same change
at 111-114 and 174-183), the helper set_powershell_execute_policy() closes over
the old session variable so after WSL reboot it uses a stale/invalid session;
change the helper signature to accept a session parameter and use that passed-in
session for session.cmd_status_output(executionPolicy_command) (and update all
callers to pass the current/live session, including immediately after creating
new_session) so the execution policy runs against the active connection.
Create a test case about windows updatete performance, and complete the first scenario of vbs support. Assisted-by: Claude Code.Approximately 50% of the content was generated using it. Signed-off-by: Xiaoling Gao <[email protected]>
Create a test case about windows updatete performance, and complete the first scenario of vbs support.
ID: 3338
Summary by CodeRabbit
New Features
Tests