eiwd

no dbus iwd with iwctl functionality
git clone https://git.daat.foo/repos/eiwd.git
Log | Files | Refs | Submodules | README | LICENSE

commit e70d7e0857058e0cee1f51343e690a4a5ba29a79
parent f199e3f40d06eea9ac3db6b0e2abd903bc10af08
Author: James Prestwood <prestwoj@gmail.com>
Date:   Wed,  6 Apr 2022 12:14:49 -0700

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.

Diffstat:
Mtools/run-tests | 5++++-
Mtools/utils.py | 23++++++++++++++++++++++-
2 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/tools/run-tests b/tools/run-tests @@ -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) diff --git a/tools/utils.py b/tools/utils.py @@ -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: