提交 e8f44c43 编写于 作者: L Lukáš Doktor 提交者: Lucas Meneghel Rodrigues

qemu.tests.virtio_console: Kill immortal background threads

Take care of freezed sender thread everywhere as in 66e657
Signed-off-by: NLukáš Doktor <ldoktor@redhat.com>
上级 654adf4b
...@@ -698,6 +698,7 @@ def run_virtio_console(test, params, env): ...@@ -698,6 +698,7 @@ def run_virtio_console(test, params, env):
for thread in threads: for thread in threads:
if thread.isAlive(): if thread.isAlive():
vm.destroy()
del exit_event del exit_event
del threads[:] del threads[:]
raise error.TestError("Not all threads finished.") raise error.TestError("Not all threads finished.")
...@@ -1018,7 +1019,13 @@ def run_virtio_console(test, params, env): ...@@ -1018,7 +1019,13 @@ def run_virtio_console(test, params, env):
error.context("Stopping loopback", logging.info) error.context("Stopping loopback", logging.info)
exit_event.set() exit_event.set()
workaround_unfinished_threads = False workaround_unfinished_threads = False
for thread in threads: threads[0].join(5)
if threads[0].isAlive():
workaround_unfinished_threads = True
logging.error('Send thread stuck, destroing the VM and '
'stopping loopback test to prevent autotest freeze.')
vm.destroy()
for thread in threads[1:]:
logging.debug('Joining %s', thread) logging.debug('Joining %s', thread)
thread.join(5) thread.join(5)
if thread.isAlive(): if thread.isAlive():
...@@ -1047,6 +1054,7 @@ def run_virtio_console(test, params, env): ...@@ -1047,6 +1054,7 @@ def run_virtio_console(test, params, env):
for thread in threads: for thread in threads:
if thread.isAlive(): if thread.isAlive():
vm.destroy()
del exit_event del exit_event
del threads[:] del threads[:]
raise error.TestError("Not all threads finished.") raise error.TestError("Not all threads finished.")
...@@ -1371,7 +1379,9 @@ def run_virtio_console(test, params, env): ...@@ -1371,7 +1379,9 @@ def run_virtio_console(test, params, env):
threads[0].join(5) threads[0].join(5)
if threads[0].isAlive(): if threads[0].isAlive():
workaround_unfinished_threads = True workaround_unfinished_threads = True
logging.debug("Unable to destroy the thread %s", threads[0]) logging.error('Send thread stuck, destroing the VM and '
'stopping loopback test to prevent autotest freeze.')
vm.destroy()
tmp = "%d data sent; " % threads[0].idx tmp = "%d data sent; " % threads[0].idx
err = "" err = ""
...@@ -1395,6 +1405,7 @@ def run_virtio_console(test, params, env): ...@@ -1395,6 +1405,7 @@ def run_virtio_console(test, params, env):
for thread in threads: for thread in threads:
if thread.isAlive(): if thread.isAlive():
vm.destroy()
del exit_event del exit_event
del threads[:] del threads[:]
raise error.TestError("Not all threads finished.") raise error.TestError("Not all threads finished.")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册