3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-25 09:39:25 +01:00

auto-t: timestamp log files in test-runner

The log files become much more useful when there are timestamps
associated with each log.
This commit is contained in:
James Prestwood 2024-02-14 11:30:21 -08:00 committed by Denis Kenzior
parent a507c08bfe
commit c54ef5a8da

View File

@ -6,6 +6,7 @@ import traceback
import shutil import shutil
import dbus import dbus
from datetime import datetime
from gi.repository import GLib from gi.repository import GLib
from weakref import WeakValueDictionary from weakref import WeakValueDictionary
from re import fullmatch from re import fullmatch
@ -125,7 +126,11 @@ class Process(subprocess.Popen):
@staticmethod @staticmethod
def _write_io(instance, data, stdout=True): def _write_io(instance, data, stdout=True):
for f in instance.write_fds: for f in instance.write_fds:
f.write(data) for c in data:
f.write(c)
if c == '\n':
stamp = datetime.strftime(datetime.now(), "%Y-%m-%d %H:%M:%S.%f")
f.write(stamp + ': ')
# Write out a separator so multiple process calls per # Write out a separator so multiple process calls per
# test are easer to read. # test are easer to read.