Skip to content

Commit 9fcf990

Browse files
committed
tests: store gdb output internally
1 parent 0876dd6 commit 9fcf990

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

tests/helpers/ptrack_helpers.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1757,6 +1757,7 @@ def __str__(self):
17571757
class GDBobj(ProbackupTest):
17581758
def __init__(self, cmd, verbose, attach=False):
17591759
self.verbose = verbose
1760+
self.output = ''
17601761

17611762
# Check gdb presense
17621763
try:
@@ -1801,7 +1802,8 @@ def __init__(self, cmd, verbose, attach=False):
18011802
# discard data from pipe,
18021803
# is there a way to do it a less derpy way?
18031804
while True:
1804-
line = self.proc.stdout.readline()
1805+
# line = self.proc.stdout.readline()
1806+
line = self.get_line()
18051807

18061808
if 'No such process' in line:
18071809
raise GdbException(line)
@@ -1811,6 +1813,12 @@ def __init__(self, cmd, verbose, attach=False):
18111813
else:
18121814
break
18131815

1816+
def get_line(self):
1817+
line = self.proc.stdout.readline()
1818+
# self.output += repr(line) + '\n'
1819+
self.output += line
1820+
return line
1821+
18141822
def kill(self):
18151823
self.proc.kill()
18161824
self.proc.wait()
@@ -1932,10 +1940,8 @@ def continue_execution_until_break(self, ignore_count=0):
19321940
'Failed to continue execution until break.\n')
19331941

19341942
def stopped_in_breakpoint(self):
1935-
output = []
19361943
while True:
1937-
line = self.proc.stdout.readline()
1938-
output += [line]
1944+
line = self.get_line()
19391945
if self.verbose:
19401946
print(line)
19411947
if line.startswith('*stopped,reason="breakpoint-hit"'):
@@ -1952,7 +1958,7 @@ def _execute(self, cmd, running=True):
19521958

19531959
# look for command we just send
19541960
while True:
1955-
line = self.proc.stdout.readline()
1961+
line = self.get_line()
19561962
if self.verbose:
19571963
print(repr(line))
19581964

@@ -1962,7 +1968,7 @@ def _execute(self, cmd, running=True):
19621968
break
19631969

19641970
while True:
1965-
line = self.proc.stdout.readline()
1971+
line = self.get_line()
19661972
output += [line]
19671973
if self.verbose:
19681974
print(repr(line))

0 commit comments

Comments
 (0)