Paul Sokolovsky | fdd85d6 | 2021-12-01 13:39:42 +0300 | [diff] [blame^] | 1 | #!/usr/bin/env python3 |
| 2 | # |
| 3 | # Copyright (c) 2021, Linaro Limited |
| 4 | # |
| 5 | # SPDX-License-Identifier: BSD-3-Clause |
| 6 | # |
| 7 | |
| 8 | import re |
| 9 | import sys |
| 10 | from subprocess import check_call |
| 11 | |
| 12 | |
| 13 | PATTERN = "\ |
| 14 | Digest(\\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. |
| 20 | with 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. |
| 27 | with 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. |
| 34 | check_call("diff -s -u tfa_event_log ftpm_event_log", shell=True) |