Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/tests/ftest/cart/util/cart_logparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,9 @@ def __init__(self, fname, check_encoding=False):
self.file_corrupt = False

self.bz2 = False
# Track whether the logfile ended without a trailing newline.
# This is common when a process is terminated abruptly (e.g. SIGKILL).
self.truncated_eof = False

# Force check encoding for smaller files.
stbuf = os.stat(fname)
Expand Down Expand Up @@ -552,6 +555,7 @@ def _load_data(self):
index = 0
for line in self._fd:
index += 1
self.truncated_eof = not line.endswith('\n')
if not LogLine.is_valid(line):
self._data.append(LogRaw(line))
else:
Expand All @@ -573,6 +577,7 @@ def _load_pids(self):
position = 0
for line in self._fd:
index += 1
self.truncated_eof = not line.endswith('\n')
if not LogLine.is_valid(line):
position += len(line)
continue
Expand Down
11 changes: 9 additions & 2 deletions src/tests/ftest/cart/util/cart_logtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ def _check_pid_from_log_file(self, pid, abort_on_warning, leak_wf, show_memleaks
warnings_strict = False
warnings_mode = False
server_shutdown = False
abrupt_eof = getattr(self._li, 'truncated_eof', False)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the getattr necessary? Since we define self.truncated_eof = False in __init__ it seems it would always be defined?


error_files = set()

Expand Down Expand Up @@ -540,15 +541,21 @@ def _check_pid_from_log_file(self, pid, abort_on_warning, leak_wf, show_memleaks
if active_desc:
for (_, line) in list(active_desc.items()):
show_line(line, 'NORMAL', 'desc not deregistered', custom=leak_wf)
raise ActiveDescriptors()
if abrupt_eof:
print('WARNING: log ended abruptly; skipping descriptor leak failure')
else:
raise ActiveDescriptors()

if active_rpcs:
for (_, line) in list(active_rpcs.items()):
show_line(line, 'NORMAL', 'rpc not deregistered')
if error_files or err_count:
raise LogError()
if not self.ftest_mode and mem_r.lost_memory:
raise NotAllFreed()
if abrupt_eof:
print('WARNING: log ended abruptly; skipping memory leak failure')
else:
raise NotAllFreed()
if warnings_strict:
raise WarningStrict()
if warnings_mode:
Expand Down
Loading