tests: Exit: Try sleeping multiple times

This commit is contained in:
Fabian Homborg 2020-08-08 16:06:11 +02:00
parent 7c0ecf0d37
commit b4f5ba6537

View File

@ -50,12 +50,15 @@ expect_prompt()
# Verify that asking to exit a second time does so.
send("exit\r")
# This is cheesy, but on Travis with thread-sanitizer this can be slow enough that the process is still running, so we sleep for a bit.
time.sleep(0.5)
proc = subprocess.run(
["pgrep", "-l", "-f", "sleep 11"], stdout=subprocess.PIPE, stderr=subprocess.PIPE
)
if proc.returncode == 0:
for t in range(0,3):
proc = subprocess.run(
["pgrep", "-l", "-f", "sleep 11"], stdout=subprocess.PIPE, stderr=subprocess.PIPE
)
if proc.returncode != 0:
break
# This is cheesy, but on Travis with thread-sanitizer this can be slow enough that the process is still running, so we sleep for a bit.
time.sleep(1)
else:
print("Commands still running")
print(proc.stdout)
sys.exit(1)