AArch64 EL2 hypervisor for QEMU virt that boots at EL2
1import subprocess
2import sys
3
4
5def run_log_decode(input_text: str, *args: str) -> str:
6 proc = subprocess.run(
7 [sys.executable, "tools/log_decode.py", *args],
8 input=input_text,
9 text=True,
10 check=True,
11 capture_output=True,
12 )
13 return proc.stdout
14
15
16sample = (
17 "event seq=7 vcpu=0 kind=trap ec=0x18 name=sctlr_el1 dir=write action=3 reason=104\n"
18 "event seq=8 vcpu=0 kind=hvc ec=0x16 name=- dir=write action=0 reason=300\n"
19)
20
21plain = run_log_decode(sample)
22assert "seq=7" in plain
23assert "name=sctlr_el1" in plain
24assert "seq=8" in plain
25
26summary = run_log_decode(sample, "--summary")
27assert "events: 2" in summary
28assert "trap: 1" in summary
29assert "hvc: 1" in summary
30assert "sctlr_el1: 1" in summary
31
32summary_events = run_log_decode(sample, "--summary", "--events")
33assert "seq=7" in summary_events
34assert "events: 2" in summary_events