mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-27 11:07:44 +00:00
docs: add page with test coverage
This commit is contained in:
parent
1167d811d5
commit
ac11d8793e
6 changed files with 182 additions and 1 deletions
27
util/gnu-json-result.py
Normal file
27
util/gnu-json-result.py
Normal file
|
@ -0,0 +1,27 @@
|
|||
"""
|
||||
Extract the GNU logs into a JSON file.
|
||||
"""
|
||||
|
||||
import json
|
||||
from pathlib import Path
|
||||
import sys
|
||||
from os import environ
|
||||
|
||||
out = {}
|
||||
|
||||
test_dir = Path(sys.argv[1])
|
||||
for filepath in test_dir.glob("**/*.log"):
|
||||
path = Path(filepath)
|
||||
current = out
|
||||
for key in path.parent.relative_to(test_dir).parts:
|
||||
if key not in current:
|
||||
current[key] = {}
|
||||
current = current[key]
|
||||
try:
|
||||
with open(path) as f:
|
||||
content = f.read()
|
||||
current[path.name] = content.split("\n")[-2].split(" ")[0]
|
||||
except:
|
||||
pass
|
||||
|
||||
print(json.dumps(out, indent=2, sort_keys=True))
|
Loading…
Add table
Add a link
Reference in a new issue