1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-01-31 02:00:45 +00:00

collector/dmesg: Fix dmesg_out property

When no entry has been recorded by the collector, return an empty string
rather than returning the full dmesg log.

Also fix get_data() that would fail try to add None + '\n' if dmesg_out
property returns None.
This commit is contained in:
Douglas Raillard 2022-05-18 14:46:41 +01:00 committed by Marc Bonnici
parent cd8720b901
commit a9fcc75f60

View File

@ -202,7 +202,7 @@ class DmesgCollector(CollectorBase):
try:
entry = self.entries[0]
except IndexError:
i = 0
return ''
else:
i = entry.line_nr
return '\n'.join(out.splitlines()[i:])
@ -278,5 +278,5 @@ class DmesgCollector(CollectorBase):
if self.output_path is None:
raise RuntimeError("Output path was not set.")
with open(self.output_path, 'wt') as f:
f.write(self.dmesg_out + '\n')
f.write((self.dmesg_out or '') + '\n')
return CollectorOutput([CollectorOutputEntry(self.output_path, 'file')])