Skip to content

Commit a0ddbf5

Browse files
committed
Tests: Revert timeout changes from gdb tests
There were additional `timeout=X` additions in #2382 which caused tests to fail randomly when a timeout was reached. The tests run through occationally, so it's not an infinite loop. But flakey tests are annoying and I don't see a reason for the timeout additions to the doctests for the core patch of that PR other than failing early during manual tests of new functionality. CI running smoothly is more important than fast failing during development on the gdb module imo.
1 parent 1be8ad7 commit a0ddbf5

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

pwnlib/gdb.py

+16-16
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ def debug_assembly(asm, gdbscript=None, vma=None, api=False):
195195
196196
>>> assembly = shellcraft.echo("Hello world!\n")
197197
>>> io = gdb.debug_assembly(assembly)
198-
>>> io.recvline(timeout=1)
198+
>>> io.recvline()
199199
b'Hello world!\n'
200200
"""
201201
tmp_elf = make_elf_from_assembly(asm, vma=vma, extract=False)
@@ -230,7 +230,7 @@ def debug_shellcode(data, gdbscript=None, vma=None, api=False):
230230
>>> assembly = shellcraft.echo("Hello world!\n")
231231
>>> shellcode = asm(assembly)
232232
>>> io = gdb.debug_shellcode(shellcode)
233-
>>> io.recvline(timeout=1)
233+
>>> io.recvline()
234234
b'Hello world!\n'
235235
"""
236236
if isinstance(data, six.text_type):
@@ -490,12 +490,12 @@ def debug(args, gdbscript=None, gdb_args=None, exe=None, ssh=None, env=None, por
490490
Send a command to Bash
491491
492492
>>> io.sendline(b"echo hello")
493-
>>> io.recvline(timeout=30)
493+
>>> io.recvline()
494494
b'hello\n'
495495
496496
Interact with the process
497497
498-
>>> io.interactive(timeout=1) # doctest: +SKIP
498+
>>> io.interactive() # doctest: +SKIP
499499
>>> io.close()
500500
501501
Create a new process, and stop it at '_start'
@@ -514,7 +514,7 @@ def debug(args, gdbscript=None, gdb_args=None, exe=None, ssh=None, env=None, por
514514
Send a command to Bash
515515
516516
>>> io.sendline(b"echo hello")
517-
>>> io.recvline(timeout=10)
517+
>>> io.recvline()
518518
b'hello\n'
519519
520520
Interact with the process
@@ -526,19 +526,19 @@ def debug(args, gdbscript=None, gdb_args=None, exe=None, ssh=None, env=None, por
526526
527527
>>> io = gdb.debug(args=[b'\xde\xad\xbe\xef'], gdbscript='continue', exe="/bin/sh")
528528
>>> io.sendline(b"echo $0")
529-
>>> io.recvline(timeout=10)
529+
>>> io.recvline()
530530
b'\xde\xad\xbe\xef\n'
531531
>>> io.close()
532532
533533
Demonstrate that LD_PRELOAD is respected
534534
535535
>>> io = process(["grep", "libc.so.6", "/proc/self/maps"])
536-
>>> real_libc_path = io.recvline(timeout=1).split()[-1]
536+
>>> real_libc_path = io.recvline().split()[-1]
537537
>>> io.close()
538538
>>> import shutil
539539
>>> local_path = shutil.copy(real_libc_path, "./local-libc.so") # make a copy of libc to demonstrate that it is loaded
540540
>>> io = gdb.debug(["grep", "local-libc.so", "/proc/self/maps"], gdbscript="continue", env={"LD_PRELOAD": "./local-libc.so"})
541-
>>> io.recvline(timeout=1).split()[-1] # doctest: +ELLIPSIS
541+
>>> io.recvline().split()[-1] # doctest: +ELLIPSIS
542542
b'.../local-libc.so'
543543
>>> io.close()
544544
>>> os.remove("./local-libc.so") # cleanup
@@ -572,15 +572,15 @@ def debug(args, gdbscript=None, gdb_args=None, exe=None, ssh=None, env=None, por
572572
573573
>>> io = gdb.debug(args=[b'\xde\xad\xbe\xef'], gdbscript='continue', exe="/bin/sh", ssh=shell)
574574
>>> io.sendline(b"echo $0")
575-
>>> io.recvline(timeout=10)
575+
>>> io.recvline()
576576
b'$ \xde\xad\xbe\xef\n'
577577
>>> io.close()
578578
579579
Using an empty args[0] on a remote process
580580
581581
>>> io = gdb.debug(args=[], gdbscript='continue', exe="/bin/sh", ssh=shell)
582582
>>> io.sendline(b"echo $0")
583-
>>> io.recvline(timeout=10)
583+
>>> io.recvline()
584584
b'$ \n'
585585
>>> io.close()
586586
@@ -620,12 +620,12 @@ def debug(args, gdbscript=None, gdb_args=None, exe=None, ssh=None, env=None, por
620620
Resume the program
621621
622622
>>> io.gdb.continue_nowait()
623-
>>> io.recvline(timeout=1)
623+
>>> io.recvline()
624624
b'foo\n'
625625
>>> io.close()
626626
627627
>>> ssh_io.gdb.continue_nowait()
628-
>>> ssh_io.recvline(timeout=1)
628+
>>> ssh_io.recvline()
629629
b'foo\n'
630630
>>> ssh_io.close()
631631
>>> shell.close()
@@ -978,7 +978,7 @@ def attach(target, gdbscript = '', exe = None, gdb_args = None, ssh = None, sysr
978978
... detach
979979
... quit
980980
... ''')
981-
>>> io.recvline(timeout=10)
981+
>>> io.recvline()
982982
b'Hello from process debugger!\n'
983983
>>> io.sendline(b'echo Hello from bash && exit')
984984
>>> io.recvall()
@@ -1005,7 +1005,7 @@ def attach(target, gdbscript = '', exe = None, gdb_args = None, ssh = None, sysr
10051005
10061006
Observe the forced line
10071007
1008-
>>> io.recvline(timeout=1)
1008+
>>> io.recvline()
10091009
b'Hello from process debugger!\n'
10101010
10111011
Interact with the program in a regular way
@@ -1029,7 +1029,7 @@ def attach(target, gdbscript = '', exe = None, gdb_args = None, ssh = None, sysr
10291029
... detach
10301030
... quit
10311031
... ''')
1032-
>>> io.recvline(timeout=10)
1032+
>>> io.recvline()
10331033
b'Hello from remote debugger!\n'
10341034
>>> io.sendline(b'echo Hello from bash && exit')
10351035
>>> io.recvall()
@@ -1048,7 +1048,7 @@ def attach(target, gdbscript = '', exe = None, gdb_args = None, ssh = None, sysr
10481048
>>> io.recvline(timeout=5) # doctest: +SKIP
10491049
b'Hello from ssh debugger!\n'
10501050
>>> io.sendline(b'This will be echoed back')
1051-
>>> io.recvline(timeout=1)
1051+
>>> io.recvline()
10521052
b'This will be echoed back\n'
10531053
>>> io.close()
10541054
"""

0 commit comments

Comments
 (0)