-
Notifications
You must be signed in to change notification settings - Fork 182
vsock_bridge_test: Add script to test vsock bridge functionality #4421
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 Windows-only QEMU vsock bridge test: a new config Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ 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 |
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: 3
🧹 Nitpick comments (1)
qemu/tests/vsock_bridge_test.py (1)
54-54: Consider using pathlib or os.path for path manipulation.The current string slicing and concatenation works but is less readable and maintainable. While this is Windows-specific code, using
os.pathwould be clearer.Example refactor using
os.path:+ import os + LOG_JOB.info("Install vstbridge service in guest") path = get_driver_inf_path(session, test, virtio_win_media_type, driver_name) - test_tool_path = path[: path.rfind("\\")] + "\\" + test_tool + test_tool_path = os.path.join(os.path.dirname(path), test_tool) session.cmd_output("%s -i" % test_tool_path)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
qemu/tests/cfg/vsock_bridge_test.cfg(1 hunks)qemu/tests/vsock_bridge_test.py(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
qemu/tests/vsock_bridge_test.py (1)
provider/win_driver_utils.py (1)
get_driver_inf_path(123-155)
🔇 Additional comments (2)
qemu/tests/cfg/vsock_bridge_test.cfg (1)
1-23: Configuration looks well-structured.The test configuration properly defines Windows-specific vsock bridge test parameters, including architecture-specific OpenSSH paths, VirtIO requirements, and the socat-based VSOCK connection command. The structure is clear and follows standard QEMU test configuration patterns.
qemu/tests/vsock_bridge_test.py (1)
11-23: LGTM: OpenSSH setup function is well-structured.The function correctly handles copying the OpenSSH installer from the Windows utilities path to the destination and executes the installation script.
|
@coderabbitai generate docstrings |
✅ Actions performedInitiated docstring generation; will generate only if new commits exist. |
|
Caution Docstrings generation - FAILED No docstrings were generated. |
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
♻️ Duplicate comments (1)
qemu/tests/vsock_bridge_test.py (1)
69-87: Harden vsock bridge SSH connection handling (timeouts, prompts, liveness, cleanup)Current behavior has several reliability issues:
aexpect.Expectis created without a timeout; a broken/hung connection can stall the test indefinitely.vsock_session.is_alive()is called but its result is ignored.- Multiple
get_output()calls are used to fish for"yes/no"/"password"/ prompt strings, which can easily miss or consume prompts in the wrong order.- The prompt check hardcodes
r"Administrator: C:\Windows\system32", which is brittle across Windows/OpenSSH versions.vsock_session.close()is only called on the happy path; on failure, the session may leak.A more robust pattern would:
- Add an explicit timeout on the Expect session.
- Fail immediately if the process isn’t alive.
- Use
read_until_last_line_matches()(or equivalent) to synchronize on prompts in sequence.- Match a looser prompt pattern (e.g.
Administrator.*>), not a single exact string.- Close
vsock_sessionin afinallyblock.For example:
- vsock_session = aexpect.Expect( - conn_cmd, - auto_close=False, - ) - vsock_session.is_alive() - if "yes/no" in vsock_session.get_output(): - vsock_session.sendline("yes") - if "password" in vsock_session.get_output(): - vsock_session.sendline(params["password"]) - output = vsock_session.get_output() - if r"Administrator: C:\Windows\system32" not in output: - test.fail("Can not connect to VM via vsock bridge service.") - else: - test.log.info("Connect to VM via vsock bridge successfully") - vsock_session.close() + vsock_session = aexpect.Expect( + conn_cmd, + auto_close=False, + timeout=int(params.get("vsock_timeout", 120)), + ) + if not vsock_session.is_alive(): + test.fail("Vsock bridge process is not running.") + + try: + # Wait for hostkey/yes-no, password, or shell prompt. + patterns = [r"yes/no", r"[Pp]assword", r"Administrator.*>"] + idx, output = vsock_session.read_until_last_line_matches( + patterns, timeout=120 + ) + if idx == 0: + vsock_session.sendline("yes") + idx, output = vsock_session.read_until_last_line_matches( + patterns[1:], timeout=120 + ) + if idx == 1: + vsock_session.sendline(params["password"]) + idx, output = vsock_session.read_until_last_line_matches( + [patterns[2]], timeout=120 + ) + if idx != 0 and idx != 1 and "Administrator" not in output: + test.fail("Did not reach shell prompt over vsock bridge: %s" % output) + test.log.info("Connect to VM via vsock bridge successfully") + except aexpect.ExpectTimeoutError as e: + test.fail("Timeout waiting for vsock bridge SSH prompts: %s" % e) + finally: + vsock_session.close()This keeps the test from hanging forever and makes connection failures deterministic and diagnosable.
You can quickly confirm the availability and typical usage of
read_until_last_line_matchesandExpectTimeoutErrorin your tree with:#!/bin/bash rg -n "read_until_last_line_matches" -C3 rg -n "ExpectTimeoutError" -C3
🧹 Nitpick comments (1)
qemu/tests/vsock_bridge_test.py (1)
65-67: Check OpenSSH service start result (and/or service state) for clearer failures
start_openssh_serviceis run viacmd_status_output()and the status is ignored. If the service fails to start (e.g. bad config, missing binary), the test will proceed to the vsock bridge step and only fail indirectly there.Consider either:
- Switching to
session.cmd(params["start_openssh_service"])to fail immediately on non‑zero exit, or- Inspecting the returned status/output and failing the test with a more explicit message when the service doesn’t start.
This keeps failures localized and easier to diagnose.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
qemu/tests/cfg/vsock_bridge_test.cfg(1 hunks)qemu/tests/vsock_bridge_test.py(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- qemu/tests/cfg/vsock_bridge_test.cfg
🧰 Additional context used
🧬 Code graph analysis (1)
qemu/tests/vsock_bridge_test.py (1)
provider/win_driver_utils.py (1)
get_driver_inf_path(123-155)
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
♻️ Duplicate comments (2)
qemu/tests/vsock_bridge_test.py (2)
11-30: Past review already covers docstring and error handling issues.The docstring inaccuracy (line 15), silent failures on
xcopyand OpenSSH installer commands (lines 24-29), and missing path quotes have already been flagged in a previous review.
73-78: Past review already covers missing timeout parameter.The missing
timeoutparameter in theaexpect.Expectconstructor has already been flagged in a previous review.
🧹 Nitpick comments (1)
qemu/tests/vsock_bridge_test.py (1)
59-64: Refactor path manipulation and add error checking for critical commands.Line 61 uses fragile string slicing to construct the test tool path. Consider using
os.path.dirname()orpathlib.Pathfor more robust path manipulation.Lines 62-63 execute critical commands (
xcopyand vstbridge installation) without checking return codes, which could lead to silent failures.Apply this diff to improve robustness:
+import os + ... LOG_JOB.info("Install vstbridge service in guest") path = get_driver_inf_path(session, test, virtio_win_media_type, driver_name) -test_tool_src_path = path[: path.rfind("\\")] + "\\" + test_tool -session.cmd_output("xcopy %s C:\\" % test_tool_src_path) -session.cmd_output("C:\\%s -i" % test_tool) +test_tool_src_path = os.path.join(os.path.dirname(path), test_tool) +session.cmd('xcopy "%s" C:\\' % test_tool_src_path) +session.cmd("C:\\%s -i" % test_tool) session = vm.reboot(session)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
qemu/tests/cfg/vsock_bridge_test.cfg(1 hunks)qemu/tests/vsock_bridge_test.py(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
qemu/tests/vsock_bridge_test.py (1)
provider/win_driver_utils.py (1)
get_driver_inf_path(123-155)
🔇 Additional comments (1)
qemu/tests/cfg/vsock_bridge_test.cfg (1)
1-24: LGTM!The configuration file is well-structured and provides all necessary parameters for the vsock bridge test workflow, including architecture-specific OpenSSH paths, installation commands, and connection settings.
|
JOB LOG : /root/avocado/job-results/job-2025-12-11T00.40-1dca56e/job.log |
|
Hi @JinLiul Could you please help review this PR?Thanks. |
| if vsock_session.read_until_last_line_matches("password"): | ||
| vsock_session.sendline(params["password"]) | ||
| if params["expect_output"] not in vsock_session.get_output(): | ||
| test.log.info("Connect to VM via vsock bridge successfully") |
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.
The current logic checks if this expect_output is not found and then reports success. I'm not sure what the correct logic should be here or should we change the "expect_output" to aviod misunderstanding.
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.
Good catch, I will update the code, thanks.
ID:4316 Signed-off-by: Leidong Wang <leidwang@redhat.com>
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: 2
♻️ Duplicate comments (3)
qemu/tests/vsock_bridge_test.py (3)
24-29: Fail fast on OpenSSH installation errors.Both the
xcopycommand (line 24-26) and the OpenSSH installer (line 29) usecmd_status_output()without checking the return status. If either operation fails, the test will continue silently and fail later during connection attempts, making debugging difficult.🔎 Proposed fix
- session.cmd_status_output( - "xcopy %s %s /s /e /i /y" % (openssh_src_path, openssh_dst_path) - ) + status, output = session.cmd_status_output( + 'xcopy "%s" "%s" /s /e /i /y' % (openssh_src_path, openssh_dst_path) + ) + if status != 0: + raise Exception("Failed to copy OpenSSH: %s" % output) LOG_JOB.info("Install OpenSSH") - session.cmd_status_output(params["install_config_openssh"]) + status, output = session.cmd_status_output(params["install_config_openssh"]) + if status != 0: + raise Exception("Failed to install OpenSSH: %s" % output)Note: Paths are now quoted to handle spaces safely.
Based on past review feedback.
73-78: Add timeout parameter to prevent indefinite hang.The
aexpect.Expectsession is created without a timeout. If the connection fails or the remote end hangs, the test will block indefinitely.🔎 Proposed fix
vsock_session = aexpect.Expect( conn_cmd, auto_close=False, + timeout=120, output_func=utils_logfile.log_line, output_params=("vsock_%s_%s" % (guest_cid, 22),), )Based on past review feedback.
80-89: Fix incorrect usage of read_until_last_line_matches API.The code misuses
read_until_last_line_matches()which returns a tuple(index, match_text)on success or raisesExpectTimeoutErroron timeout. The currentifstatements (lines 80, 82) check the return value directly, which will always be truthy when a tuple is returned, regardless of which pattern matched. Additionally, line 88 catches bareException, masking different failure modes.🔎 Proposed fix
try: - if vsock_session.read_until_last_line_matches("yes/no"): + try: + vsock_session.read_until_last_line_matches(["yes/no"], timeout=30) vsock_session.sendline("yes") - if vsock_session.read_until_last_line_matches("password"): + except aexpect.ExpectTimeoutError: + pass # Pattern not found, continue + + try: + vsock_session.read_until_last_line_matches(["password"], timeout=30) vsock_session.sendline(params["password"]) + except aexpect.ExpectTimeoutError: + pass # Pattern not found, continue + + # Wait for final prompt + vsock_session.read_until_last_line_matches( + [params["expect_output"]], timeout=30 + ) - if params["expect_output"] not in vsock_session.get_output(): - test.fail("Connect to vsock bridge service failed") - else: - test.log.info("Connect to VM via vsock bridge successfully") - except Exception as e: + test.log.info("Connect to VM via vsock bridge successfully") + except aexpect.ExpectTimeoutError as e: + test.fail("Timeout waiting for expected prompt: %s" % e) + except aexpect.ExpectError as e: test.fail("Can not connect to VM via vsock bridge service due to %s" % e)Note:
read_until_last_line_matches()expects a list of patterns as the first argument.Based on past review feedback and code analysis.
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
qemu/tests/cfg/vsock_bridge_test.cfgqemu/tests/vsock_bridge_test.py
🧰 Additional context used
🧬 Code graph analysis (1)
qemu/tests/vsock_bridge_test.py (1)
provider/win_driver_utils.py (1)
get_driver_inf_path(123-155)
🔇 Additional comments (1)
qemu/tests/cfg/vsock_bridge_test.cfg (1)
20-20: Critical: PowerShell variable interpolation will fail with single quotes.The command uses single quotes around the PowerShell string, but single quotes in PowerShell prevent variable expansion. The
${openssh_dst_path}variable will not be interpolated, causing the installation command to fail.🔎 Proposed fix
- install_config_openssh = 'powershell -command "${openssh_dst_path}\install-sshd.ps1"' + install_config_openssh = "powershell -command \"${openssh_dst_path}\\install-sshd.ps1\""Alternatively, use PowerShell's
-Fileparameter:- install_config_openssh = 'powershell -command "${openssh_dst_path}\install-sshd.ps1"' + install_config_openssh = "powershell -File \"${openssh_dst_path}\\install-sshd.ps1\""Likely an incorrect or invalid review comment.
| start_openssh_service = sc start sshd | ||
| install_openssh = yes | ||
| conn_cmd = 'ssh -o ProxyCommand="socat - VSOCK-CONNECT:%s:22" Administrator@0.0.0.0' | ||
| expect_output = "C:\Users\Administrator" |
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.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# First, examine the specific file and line in question
echo "=== Examining vsock_bridge_test.cfg ==="
cat -n qemu/tests/cfg/vsock_bridge_test.cfg | head -40
echo -e "\n=== Searching for similar expect_output patterns ==="
rg -n "expect_output" -C2 qemu/tests/cfg/ || echo "Pattern not found in cfg files"
echo -e "\n=== Checking for Windows prompt patterns in test files ==="
rg -n "Administrator|Users.*>|PS C:" --type=py --type=cfg -C1 || echo "No matches found"Repository: autotest/tp-qemu
Length of output: 2320
🏁 Script executed:
#!/bin/bash
# Find the test file that uses this configuration
echo "=== Finding test implementation files ==="
fd -name "*vsock*" -type f
echo -e "\n=== Searching for expect_output usage in Python test files ==="
rg -n "expect_output" -A 3 -B 3 --type=py
echo -e "\n=== Looking at the test directory structure ==="
ls -la qemu/tests/Repository: autotest/tp-qemu
Length of output: 50620
🏁 Script executed:
#!/bin/bash
# Examine the test implementation
echo "=== Test implementation context ==="
sed -n '75,95p' qemu/tests/vsock_bridge_test.py
echo -e "\n=== Looking for similar patterns or documentation ==="
rg -B 5 -A 5 "get_output|ssh.*Administrator" qemu/tests/vsock_bridge_test.py
echo -e "\n=== Searching for Windows OpenSSH shell configuration ==="
rg -i "powershell|prompt|shell" qemu/tests/cfg/vsock_bridge_test.cfgRepository: autotest/tp-qemu
Length of output: 1616
🏁 Script executed:
#!/bin/bash
# Research Windows OpenSSH default shell and output format
echo "=== Looking for comments or docs about Windows SSH output ==="
rg -i "openssh|windows.*shell|prompt" qemu/tests/vsock_bridge_test.py -B 2 -A 2
echo -e "\n=== Check if there are any related issues or comments in the config ==="
cat qemu/tests/cfg/vsock_bridge_test.cfg
echo -e "\n=== Search for other Windows SSH or shell tests ==="
fd -name "*.py" qemu/tests/ -x grep -l "openssh\|ssh.*Administrator" {} \;Repository: autotest/tp-qemu
Length of output: 2543
🏁 Script executed:
#!/bin/bash
# Search for other Windows SSH or shell tests
echo "=== Looking for other SSH/OpenSSH related files ==="
find qemu/tests -name "*.py" -type f | xargs grep -l "openssh\|ssh.*Administrator" 2>/dev/null
echo -e "\n=== Understanding Windows OpenSSH default shell behavior ==="
# Check if there are any shell/prompt related comments in the test
grep -r "shell\|prompt\|C:\\\\" qemu/tests/vsock_bridge_test.py
echo -e "\n=== Looking at the default Windows OpenSSH shell configuration ==="
# Windows OpenSSH typically defaults to cmd.exe or PowerShell
# Let's check what shell is being used in the setup
grep -i "shell\|default" qemu/tests/cfg/vsock_bridge_test.cfgRepository: autotest/tp-qemu
Length of output: 503
🏁 Script executed:
#!/bin/bash
# Look at how other tests validate SSH connections
echo "=== Checking qemu_guest_agent.py for SSH patterns ==="
grep -A 5 -B 5 "expect_output\|ssh.*Administrator" qemu/tests/qemu_guest_agent.py | head -40
echo -e "\n=== Looking for shell prompt patterns in Windows tests ==="
find qemu/tests/cfg -name "*.cfg" -type f | xargs grep -h "expect_output\|password\|prompt" | grep -i "windows\|cmd\|powershell" | head -20
echo -e "\n=== Checking OpenSSH Windows documentation patterns ==="
# Windows OpenSSH default shell behavior
grep -r "cmd.exe\|powershell" qemu/tests/cfg/vsock_bridge_test.cfgRepository: autotest/tp-qemu
Length of output: 697
🏁 Script executed:
#!/bin/bash
# Check git history or comments about this expect_output value
echo "=== Checking git history for this line ==="
git log --oneline -p -- qemu/tests/cfg/vsock_bridge_test.cfg | grep -A 10 -B 10 "expect_output" | head -50
echo -e "\n=== Checking if there are any related test documentation ==="
find qemu/tests -name "*vsock*" -type f | head -10
echo -e "\n=== Look for Windows shell prompt documentation in repo ==="
find . -name "*.md" -o -name "*.txt" -o -name "README*" | xargs grep -l "openssh\|windows.*shell" 2>/dev/null | head -5Repository: autotest/tp-qemu
Length of output: 1088
🏁 Script executed:
#!/bin/bash
# Let's verify how the output actually works by looking at what get_output() returns
echo "=== Checking what vsock_session is and how get_output works ==="
rg -B 10 "vsock_session.*get_output\|class.*Session" qemu/tests/vsock_bridge_test.py | head -50
echo -e "\n=== Understanding the test logic more clearly ==="
sed -n '70,95p' qemu/tests/vsock_bridge_test.py
echo -e "\n=== Check if there are any actual Windows OpenSSH shell tests or docs ==="
find . -type f \( -name "*.md" -o -name "*.rst" -o -name "*.txt" \) -exec grep -l "Windows.*SSH\|OpenSSH.*Windows" {} \; 2>/dev/nullRepository: autotest/tp-qemu
Length of output: 1207
🏁 Script executed:
#!/bin/bash
# Understanding aexpect.Expect and what get_output returns
echo "=== Searching for aexpect usage and documentation ==="
rg -A 3 "class Expect\|def get_output" --type=py | head -40
echo -e "\n=== Looking at imports and understanding the session object ==="
head -30 qemu/tests/vsock_bridge_test.py
echo -e "\n=== Checking if there are any test logs or expected outputs documented ==="
find . -name "*.py" -type f -exec grep -l "C:\\\\Users\\\\Administrator" {} \;Repository: autotest/tp-qemu
Length of output: 1042
🏁 Script executed:
#!/bin/bash
# Look for any shell configuration in the test setup
echo "=== Checking the full vsock_bridge_test.py for shell setup ==="
cat qemu/tests/vsock_bridge_test.py | grep -A 200 "def run" | head -100
echo -e "\n=== Searching for any Windows shell or prompt configuration ==="
rg "shell\|cmd\.exe\|powershell.*default" qemu/tests/cfg/ --type=cfg
echo -e "\n=== Looking at what the installation does ==="
grep -C 5 "install-sshd" qemu/tests/cfg/vsock_bridge_test.cfgRepository: autotest/tp-qemu
Length of output: 2992
🏁 Script executed:
#!/bin/bash
# Let me understand the actual Windows OpenSSH behavior better
echo "=== Understanding Windows OpenSSH default shell ==="
# Windows OpenSSH defaults to cmd.exe, which would show: C:\Users\Administrator>
# PowerShell would show: PS C:\Users\Administrator>
echo "When Windows OpenSSH opens a session, the first output typically contains the prompt."
echo "For cmd.exe default shell: C:\Users\Administrator>"
echo "For PowerShell: PS C:\Users\Administrator>"
echo ""
echo "The test does a substring check: if 'C:\Users\Administrator' in output"
echo "This would match both cases since both contain that substring."
echo -e "\n=== Checking if there's any shell override in the config ==="
cat qemu/tests/cfg/vsock_bridge_test.cfg | grep -i "shell\|cmd\|powershell"Repository: autotest/tp-qemu
Length of output: 667
Update expect_output to match the complete shell prompt.
The expect_output value "C:\Users\Administrator" is incomplete. Windows OpenSSH with the default cmd.exe shell displays the prompt as C:\Users\Administrator> (CMD) or PS C:\Users\Administrator> (PowerShell). While the current substring match works, it's imprecise—if the output is truncated or incomplete, the test could pass incorrectly. Change expect_output to "C:\Users\Administrator>" to match the actual command prompt delimiter and ensure robust validation.
🤖 Prompt for AI Agents
In qemu/tests/cfg/vsock_bridge_test.cfg around line 24, the expect_output value
"C:\Users\Administrator" is too loose and should include the prompt delimiter;
update it to "C:\Users\Administrator>" so the test matches the full CMD prompt
(or use the equivalent PowerShell prompt if that environment is expected) to
avoid false positives from truncated output.
| test_tool_src_path = path[: path.rfind("\\")] + "\\" + test_tool | ||
| session.cmd_output("xcopy %s C:\\" % test_tool_src_path) | ||
| session.cmd_output("C:\\%s -i" % test_tool) |
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.
🛠️ Refactor suggestion | 🟠 Major
Add error handling for vsock bridge installation steps.
The code has multiple issues:
- Line 61: Fragile path construction using string slicing assumes the INF path format. If the path structure changes, this will silently construct an incorrect path.
- Lines 62-63: Both
xcopyand the installer execution usecmd_output()without checking for errors. Failures will go unnoticed until the connection test fails.
🔎 Proposed fix
LOG_JOB.info("Install vstbridge service in guest")
path = get_driver_inf_path(session, test, virtio_win_media_type, driver_name)
- test_tool_src_path = path[: path.rfind("\\")] + "\\" + test_tool
- session.cmd_output("xcopy %s C:\\" % test_tool_src_path)
- session.cmd_output("C:\\%s -i" % test_tool)
+ # Extract directory from INF path more safely
+ import os
+ driver_dir = os.path.dirname(path)
+ test_tool_src_path = os.path.join(driver_dir, test_tool)
+
+ status, output = session.cmd_status_output('xcopy "%s" C:\\ /Y' % test_tool_src_path)
+ if status != 0:
+ test.error("Failed to copy vstbridge tool: %s" % output)
+
+ status, output = session.cmd_status_output("C:\\%s -i" % test_tool)
+ if status != 0:
+ test.error("Failed to install vstbridge service: %s" % output)
+
session = vm.reboot(session)Committable suggestion skipped: line range outside the PR's diff.
🤖 Prompt for AI Agents
In qemu/tests/vsock_bridge_test.py around lines 61 to 63, the current code
builds the installer path by brittle string slicing and runs xcopy and the
installer with session.cmd_output() without checking results; replace the
fragile string slicing with a robust path join/splitting using os.path (e.g.,
os.path.dirname and os.path.join) to construct test_tool_src_path, and wrap the
xcopy and installer calls to capture exit status/output (or use a helper like
session.cmd_output_assert if available) — check return codes or inspect stderr,
log or raise a clear exception on failure, and only proceed to the connection
test when both copy and install succeeded.
ID:4316
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.