From e8f7395a8a296b9fb395f1ae9848abe6e556705a Mon Sep 17 00:00:00 2001 From: Miles Liu Date: Wed, 1 Feb 2023 17:56:16 +0800 Subject: [PATCH] docs: fix invalid test status in gnu-full-result --- util/gnu-json-result.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/util/gnu-json-result.py b/util/gnu-json-result.py index 2f50a1963..1cd16e64c 100644 --- a/util/gnu-json-result.py +++ b/util/gnu-json-result.py @@ -3,9 +3,9 @@ Extract the GNU logs into a JSON file. """ import json -from pathlib import Path +import re import sys -from os import environ +from pathlib import Path out = {} @@ -20,7 +20,11 @@ for filepath in test_dir.glob("**/*.log"): try: with open(path) as f: content = f.read() - current[path.name] = content.split("\n")[-2].split(" ")[0] + result = re.search( + r"(PASS|FAIL|SKIP|ERROR) [^ ]+ \(exit status: \d+\)$", content + ) + if result: + current[path.name] = result.group(1) except: pass