Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions test-case/sof_io_read-ftrace.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash
set -e

# Uses the function graph tracer to collect execution details for sof_io_read

main() {
# Temporary, this puts logs in the dir of the hijacked script
BASH_ARGV0=test-speaker.sh
# shellcheck source=case-lib/lib.sh
source "$(dirname "${BASH_SOURCE[0]}")"/../case-lib/lib.sh

# Clear existing trace logs
sudo bash -c "'echo > /sys/kernel/debug/tracing/trace'"
# Setup tracing
sudo bash -c "'echo > /sys/kernel/debug/tracing/set_ftrace_filter'"
sudo bash -c "'echo sof_io_read > /sys/kernel/debug/tracing/set_graph_function'"
sudo bash -c "'echo function_graph > /sys/kernel/debug/tracing/current_tracer'"
sudo bash -c "'echo 1 > /sys/kernel/debug/tracing/tracing_on'"
# Trigger `sof_io_read`s
aplay -Dhw:0,0 -c2 -r48000 -c2 -fS16_LE -d 5 /dev/urandom
# Save trace
sudo cat /sys/kernel/debug/tracing/trace > "$LOG_ROOT/trace.txt"
# Clear tracing config
sudo bash -c "'echo > /sys/kernel/debug/tracing/current_tracer'"
sudo bash -c "'echo > /sys/kernel/debug/tracing/set_graph_function'"
sudo bash -c "'echo 0 > /sys/kernel/debug/tracing/tracing_on'"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put all the /sys/kernel/debug configs in a separate file and run it all with sudo.

}

main
3 changes: 3 additions & 0 deletions test-case/test-speaker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
## hear "front left" from the front left speaker.
##

# Hijacking temporarily to get new test to run on CI
exec $(dirname ${BASH_SOURCE[0]})/sof_io_read-ftrace.sh

source $(dirname ${BASH_SOURCE[0]})/../case-lib/lib.sh

OPT_NAME['t']='tplg' OPT_DESC['t']='tplg file, default value is env TPLG: $TPLG'
Expand Down