mirror of
https://github.com/postgrespro/pg_probackup.git
synced 2025-02-03 14:01:57 +02:00
tests: store gdb output internally
This commit is contained in:
parent
0876dd6190
commit
9fcf99034d
@ -1757,6 +1757,7 @@ class GdbException(Exception):
|
||||
class GDBobj(ProbackupTest):
|
||||
def __init__(self, cmd, verbose, attach=False):
|
||||
self.verbose = verbose
|
||||
self.output = ''
|
||||
|
||||
# Check gdb presense
|
||||
try:
|
||||
@ -1801,7 +1802,8 @@ class GDBobj(ProbackupTest):
|
||||
# discard data from pipe,
|
||||
# is there a way to do it a less derpy way?
|
||||
while True:
|
||||
line = self.proc.stdout.readline()
|
||||
# line = self.proc.stdout.readline()
|
||||
line = self.get_line()
|
||||
|
||||
if 'No such process' in line:
|
||||
raise GdbException(line)
|
||||
@ -1811,6 +1813,12 @@ class GDBobj(ProbackupTest):
|
||||
else:
|
||||
break
|
||||
|
||||
def get_line(self):
|
||||
line = self.proc.stdout.readline()
|
||||
# self.output += repr(line) + '\n'
|
||||
self.output += line
|
||||
return line
|
||||
|
||||
def kill(self):
|
||||
self.proc.kill()
|
||||
self.proc.wait()
|
||||
@ -1932,10 +1940,8 @@ class GDBobj(ProbackupTest):
|
||||
'Failed to continue execution until break.\n')
|
||||
|
||||
def stopped_in_breakpoint(self):
|
||||
output = []
|
||||
while True:
|
||||
line = self.proc.stdout.readline()
|
||||
output += [line]
|
||||
line = self.get_line()
|
||||
if self.verbose:
|
||||
print(line)
|
||||
if line.startswith('*stopped,reason="breakpoint-hit"'):
|
||||
@ -1952,7 +1958,7 @@ class GDBobj(ProbackupTest):
|
||||
|
||||
# look for command we just send
|
||||
while True:
|
||||
line = self.proc.stdout.readline()
|
||||
line = self.get_line()
|
||||
if self.verbose:
|
||||
print(repr(line))
|
||||
|
||||
@ -1962,7 +1968,7 @@ class GDBobj(ProbackupTest):
|
||||
break
|
||||
|
||||
while True:
|
||||
line = self.proc.stdout.readline()
|
||||
line = self.get_line()
|
||||
output += [line]
|
||||
if self.verbose:
|
||||
print(repr(line))
|
||||
|
Loading…
x
Reference in New Issue
Block a user