Skip to content

Commit

Permalink
tap2json: add the time info in ms
Browse files Browse the repository at this point in the history
Useful info to display.

Signed-off-by: Matthieu Baerts (NGI0) <[email protected]>
  • Loading branch information
matttbe committed Aug 21, 2024
1 parent 1bc0b01 commit 9a3968d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tap2json.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def get_args_parser():

# Same as in NIPA
TAP_RE = re.compile(r"(not )?ok (\d+)( -)? ([^#]*[^ ])( # )?([^ ].*)?$")
TIME_RE = re.compile(r"time=([0-9.]+)ms")

def parse_tap(tap, name, only_fails):
results = {}
Expand Down Expand Up @@ -80,6 +81,10 @@ def parse_tap(tap, name, only_fails):
elif r[5].lower().startswith('ignore flaky'):
result['result'] = "flaky"

t = TIME_RE.findall(r[5].lower()).groups()
if t:
result['time_ms'] = t[-1] # take the last one

if only_fails and result['result'] == "pass":
continue

Expand Down

0 comments on commit 9a3968d

Please sign in to comment.