diff options
author | Tom Rini <trini@konsulko.com> | 2024-12-31 19:00:54 -0600 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2025-01-01 10:40:33 -0600 |
commit | 2eb74974de5204835e81b81098dab1591fd99df5 (patch) | |
tree | 76b6ffcd649422cd0755efa6cb1e831eaff9597f /test/py/tests/test_trace.py | |
parent | 788b4609dbbbf1e058836b42967e58ffcbdc3bb1 (diff) | |
parent | edef0916668631b4fce956a9cfac252ffb2c0a9c (diff) |
Merge patch series "Add 'trace wipe'"
Jerome Forissier <jerome.forissier@linaro.org> says:
This short series adds the 'trace wipe' command which clears the trace
buffer, allowing to re-start a capture from scratch.
Link: https://lore.kernel.org/r/cover.1734093566.git.jerome.forissier@linaro.org
Diffstat (limited to 'test/py/tests/test_trace.py')
-rw-r--r-- | test/py/tests/test_trace.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/py/tests/test_trace.py b/test/py/tests/test_trace.py index ec1e624722c..44239da5280 100644 --- a/test/py/tests/test_trace.py +++ b/test/py/tests/test_trace.py @@ -70,6 +70,32 @@ def collect_trace(cons): return fname, int(dm_f_time[0]) +def wipe_and_collect_trace(cons): + """Pause and wipe traces, return the number of calls (should be zero) + + Args: + cons (ConsoleBase): U-Boot console + + Returns: + int: the number of traced function calls reported by 'trace stats' + """ + cons.run_command('trace pause') + cons.run_command('trace wipe') + out = cons.run_command('trace stats') + + # The output is something like this: + # 117,221 function sites + # 0 function calls + # 0 untracked function calls + # 0 traced function calls + + # Get a dict of values from the output + lines = [line.split(maxsplit=1) for line in out.splitlines() if line] + vals = {key: val.replace(',', '') for val, key in lines} + + return int(vals['traced function calls']) + + def check_function(cons, fname, proftool, map_fname, trace_dat): """Check that the 'function' output works @@ -304,3 +330,7 @@ def test_trace(u_boot_console): # This allows for CI being slow to run diff = abs(fg_time - dm_f_time) assert diff / dm_f_time < 0.3 + + # Check that the trace buffer can be wiped + numcalls = wipe_and_collect_trace(cons) + assert numcalls == 0 |