mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-18 06:38:38 +01:00
feat(repo): scenario-status makes the table from the runs
This commit is contained in:
1 parent
781b082778
commit
37bb9e3fe4
3 files changed
+270
No files matched your search
Executable
+36
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Makes the scenario-by-port status table from the logs of runs on KDE and the result files of
|
||||
kfw (see nix/tests/vm/lib/komorebi_vm/status.py).
|
||||
|
||||
scripts/scenario-status --kde LOG... [--windows DIR...] [--update docs/dev/BEHAVIOUR.md]
|
||||
|
||||
Without --update the table is printed. With it, what is between the two comment markers
|
||||
(`<!-- scenario-status:begin -->` and `<!-- scenario-status:end -->`) of the file is replaced.
|
||||
"""
|
||||
|
||||
import argparse
|
||||
import importlib.util
|
||||
from pathlib import Path
|
||||
|
||||
path = Path(__file__).resolve().parent.parent / "nix/tests/vm/lib/komorebi_vm/status.py"
|
||||
spec = importlib.util.spec_from_file_location("status", path)
|
||||
assert spec and spec.loader
|
||||
status = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(status)
|
||||
|
||||
parser = argparse.ArgumentParser(description=__doc__.split("\n")[0])
|
||||
parser.add_argument("--kde", nargs="*", default=[], type=Path, help="logs of runs on KDE")
|
||||
parser.add_argument("--windows", nargs="*", default=[], type=Path, help="directories of kfw results")
|
||||
parser.add_argument("--update", type=Path, help="the document to put the table in")
|
||||
args = parser.parse_args()
|
||||
|
||||
found = status.Status()
|
||||
for log in args.kde:
|
||||
status.read_kde(found, log.read_text(errors="replace"))
|
||||
for directory in args.windows:
|
||||
status.read_windows(found, directory)
|
||||
text = status.table(found)
|
||||
if args.update:
|
||||
args.update.write_text(status.replace_region(args.update.read_text(), text))
|
||||
else:
|
||||
print(text, end="")
|
||||
Reference in new issue
Block a user