tests: Terminate sigma_dut more forcefully if needed
Wait for stdout/stderr in a more robust manner to avoid blocking the pipes and kill the sigma_dut process if it fails to terminate cleanly. Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
0776c51ed7
commit
cefd959566
1 changed files with 11 additions and 4 deletions
|
@ -164,10 +164,17 @@ def stop_sigma_dut(sigma):
|
||||||
sigma_log_output(cmd)
|
sigma_log_output(cmd)
|
||||||
logger.debug("Terminating sigma_dut process")
|
logger.debug("Terminating sigma_dut process")
|
||||||
cmd.terminate()
|
cmd.terminate()
|
||||||
cmd.wait()
|
try:
|
||||||
|
out, err = cmd.communicate(timeout=200)
|
||||||
|
logger.debug("sigma_dut stdout: " + str(out.decode()))
|
||||||
|
logger.debug("sigma_dut stderr: " + str(err.decode()))
|
||||||
|
except subprocess.TimeoutExpired:
|
||||||
|
logger.debug("sigma_dut termination timed out")
|
||||||
|
cmd.kill()
|
||||||
out, err = cmd.communicate()
|
out, err = cmd.communicate()
|
||||||
logger.debug("sigma_dut stdout: " + str(out.decode()))
|
logger.debug("sigma_dut stdout: " + str(out.decode()))
|
||||||
logger.debug("sigma_dut stderr: " + str(err.decode()))
|
logger.debug("sigma_dut stderr: " + str(err.decode()))
|
||||||
|
|
||||||
subprocess.call(["ip", "addr", "del", "dev", sigma['ifname'],
|
subprocess.call(["ip", "addr", "del", "dev", sigma['ifname'],
|
||||||
"127.0.0.11/24"],
|
"127.0.0.11/24"],
|
||||||
stderr=open('/dev/null', 'w'))
|
stderr=open('/dev/null', 'w'))
|
||||||
|
|
Loading…
Reference in a new issue