aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2022-03-04 08:43:07 -0700
committerTom Rini <trini@konsulko.com>2022-03-10 08:28:36 -0500
commit9de3773a5cbdfd64e59bfe3bec78c59454650c9a (patch)
treeffb9e3009d8b9b9559b7cf784b9f47d0837092b9 /test
parentc81b460c860a81124af65d78724d34c1a815e3fe (diff)
downloadu-boot-9de3773a5cbdfd64e59bfe3bec78c59454650c9a.zip
u-boot-9de3773a5cbdfd64e59bfe3bec78c59454650c9a.tar.gz
u-boot-9de3773a5cbdfd64e59bfe3bec78c59454650c9a.tar.bz2
event: Add a script to decode the event-spy list
For debugging and dicoverability it is useful to be able to see a list of each event spy in a U-Boot ELF file. Add a script which shows this, along with the event type and the source location. This makes events a little easier to use than weak functions, for example. Add a basic sandbox test as well. We could provide a test for other boards, but for now, few use events. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'test')
-rw-r--r--test/py/tests/test_event_dump.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/py/tests/test_event_dump.py b/test/py/tests/test_event_dump.py
new file mode 100644
index 0000000..b753e80
--- /dev/null
+++ b/test/py/tests/test_event_dump.py
@@ -0,0 +1,20 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright 2021 Google LLC
+# Written by Simon Glass <sjg@chromium.org>
+
+import pytest
+import re
+import u_boot_utils as util
+
+# This is only a partial test - coverting 64-bit sandbox. It does not test
+# big-endian images, nor 32-bit images
+@pytest.mark.boardspec('sandbox')
+def test_event_dump(u_boot_console):
+ """Test that the "help" command can be executed."""
+ cons = u_boot_console
+ sandbox = cons.config.build_dir + '/u-boot'
+ out = util.run_and_log(cons, ['scripts/event_dump.py', sandbox])
+ expect = '''.*Event type Id Source location
+-------------------- ------------------------------ ------------------------------
+EVT_MISC_INIT_F sandbox_misc_init_f .*arch/sandbox/cpu/start.c:'''
+ assert re.match(expect, out, re.MULTILINE) is not None