diff --git a/tests/test_attachp.py b/tests/test_attachp.py index 0dfa5836c..bb79e0497 100644 --- a/tests/test_attachp.py +++ b/tests/test_attachp.py @@ -89,6 +89,6 @@ def test_attachp_command_nonexistent_procname(): def test_attachp_command_no_pids(): - result = run_gdb_with_script(pyafter='attachp 99999999') # No chance there is a PID like this + result = run_gdb_with_script(pyafter='attachp 99999999', timeout=5) # No chance there is a PID like this assert 'Error: ptrace: No such process.' in result diff --git a/tests/utils.py b/tests/utils.py index 85f01d0b7..054a1213f 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -6,7 +6,7 @@ import subprocess launched_locally = not (os.environ.get('PWNDBG_GITHUB_ACTIONS_TEST_RUN')) -def run_gdb_with_script(binary='', core='', pybefore=None, pyafter=None): +def run_gdb_with_script(binary='', core='', pybefore=None, pyafter=None, timeout=None): """ Runs GDB with given commands launched before and after loading of gdbinit.py Returns GDB output. @@ -33,7 +33,7 @@ def run_gdb_with_script(binary='', core='', pybefore=None, pyafter=None): command += ['--eval-command', 'quit'] print("Launching command: %s" % command) - output = subprocess.check_output(command, stderr=subprocess.STDOUT) + output = subprocess.check_output(command, stderr=subprocess.STDOUT, timeout=timeout) # Python 3 returns bytes-like object so lets have it consistent output = codecs.decode(output, 'utf8')