-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5016 from nanli1/fix_chardev_get_messsge_failed
fix chardev get message failed
- Loading branch information
Showing
3 changed files
with
29 additions
and
17 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,8 @@ | |
# Author: Nan Li <[email protected]> | ||
# | ||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
import time | ||
|
||
import aexpect | ||
import os | ||
import platform | ||
|
@@ -163,7 +165,7 @@ def add_chardev(source_path): | |
vmxml.remove_all_device_by_type("channel") | ||
dest_dict = eval( | ||
device_dict % (source_path, target_type, device_alias)) | ||
test.log.debug("Add chadev dict is: %s", dest_dict) | ||
test.log.debug("Add chardev dict is: %s", dest_dict) | ||
libvirt_vmxml.modify_vm_device( | ||
vmxml=vmxml, dev_type=chardev, dev_dict=dest_dict) | ||
|
||
|
@@ -216,23 +218,21 @@ def check_message_from_host(): | |
chardev_port = get_chardev_port(chardev) | ||
|
||
vm_session = vm.wait_for_login(timeout=240) | ||
cmd = "cat < %s > %s" % (target_path + chardev_port, guest_out) | ||
cmd = "cat %s > %s &" % (target_path + chardev_port, guest_out) | ||
test.log.debug("Execute cmd:'%s' on guest ", cmd) | ||
vm_session.sendline(cmd) | ||
|
||
time.sleep(5) | ||
chardev_base.send_message(vm, "host", send_msg=host_msg, | ||
send_path=pipe_in) | ||
vm_session.close() | ||
|
||
vm_session_new = vm.wait_for_login(timeout=240) | ||
status, output = vm_session_new.cmd_status_output( | ||
"grep -E '%s' %s" % (host_msg, guest_out)) | ||
"cat %s | grep '%s' " % (guest_out, host_msg)) | ||
vm_session_new.close() | ||
vm_session.close() | ||
|
||
if status != 0: | ||
test.fail("Check host msg failed.") | ||
if not re.search(host_msg, output): | ||
test.fail("Not get %s in %s" % (host_msg, output)) | ||
test.fail("Not get %s in '%s' " % (host_msg, output)) | ||
else: | ||
test.log.debug("Check '%s' exist in :%s" % (host_msg, output)) | ||
|
||
|
This file contains 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