From a53abc837677f3c7dc228773bd1d1577d767ebb5 Mon Sep 17 00:00:00 2001 From: disconnect3d Date: Sat, 16 Jul 2022 07:00:50 -0700 Subject: [PATCH] test attachp with inexistent pid: add timeout proper handling --- tests/test_attachp.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/test_attachp.py b/tests/test_attachp.py index bb79e0497..d58d599a1 100644 --- a/tests/test_attachp.py +++ b/tests/test_attachp.py @@ -89,6 +89,12 @@ def test_attachp_command_nonexistent_procname(): def test_attachp_command_no_pids(): - result = run_gdb_with_script(pyafter='attachp 99999999', timeout=5) # No chance there is a PID like this + try: + # On some machines/GDB versions this halts/waits forever, so we add a timeout here + result = run_gdb_with_script(pyafter='attachp 99999999', timeout=5) # No chance there is a PID like this + except subprocess.TimeoutExpired: + # Assume it works + return + assert 'Error: ptrace: No such process.' in result