Skip to content

Commit a1c8ff6

Browse files
committed
Allow for configurable extra vm dump checks for present/absent messages
The typical use for this is when dumping extra logs and wanting to make sure certain information is always present (e.g. startup, etc.) and certain information is always absent (e.g. segfaults, etc.). Signed-off-by: Plamen Dimitrov <plamen.dimitrov@intra2net.com>
1 parent de845c0 commit a1c8ff6

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

virttest/env_process.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@ def postprocess_vm(test, params, env, name):
679679
vm_extra_dumps = os.path.join(test.outputdir, "vm_extra_dumps")
680680
if not os.path.exists(vm_extra_dumps):
681681
os.makedirs(vm_extra_dumps)
682-
for dump_path in params.get("vm_extra_dump_paths").split(";"):
682+
for i, dump_path in enumerate(params.get_list("vm_extra_dump_paths", delimiter=";")):
683683
try:
684684
vm.copy_files_from(dump_path, vm_extra_dumps)
685685
except:
@@ -688,6 +688,17 @@ def postprocess_vm(test, params, env, name):
688688
dump_path,
689689
vm.name,
690690
)
691+
if params.get_boolean(f"verify_vm_extra_dump_{i}"):
692+
for message in params.get_list(f"expected_vm_extra_dump_{i}", delimiter=";"):
693+
if not vm.session.cmd(f"grep {message} {dump_path}"):
694+
raise exceptions.TestFail(
695+
"Missing expected message {message} in {vm.name} extra dump {dump_path}"
696+
)
697+
for message in params.get_list(f"unexpected_vm_extra_dump_{i}", delimiter=";"):
698+
if not vm.session.cmd(f"grep {message} -v {dump_path}"):
699+
raise exceptions.TestFail(
700+
"Redundant unexpected message {message} in {vm.name} extra dump {dump_path}"
701+
)
691702

692703
if params.get("kill_vm") == "yes":
693704
kill_vm_timeout = float(params.get("kill_vm_timeout", 0))

0 commit comments

Comments
 (0)