Skip to content

Commit

Permalink
fwcfg: fix wmic query to ensure windbg installation for fwcfg cases
Browse files Browse the repository at this point in the history
The issue with WinDbg not being found was caused by incorrect WMIC queries.
Since WinDbg is essential for running the fwcfg feature, we’ve changed the
logic to a `while True` loop to ensure it installs correctly.

Signed-off-by: wji <[email protected]>
  • Loading branch information
heywji committed Oct 21, 2024
1 parent d5093fb commit ec972ec
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
18 changes: 9 additions & 9 deletions provider/win_dump_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Windows dump related utilities.
"""
import os
import time
import logging

from avocado.utils import process
Expand Down Expand Up @@ -79,13 +80,12 @@ def install_windbg(test, params, session, timeout=600):
windbg_install_cmd = utils_misc.set_winutils_letter(session,
windbg_install_cmd
% params["feature"])

session.cmd(windbg_install_cmd)
if not utils_misc.wait_for(lambda: check_windbg_installed(params, session),
timeout=timeout, step=5):
test.fail("windbg tool has not been installed")
else:
LOG_JOB.info("windbg tool installation completed")
while check_windbg_installed(params, session) is not True:
status, output = session.cmd_status_output(windbg_install_cmd)
if status == 1:
time.sleep(30)
else:
LOG_JOB.info("windbg tool installation completed")


def check_windbg_installed(params, session):
Expand All @@ -95,8 +95,8 @@ def check_windbg_installed(params, session):
:param params: the dict used for parameters.
:param session: The guest session object.
"""
check_cmd = params["chk_windbg_cmd"] % params["windbg_path"]
status, _ = session.cmd_status_output(check_cmd)
chk_windbg_cmd = params["chk_windbg_cmd"]
status, _ = session.cmd_status_output(chk_windbg_cmd)
return False if status else True


Expand Down
6 changes: 1 addition & 5 deletions qemu/tests/cfg/fwcfg.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,17 @@
image_name_stg = "images/storage"
remove_image_stg = yes
no ppc64 ppc64le aarch64
chk_windbg_cmd = 'wmic product get name,version | find /i "SDK Debuggers"'
i386:
windbg_path = "x86\windbg.exe"
devcon_dirname += "x86"
chk_windbg_cmd = 'dir "C:\Program Files\Windows Kits\10\Debuggers\%s"'
x86_64:
windbg_path = "x64\windbg.exe"
devcon_dirname += "amd64"
chk_windbg_cmd = 'dir "C:\Program Files (x86)\Windows Kits\10\Debuggers\%s"'
devcon_path = "WIN_UTILS:\devcon\${devcon_dirname}\devcon.exe"
feature = "OptionId.WindowsDesktopDebuggers"
sdk_setup = winsdksetup.exe
Win8..1, Win2012..r1, Win2012..r2:
sdk_setup = sdksetup_81.exe
unzip_cmd = powershell.exe -nologo -noprofile -command "& { Add-Type -A 'System.IO.Compression.FileSystem'; [IO.Compression.ZipFile]::ExtractToDirectory('%s:\Memory.dmp.zip', '%s:'); }"
chk_windbg_cmd = 'dir "C:\Program Files (x86)\Windows Kits\8.1\Debuggers\%s"'
Win2016:
sdk_setup = sdksetup_1607.exe
Win2019:
Expand Down

0 comments on commit ec972ec

Please sign in to comment.