diff --git a/libvirt/tests/src/virsh_cmd/domain/virsh_domjobinfo.py b/libvirt/tests/src/virsh_cmd/domain/virsh_domjobinfo.py index c14135ce66..5fc1b8f0d3 100644 --- a/libvirt/tests/src/virsh_cmd/domain/virsh_domjobinfo.py +++ b/libvirt/tests/src/virsh_cmd/domain/virsh_domjobinfo.py @@ -150,6 +150,14 @@ def cmp_jobinfo(result, info_list, job_type, actions): else: process = get_subprocess(action, vm_name, tmp_pipe, None) + try: + _, stderr = process.communicate(timeout=6) + if process.returncode: + os.unlink(tmp_pipe) + test.error('Background cmd met unexpected failure of %s, abort the test.' % stderr) + except subprocess.TimeoutExpired: + logging.debug("Background cmd is still running.") + f = open(tmp_pipe, 'rb') dummy = f.read(1024 * 1024).decode(locale.getpreferredencoding(), 'ignore')