Skip to content

Commit 3805286

Browse files
Andy Rosscarlescufi
authored andcommitted
boards/intel_adsp_cavs15: Add --no-history argument to adsplog.py
The default behavior of the log reader is to dump the full device trace buffer. But that can contain output from a previous run and the state parser in twister can get confused. Add a "--no-history" argument that emits only new log data, which corresponds more closely to the way a hardware UART would work. (Code change is just two lines, everything else is comments & docs) Fixes #30979 Signed-off-by: Andy Ross <[email protected]>
1 parent 64cc5a3 commit 3805286

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

boards/xtensa/intel_adsp_cavs15/doc/index.rst

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,17 @@ Integration Testing With Twister
109109
================================
110110

111111
The ADSP hardware also has integration for testing using the twister
112-
tool. The ``adsplog`` script can be used unmodified as the
112+
tool. The ``adsplog`` script can be used as the
113113
``--device-serial-pty`` handler, and the west flash script should take
114-
a path to the same key file used above.
114+
a path to the same key file used above. Remember to pass the
115+
``--no-history`` argument to ``adsplog.py``, because by default it
116+
will dump the current log buffer, which may contain output from a
117+
previous test run.
115118

116119
.. code-block:: console
117120
118121
$ZEPHYR_BASE/scripts/twister --device-testing -p intel_adsp_cavs15 \
119-
--device-serial-pty $ZEPHYR_BASE/boards/xtensa/intel_adsp_cavs15/tools/adsplog.py \
122+
--device-serial-pty $ZEPHYR_BASE/boards/xtensa/intel_adsp_cavs15/tools/adsplog.py,--no-history \
120123
--west-flash $ZEPHYR_BASE/boards/xtensa/intel_adsp_cavs15/tools/flash.sh,$PATH_TO_KEYFILE.pem
121124
122125
.. target-notes::

boards/xtensa/intel_adsp_cavs15/tools/adsplog.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@
1111

1212
# Log reader for the trace output buffer on a ADSP device.
1313
#
14+
# When run with no arguments, it will detect the device, dump the
15+
# contents of the trace buffer and continue to poll for more output.
16+
# The "--no-history" argument can be passed to suppress emission of the
17+
# history, and emit only new output. This can be useful for test
18+
# integration where the user does not want to see any previous runs in
19+
# the log output.
20+
#
1421
# The trace buffer is inside a shared memory region exposed by the
1522
# audio PCI device as a BAR at index 4. The hardware provides 4 128k
1623
# "windows" starting at 512kb in the BAR which the DSP firmware can
@@ -170,7 +177,13 @@ def trace_history():
170177
# polling.
171178
def main():
172179
next_slot, next_id, last_hist = trace_history()
173-
sys.stdout.write(last_hist)
180+
181+
# We only have one command line argument, to suppress the history
182+
# dump at the start (so CI runs don't see e.g. a previous device
183+
# state containing logs from another test, and get confused)
184+
if len(sys.argv) < 2 or sys.argv[1] != "--no-history":
185+
sys.stdout.write(last_hist)
186+
174187
while True:
175188
id, smsg = read_slot(next_slot, mem)
176189

0 commit comments

Comments
 (0)