提交 f0dcdda0 编写于 作者: G Gao Xiaoling 提交者: Xiaoling Gao

qemu_guest_agent: new case of guest agent log check

check guest agent logs via -v and -l parameters.
Signed-off-by: NXiaoling Gao <xiagao@redhat.com>
上级 11e517a6
......@@ -251,6 +251,15 @@
image_name_stg0 = images/storage0
image_size_stg0 = 1G
force_create_image_stg0 = yes
- gagent_check_log:
only isa_serial
gagent_check_type = log
black_list = "guest-file-[a-zA-Z]*"
get_log_cmd = cat /var/log/qemu-ga/qemu-ga.log |grep "read data"
tmp_file = "/tmp/qga_test"
Windows:
get_log_cmd = type c:\qga.log |findstr /c:"read data"
tmp_file = "C:\qga_test.txt"
- gagent_query_chardev:
no isa_serial
gagent_check_type = query_chardev
......@@ -280,10 +289,10 @@
only i386, x86_64
gagent_serial_type = isa
serials += " org.qemu.guest_agent.0"
gagent_start_cmd = "pgrep qemu-ga || qemu-ga -d -m isa-serial -p /dev/ttyS1"
gagent_start_cmd = "pgrep qemu-ga || qemu-ga -d -m isa-serial -p /dev/ttyS1 -l /var/log/qemu-ga/qemu-ga.log -v"
gagent_status_cmd = "pgrep qemu-ga"
gagent_restart_cmd = "pgrep qemu-ga |xargs kill -s 9 && qemu-ga -d -m isa-serial -p /dev/ttyS1"
gagent_restart_cmd = "pgrep qemu-ga |xargs kill -s 9 && ${gagent_start_cmd}"
Windows:
gagent_start_cmd = "cd C:\Program Files\Qemu-ga & start /b qemu-ga.exe -m isa-serial -p COM2"
gagent_start_cmd = "cd C:\Program Files\Qemu-ga & start /b qemu-ga.exe -m isa-serial -p COM2 -l c:\qga.log -v"
gagent_status_cmd = "tasklist |findstr /i /r qemu-ga.exe.*Console"
gagent_restart_cmd = "taskkill /f /t /im qemu-ga.exe & ${gagent_start_cmd}"
......@@ -1933,6 +1933,52 @@ class QemuGuestAgentBasicCheck(QemuGuestAgentTest):
else:
test.fail("Should return error info.")
@error_context.context_aware
def gagent_check_log(self, test, params, env):
"""
Check guest agent logs.
Steps:
1) start guest-agent to record logs
2) issue some guest agent commands
3) check agent log, if those commands are recorded
:param test: kvm test object
:param params: Dictionary with the test parameterspy
:param env: Dictionary with test environment.
"""
def log_check(qga_cmd):
"""
check guest agent log.
"""
error_context.context("Check %s cmd in agent log." % qga_cmd,
logging.info)
log_str = session.cmd_output(get_log_cmd).strip().split('\n')[-1]
pattern = r"%s" % qga_cmd
if not re.findall(pattern, log_str, re.M | re.I):
test.fail("The %s command is not recorded in agent"
" log." % qga_cmd)
get_log_cmd = params["get_log_cmd"]
session = self._get_session(self.params, self.vm)
self._open_session_list.append(session)
self._change_bl(session)
error_context.context("Issue some common guest agent commands.",
logging.info)
self.gagent.get_time()
log_check("guest-get-time")
tmp_file = params["tmp_file"]
content = "hello world\n"
ret_handle = int(self.gagent.guest_file_open(tmp_file, mode="w+"))
log_check("guest-file-open")
self.gagent.guest_file_write(ret_handle, content)
log_check("guest-file-write")
self.gagent.guest_file_read(ret_handle)
log_check("guest-file-read")
@error_context.context_aware
def gagent_check_with_migrate(self, test, params, env):
"""
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册