test attachp with inexistent pid: add timeout

pull/1032/head
disconnect3d 3 years ago
parent d49b29d150
commit dbd55e650f

@ -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

@ -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')

Loading…
Cancel
Save