Skip to content

Commit

Permalink
Merge pull request #5639 from cliping/domdisplay
Browse files Browse the repository at this point in the history
graphics: Add case to check domdisplay output
  • Loading branch information
chunfuwen authored Oct 23, 2024
2 parents 777d69a + 60fde9b commit d5daba3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
8 changes: 8 additions & 0 deletions libvirt/tests/cfg/graphics/graphics_functional.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,14 @@
valid_time = 60
opt_str = " --gtk-vnc-debug"
rv_log_auth = "Authentication failed"
- check_with_domdisplay:
check_with_domdisplay = "yes"
vnc_passwd_place = "guest"
vnc_autoport = "yes"
variants:
- include_password_no:
- include_password_yes:
domdisplay_options = "--include-password"
- disable_fips:
vnc_autoport = "yes"
check_fips = "yes"
Expand Down
15 changes: 12 additions & 3 deletions libvirt/tests/src/graphics/graphics_functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -1463,16 +1463,18 @@ def check_xml(vm_name, filetransfer, test):
test.fail('The attribute of filetransfer error.')


def check_domdisplay_result(graphic_type, vm_name, expected_result, test):
def check_domdisplay_result(graphic_type, vm_name, expected_result, test, options="", passwd=None):
"""
Check domdisplay result
:param graphic_type: graphic type
:param vm_name: name of the VM domain
:param expected_result: expected result
:param test: test object
:param options: domdisplay options
:param passwd: graphic password
"""
domdisplay_out = virsh.domdisplay(vm_name, debug=True)
domdisplay_out = virsh.domdisplay(vm_name, options=options, debug=True)
if domdisplay_out.exit_status:
test.fail("Fail to get domain display info. Error:"
"%s." % domdisplay_out.stderr.strip())
Expand All @@ -1483,8 +1485,10 @@ def check_domdisplay_result(graphic_type, vm_name, expected_result, test):
if expected_result['spice_tls_port'] != 'not_set':
expected_uri += "?tls-port=%s" % expected_result['spice_tls_port']
if graphic_type == 'vnc':
if "include-password" in options:
expected_uri += ":%s@" % passwd
expected_uri += "%s:" % expected_result['vnc_options']['addr']
expected_uri += "%s" % expected_result['vnc_port']
expected_uri += "%s" % str(int(expected_result['vnc_port']) - 5900)
if domdisplay_out.stdout.strip() != expected_uri:
test.fail("Use domdisplay to check URI failed. Expected uri: %s" % expected_uri)

Expand Down Expand Up @@ -1660,6 +1664,7 @@ def run(test, params, env):
autoport = params.get("spice_autoport", "yes")
spice_tls = params.get("spice_tls", "not_set")
check_fips = params.get("check_fips", "no") == 'yes'
check_with_domdisplay = params.get("check_with_domdisplay", "no") == 'yes'

if check_fips:
if not is_enable_fips():
Expand Down Expand Up @@ -1776,6 +1781,10 @@ def run(test, params, env):
check_qemu_command_line(params)
vnc_opts = qemu_vnc_options(vm, params)
check_vnc_result(vnc_opts, expected_result, all_ips, test)
if check_with_domdisplay:
domdisplay_options = params.get("domdisplay_options", "")
check_domdisplay_result('vnc', vm_name, expected_result, test,
options=domdisplay_options, passwd=graphic_passwd)
if params.get("hook_path"):
test_passwd_hook(params, vm, test)

Expand Down

0 comments on commit d5daba3

Please sign in to comment.