blob: fb10b80119b6432708dd96974a61755964fb3f38 [file] [log] [blame]
Paul Sokolovskyfdd85d62021-12-01 13:39:42 +03001#!/usr/bin/env python3
2#
3# Copyright (c) 2021, Linaro Limited
4#
5# SPDX-License-Identifier: BSD-3-Clause
6#
7
8import re
9import sys
10from subprocess import check_call
11
12
13PATTERN = "\
14Digest(\\s|\\w)*:\\s(\\w{2}\\s){16}|\
15 : (\\w{2}\\s){16}|\
16 Event\\w*\\s*:\\s\\w+\\s"
17
18
19# Extract pertinent information from TPM side.
20with open(sys.argv[1]) as f, open("ftpm_event_log", "w") as out:
21 for l in f:
22 m = re.search(PATTERN, l)
23 if m:
24 print(m.group(), file=out)
25
26# Extract pertinent information from TF side.
27with open(sys.argv[1].replace("uart1", "uart0")) as f, open("tfa_event_log", "w") as out:
28 for l in f:
29 m = re.search(PATTERN, l)
30 if m:
31 print(m.group(), file=out)
32
33# Compare it to match.
34check_call("diff -s -u tfa_event_log ftpm_event_log", shell=True)