mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-22 04:32:37 +01:00
test-runner: write separators for transient processes
Many processes are not long running (e.g. hostapd_cli, ip, iw, etc) and the separators written to log files don't show up for these which makes debugging difficult. This is even true for IWD/Hostapd for tests with start_iwd=0. After writing separators for long running processes write them out for any additional log files too.
This commit is contained in:
parent
f199e3f40d
commit
e70d7e0857
@ -724,7 +724,10 @@ def start_test(ctx, subtests, rqueue):
|
||||
|
||||
sys.__stdout__.flush()
|
||||
|
||||
Process.write_separators("\n====== %s:%s ======\n\n" % (file, func))
|
||||
name = os.path.basename(os.getcwd())
|
||||
|
||||
Process.write_separators(name, "\n====== %s:%s:%s ======\n\n" %
|
||||
(name, file, func))
|
||||
|
||||
if not skip:
|
||||
# Run test (setUp/tearDown run automatically)
|
||||
|
@ -131,12 +131,33 @@ class Process(subprocess.Popen):
|
||||
sys.__stdout__.flush()
|
||||
|
||||
@classmethod
|
||||
def write_separators(cls, sep):
|
||||
def write_separators(cls, test, sep):
|
||||
#
|
||||
# There are either log running processes (cls.processes) or
|
||||
# processes that have terminated already but a log file exists
|
||||
# on disk. We still want the separators to show for both cases
|
||||
# so after writing separators for running processes, also
|
||||
# write them in any additional log files.
|
||||
#
|
||||
nowrite = []
|
||||
|
||||
for proc in cls.processes.values():
|
||||
if proc.killed:
|
||||
continue
|
||||
|
||||
cls._write_io(proc, sep, stdout=False)
|
||||
nowrite.append(proc.args[0])
|
||||
|
||||
if cls.testargs.log:
|
||||
logfiles = os.listdir('%s/%s' % (cls.testargs.log, test))
|
||||
|
||||
extra = list(set(logfiles) - set(nowrite))
|
||||
|
||||
for log in extra:
|
||||
logfile = '%s/%s/%s' % (cls.testargs.log, test, log)
|
||||
with open(logfile, 'a') as f:
|
||||
f.write(sep)
|
||||
f.close()
|
||||
|
||||
def process_io(self, source, condition):
|
||||
if condition & GLib.IO_HUP:
|
||||
|
Loading…
Reference in New Issue
Block a user