From a4a8d42d283288fa33c3d3a4681c0d191123fb42 Mon Sep 17 00:00:00 2001 From: Emilia Kurdybelska Date: Mon, 2 Mar 2026 14:14:37 +0100 Subject: [PATCH] case-lib: refactor kernel logs collecting Start collecting kernel logs in the beggining of the test and run collection in the background. Signed-off-by: Emilia Kurdybelska --- case-lib/hijack.sh | 28 +------------ case-lib/lib.sh | 42 +++++++++++++++++-- test-case/check-8bit-play-rec.sh | 1 - test-case/check-alsa-conformance.sh | 2 - test-case/check-alsabat.sh | 1 - test-case/check-audio-equalizer.sh | 1 - test-case/check-capture.sh | 1 - test-case/check-float-play-rec.sh | 1 - test-case/check-fw-echo-reference.sh | 3 +- test-case/check-ipc-flood.sh | 5 +-- test-case/check-keyword-detection.sh | 3 +- test-case/check-kmod-load-unload.sh | 5 +-- test-case/check-pause-resume.sh | 1 - test-case/check-performance.sh | 1 - test-case/check-playback.sh | 1 - test-case/check-selector-play.sh | 1 - test-case/check-signal-stop-start.sh | 8 ++-- test-case/check-smart-amplifier.sh | 5 +-- test-case/check-src-play.sh | 1 - test-case/check-src-rec.sh | 1 - test-case/check-suspend-resume-with-audio.sh | 4 +- test-case/check-userspace-cardinfo.sh | 1 - test-case/check-userspace-paplay.sh | 8 ++-- test-case/check-userspace-parecord.sh | 8 ++-- test-case/check-volume-levels.sh | 1 - test-case/check-xrun-injection.sh | 5 +-- test-case/latency-metrics.sh | 2 - test-case/multiple-pipeline.sh | 6 +-- test-case/simultaneous-playback-capture.sh | 5 +-- test-case/test-jack-detection-dsp-d3.sh | 2 - .../test-jack-detection-playback-capture.sh | 2 - test-case/test-mic-privacy.sh | 2 - test-case/test-speaker.sh | 2 +- test-case/verify-bootsequence.sh | 1 - test-case/verify-firmware-presence.sh | 1 - test-case/verify-kernel-module-load-probe.sh | 2 - test-case/verify-pcm-list.sh | 2 - test-case/verify-tplg-binary.sh | 1 - test-case/volume-basic-test.sh | 1 - 39 files changed, 70 insertions(+), 98 deletions(-) diff --git a/case-lib/hijack.sh b/case-lib/hijack.sh index 6f14e954..f1d1b8a7 100644 --- a/case-lib/hijack.sh +++ b/case-lib/hijack.sh @@ -12,6 +12,8 @@ function func_exit_handler() dlogi "Starting func_exit_handler($exit_status)" + finish_kmsg_collection + func_lib_check_and_disable_pipewire # call trace @@ -134,32 +136,6 @@ function func_exit_handler() storage_checks || exit_status=1 fi - local journalctl_logs="$LOG_ROOT/dmesg.txt" - if [[ "$KERNEL_CHECKPOINT" =~ ^[0-9]{10} ]]; then - # Do not collect the entire duration of the test but only the - # last iteration. - dlogi "Save kernel messages since ${KERNEL_CHECKPOINT} to ${journalctl_logs}" - journalctl_cmd --since=@"$KERNEL_CHECKPOINT" > "${journalctl_logs}" - elif [[ "$KERNEL_CHECKPOINT" == "disabled" ]]; then - dlogi "Save all kernel messages to ${journalctl_logs}" - journalctl_cmd > "${journalctl_logs}" - else - dloge 'Kernel check point "KERNEL_CHECKPOINT" is not properly set' - dloge "KERNEL_CHECKPOINT=$KERNEL_CHECKPOINT" - test "$exit_status" -ne 0 || exit_status=1 - fi - if test -s "${journalctl_logs}"; then - wcLog=$(wc -l "${journalctl_logs}") - dlogi "nlines=$wcLog" - else - dlogw "Empty ${journalctl_logs}" - fi - # Make sure the logs are written on disk just in case of DUT power reset. - sync - - # After log collected, KERNEL_CHECKPOINT will not be used any more - unset KERNEL_CHECKPOINT - # get ps command result as list local -a cmd_lst # $$ as current script pid diff --git a/case-lib/lib.sh b/case-lib/lib.sh index 2e12e0e6..e4f300e7 100644 --- a/case-lib/lib.sh +++ b/case-lib/lib.sh @@ -83,6 +83,9 @@ minvalue() { printf '%d' $(( "$1" < "$2" ? "$1" : "$2" )); } # start_test() { + setup_kernel_check_point + func_kmsg_collect + if [ "$SOF_TEST_PIPEWIRE" == true ]; then func_lib_enable_pipewire fi @@ -97,7 +100,7 @@ start_test() } # func_exit_handler() is in hijack.sh - trap 'func_exit_handler $?' EXIT + trap 'func_exit_handler $?' EXIT SIGTERM if test -z "$MAX_WAIT_FW_LOADING"; then local _pltf; _pltf=$("$SCRIPT_HOME/tools/sof-dump-status.py" -p) @@ -157,7 +160,6 @@ start_test() local start_msg="$prefix: starting" dlogi "$start_msg" logger -p user.info "$start_msg" - } # See high-level description in start_test header above @@ -198,6 +200,23 @@ stop_test() } +finish_kmsg_collection() +{ + dlogi "Finishing dmesg collection" + sudo pkill -9 journalctl + + local journalctl_logs="$LOG_ROOT/dmesg.txt" + if test -s "${journalctl_logs}"; then + wcLog=$(wc -l "${journalctl_logs}") + dlogi "nlines=$wcLog" + else + dlogw "Empty ${journalctl_logs}" + fi + # Make sure the logs are written on disk just in case of DUT power reset. + sync +} + + ktime() { # Keep it coarse because of various delays. @@ -276,7 +295,9 @@ setup_kernel_check_point() # appear in the next one, see comments in config.sh. Add 3 extra # second to account for our own, sof-test delays after PASS/FAIL # decision: time spent collecting logs etc. - if [ -z "$KERNEL_CHECKPOINT" ]; then + if [[ "$KERNEL_CHECKPOINT" == "disabled" ]]; then + dlogi "KERNEL_CHECKPOINT already set as DISABLED" + elif [ -z "$KERNEL_CHECKPOINT" ]; then KERNEL_CHECKPOINT=$(($(date +%s) - SOF_TEST_INTERVAL - 3)) else # Not the first time we are called so this is a test @@ -408,6 +429,21 @@ func_mtrace_collect() sudo bash -c "${mtraceCmd[*]} &" >& "$clogfile" } +func_kmsg_collect() { + local journalctl_logs="$LOG_ROOT/dmesg.txt" + + if [[ "$KERNEL_CHECKPOINT" =~ ^[0-9]{10} ]]; then + dlogi "Saving kernel messages since ${KERNEL_CHECKPOINT} to ${journalctl_logs}" + journalctl_cmd --since=@"$KERNEL_CHECKPOINT" -f >> "${journalctl_logs}" & + elif [[ "$KERNEL_CHECKPOINT" == "disabled" ]]; then + dlogi "KERNEL_CHECKPOINT set as DISABLED, saving all kernel messages" + journalctl_cmd -f >> "${journalctl_logs}" & + else + dlogi "KERNEL_CHECKPOINT is not properly set, saving all kernel messages" + journalctl_cmd -f >> "${journalctl_logs}" & + fi +} + func_lib_log_post_process() { # SyS-T log output a Zephyr feature, no need postprocess diff --git a/test-case/check-8bit-play-rec.sh b/test-case/check-8bit-play-rec.sh index 3ac9631c..6c392882 100755 --- a/test-case/check-8bit-play-rec.sh +++ b/test-case/check-8bit-play-rec.sh @@ -116,7 +116,6 @@ main() logger_disabled || func_lib_start_log_collect - setup_kernel_check_point func_lib_check_sudo func_pipeline_export "$tplg" "type:any" diff --git a/test-case/check-alsa-conformance.sh b/test-case/check-alsa-conformance.sh index 5899944c..ec2ee4ac 100755 --- a/test-case/check-alsa-conformance.sh +++ b/test-case/check-alsa-conformance.sh @@ -325,8 +325,6 @@ main() { init_globals - setup_kernel_check_point - start_test check_alsa_conformance_suite diff --git a/test-case/check-alsabat.sh b/test-case/check-alsabat.sh index 1caf6733..22839694 100755 --- a/test-case/check-alsabat.sh +++ b/test-case/check-alsabat.sh @@ -61,7 +61,6 @@ OPT_NAME['s']='sof-logger' OPT_DESC['s']="Open sof-logger trace the data wi OPT_HAS_ARG['s']=0 OPT_VAL['s']=1 func_opt_parse_option "$@" -setup_kernel_check_point pcm_p=${OPT_VAL['p']} pcm_c=${OPT_VAL['c']} diff --git a/test-case/check-audio-equalizer.sh b/test-case/check-audio-equalizer.sh index 15941621..eeb5e93a 100755 --- a/test-case/check-audio-equalizer.sh +++ b/test-case/check-audio-equalizer.sh @@ -44,7 +44,6 @@ func_pipeline_export "$tplg" "eq:any" sofcard=${SOFCARD:-0} start_test -setup_kernel_check_point # Test equalizer func_test_eq() diff --git a/test-case/check-capture.sh b/test-case/check-capture.sh index 46674bd6..9b9088a2 100755 --- a/test-case/check-capture.sh +++ b/test-case/check-capture.sh @@ -75,7 +75,6 @@ if [[ -n "$new_tplg_filename" && "$TPLG" != *nocodec* ]]; then fi logger_disabled || func_lib_start_log_collect -setup_kernel_check_point func_lib_check_sudo func_pipeline_export "$tplg" "type:capture & ${OPT_VAL['S']}" diff --git a/test-case/check-float-play-rec.sh b/test-case/check-float-play-rec.sh index b052f279..1a043162 100755 --- a/test-case/check-float-play-rec.sh +++ b/test-case/check-float-play-rec.sh @@ -91,7 +91,6 @@ main() logger_disabled || func_lib_start_log_collect - setup_kernel_check_point func_lib_check_sudo func_pipeline_export "$tplg" "type:any" diff --git a/test-case/check-fw-echo-reference.sh b/test-case/check-fw-echo-reference.sh index 1e8ace9f..b4549c57 100755 --- a/test-case/check-fw-echo-reference.sh +++ b/test-case/check-fw-echo-reference.sh @@ -44,7 +44,6 @@ start_test logger_disabled || func_lib_start_log_collect func_pipeline_export "$tplg" "echo:any" -setup_kernel_check_point if [ "$PIPELINE_COUNT" != "2" ]; then die "Only detect $PIPELINE_COUNT pipeline(s) from topology, but two are needed" @@ -66,7 +65,7 @@ do fi done -for i in $(seq 1 $loop_cnt) +for i in $(seq 1 "$loop_cnt") do for fmt in $fmts do diff --git a/test-case/check-ipc-flood.sh b/test-case/check-ipc-flood.sh index c21605a5..ef4fbdbd 100755 --- a/test-case/check-ipc-flood.sh +++ b/test-case/check-ipc-flood.sh @@ -28,7 +28,6 @@ OPT_NAME['l']='loop' OPT_DESC['l']='loop count' OPT_HAS_ARG['l']=1 OPT_VAL['l']=1 func_opt_parse_option "$@" -setup_kernel_check_point lpc_loop_cnt=${OPT_VAL['c']} ipc_flood_dfs=${OPT_VAL['f']} @@ -47,12 +46,12 @@ sof-kernel-dump.sh | grep sof-audio | grep -q "Firmware debug" || func_lib_check_sudo dlogi "Check $ipc_flood_dfs" -sudo test -e $ipc_flood_dfs || +sudo test -e "$ipc_flood_dfs" || skip_test "${BASH_SOURCE[0]} need $ipc_flood_dfs to run the test case" dlogi "Running ipc flood test!" -for i in $(seq 1 $loop_cnt) +for i in $(seq 1 "$loop_cnt") do # TODO: use journalctl to replace dmesg # cleanup dmesg buffer for each iteration diff --git a/test-case/check-keyword-detection.sh b/test-case/check-keyword-detection.sh index ebcad8fd..9dd777e6 100755 --- a/test-case/check-keyword-detection.sh +++ b/test-case/check-keyword-detection.sh @@ -44,7 +44,6 @@ OPT_NAME['d']='duration' OPT_DESC['d']='interrupt kwd pipeline in # sec OPT_HAS_ARG['d']=1 OPT_VAL['d']=10 func_opt_parse_option "$@" -setup_kernel_check_point tplg=${OPT_VAL['t']} loop_cnt=${OPT_VAL['l']} @@ -107,7 +106,7 @@ _restore_default_wov_config_bolb() # update the blob _update_blob(){ new_blob=$test_dir"/new_blob" - [ $preamble_time -ge $history_depth ] || { + [ "$preamble_time" -ge "$history_depth" ] || { die "Warning: invalid arguments, preamble_time must be greater than or equal to history_depth" } awk -F, -v OFS=, '{if ( $4 == '"$def_pt"' && $7 == '"$def_hd"' ) $4='"$preamble_time"'; $7='"$history_depth"'}1' \ diff --git a/test-case/check-kmod-load-unload.sh b/test-case/check-kmod-load-unload.sh index 9e51729a..c3acdfca 100755 --- a/test-case/check-kmod-load-unload.sh +++ b/test-case/check-kmod-load-unload.sh @@ -36,7 +36,6 @@ OPT_NAME['p']='pulseaudio' OPT_DESC['p']='disable pulseaudio on the test proce OPT_HAS_ARG['p']=0 OPT_VAL['p']=1 func_opt_parse_option "$@" -setup_kernel_check_point start_test @@ -45,11 +44,11 @@ loop_cnt=${OPT_VAL['l']} PATH="${PATH%%:*}/kmod:$PATH" func_lib_check_sudo 'unloading modules' -if [ ${OPT_VAL['p']} -eq 1 ];then +if [ "${OPT_VAL['p']}" -eq 1 ];then func_lib_disable_pulseaudio fi -for idx in $(seq 1 $loop_cnt) +for idx in $(seq 1 "$loop_cnt") do dlogi "===== Starting iteration $idx of $loop_cnt =====" ## - 1: remove module section diff --git a/test-case/check-pause-resume.sh b/test-case/check-pause-resume.sh index 17c49ffc..2459a756 100755 --- a/test-case/check-pause-resume.sh +++ b/test-case/check-pause-resume.sh @@ -46,7 +46,6 @@ OPT_NAME['S']='filter_string' OPT_DESC['S']="run this case on specified pipeli OPT_HAS_ARG['S']=1 OPT_VAL['S']="id:any" func_opt_parse_option "$@" -setup_kernel_check_point tplg=${OPT_VAL['t']} test_mode=${OPT_VAL['m']} diff --git a/test-case/check-performance.sh b/test-case/check-performance.sh index 3638db99..0a5739de 100755 --- a/test-case/check-performance.sh +++ b/test-case/check-performance.sh @@ -88,7 +88,6 @@ main() start_test logger_disabled || func_lib_start_log_collect - setup_kernel_check_point func_lib_check_sudo func_pipeline_export "$tplg" "type:any" diff --git a/test-case/check-playback.sh b/test-case/check-playback.sh index 0958647b..a30c28dd 100755 --- a/test-case/check-playback.sh +++ b/test-case/check-playback.sh @@ -67,7 +67,6 @@ else dlogi "using $file as playback source" fi -setup_kernel_check_point func_lib_check_sudo func_pipeline_export "$tplg" "type:playback & ${OPT_VAL['S']}" diff --git a/test-case/check-selector-play.sh b/test-case/check-selector-play.sh index 66c6b040..5ea8a77b 100755 --- a/test-case/check-selector-play.sh +++ b/test-case/check-selector-play.sh @@ -128,7 +128,6 @@ main() logger_disabled || func_lib_start_log_collect - setup_kernel_check_point func_lib_check_sudo func_pipeline_export "$tplg" "type:any" diff --git a/test-case/check-signal-stop-start.sh b/test-case/check-signal-stop-start.sh index 0aa79fb0..5a66cbb3 100755 --- a/test-case/check-signal-stop-start.sh +++ b/test-case/check-signal-stop-start.sh @@ -60,12 +60,10 @@ case $test_mode in ;; esac -setup_kernel_check_point - func_stop_start_pipeline() { local i=1 - while [ $i -le $count ] + while [ $i -le "$count" ] do # check aplay/arecord process state sof-process-state.sh "$pid" >/dev/null || { @@ -76,10 +74,10 @@ func_stop_start_pipeline() dlogi "Stop/start count: $i" # stop the pipeline kill -SIGSTOP "$pid" - sleep $interval + sleep "$interval" # start the pipeline kill -SIGCONT "$pid" - sleep $interval + sleep "$interval" (( i++ )) done } diff --git a/test-case/check-smart-amplifier.sh b/test-case/check-smart-amplifier.sh index 41a9b345..742fef96 100755 --- a/test-case/check-smart-amplifier.sh +++ b/test-case/check-smart-amplifier.sh @@ -60,7 +60,6 @@ start_test logger_disabled || func_lib_start_log_collect func_pipeline_export "$tplg" "smart_amp:any" -setup_kernel_check_point [ "$PIPELINE_COUNT" == "2" ] || die "Only detect $PIPELINE_COUNT pipeline(s) from topology, but two are needed" @@ -81,11 +80,11 @@ do done fmts="$cp_fmt" -if [ ${OPT_VAL['F']} = '1' ]; then +if [ "${OPT_VAL['F']}" = '1' ]; then fmts="$cp_fmts" fi -for i in $(seq 1 $loop_cnt) +for i in $(seq 1 "$loop_cnt") do for fmt in $fmts do diff --git a/test-case/check-src-play.sh b/test-case/check-src-play.sh index c74ed64c..afff372f 100755 --- a/test-case/check-src-play.sh +++ b/test-case/check-src-play.sh @@ -113,7 +113,6 @@ main() logger_disabled || func_lib_start_log_collect - setup_kernel_check_point func_lib_check_sudo func_pipeline_export "$tplg" "type:any" diff --git a/test-case/check-src-rec.sh b/test-case/check-src-rec.sh index 0d5ec8b5..21cda6c4 100755 --- a/test-case/check-src-rec.sh +++ b/test-case/check-src-rec.sh @@ -106,7 +106,6 @@ main() logger_disabled || func_lib_start_log_collect - setup_kernel_check_point func_lib_check_sudo func_pipeline_export "$tplg" "type:any" diff --git a/test-case/check-suspend-resume-with-audio.sh b/test-case/check-suspend-resume-with-audio.sh index 40397a54..ccb7fd51 100755 --- a/test-case/check-suspend-resume-with-audio.sh +++ b/test-case/check-suspend-resume-with-audio.sh @@ -57,7 +57,6 @@ OPT_NAME['P']='pipelines' OPT_DESC['P']="run test case on specified pipelines OPT_HAS_ARG['P']=1 OPT_VAL['P']="id:any" func_opt_parse_option "$@" -setup_kernel_check_point func_lib_check_sudo tplg=${OPT_VAL['t']} @@ -86,7 +85,7 @@ opt_arr=(-l "${OPT_VAL['l']}") if [ "${OPT_VAL['T']}" ]; then opt_arr+=(-T "${OPT_VAL['T']}") fi -if [ ${OPT_VAL['r']} -eq 0 ]; then +if [ "${OPT_VAL['r']}" -eq 0 ]; then opt_arr+=(-S "${OPT_VAL['S']}" -w "${OPT_VAL['w']}") else opt_arr+=(-r) @@ -103,6 +102,7 @@ do fmt=$(func_pipeline_parse_value "$idx" fmt) dev=$(func_pipeline_parse_value "$idx" dev) snd=$(func_pipeline_parse_value "$idx" snd) + # shellcheck disable=SC2153 dlogi "Run $TYPE command for the background" cmd_args="$cmd -D$dev -r $rate -c $channel -f $fmt $file_name -q" dlogc "$cmd_args" diff --git a/test-case/check-userspace-cardinfo.sh b/test-case/check-userspace-cardinfo.sh index 1a1c36c8..3133df22 100755 --- a/test-case/check-userspace-cardinfo.sh +++ b/test-case/check-userspace-cardinfo.sh @@ -20,7 +20,6 @@ set -e source "$(dirname "${BASH_SOURCE[0]}")"/../case-lib/lib.sh func_opt_parse_option "$@" -setup_kernel_check_point start_test diff --git a/test-case/check-userspace-paplay.sh b/test-case/check-userspace-paplay.sh index 4bfc158f..815b19c5 100755 --- a/test-case/check-userspace-paplay.sh +++ b/test-case/check-userspace-paplay.sh @@ -42,7 +42,6 @@ OPT_NAME['C']='channels' OPT_DESC['C']='channels' OPT_HAS_ARG['C']=1 OPT_VAL['C']=2 func_opt_parse_option "$@" -setup_kernel_check_point start_test @@ -60,7 +59,7 @@ channel=${OPT_VAL['C']} # go through all the sinks # get all the sinks name sinkkeys=$(pactlinfo.py --showsinks) -for round in $(seq 1 $round_cnt); do +for round in $(seq 1 "$round_cnt"); do for i in $sinkkeys; do sinkcard=$(pactlinfo.py --getsinkcardname "$i") || { dlogw "failed to get sink $i card_name" @@ -94,10 +93,11 @@ for round in $(seq 1 $round_cnt); do sinkname=$(eval echo "$sinkname") dlogi "===== Testing: (Round: $round/$round_cnt) (sink: $sinkname.$actport) =====" dlogc "paplay -v --device=$sinkname --raw --rate=$rate --format=$format --channels=$channel $file" - paplay -v --device="$sinkname" --raw --rate=$rate --format=$format --channels=$channel $file & + paplay -v --device="$sinkname" --raw --rate="$rate" --format="$format" --channels="$channel" "$file" & pid=$! - sleep $duration + sleep "$duration" # check whether process is still running + # shellcheck disable=SC2009 count=$(ps -A| grep -c $pid) || true if [[ $count -eq 0 ]]; then if wait $pid; then #checks if process executed successfully or not diff --git a/test-case/check-userspace-parecord.sh b/test-case/check-userspace-parecord.sh index 2b660a49..dc01f05a 100755 --- a/test-case/check-userspace-parecord.sh +++ b/test-case/check-userspace-parecord.sh @@ -42,7 +42,6 @@ OPT_NAME['C']='channels' OPT_DESC['C']='channels' OPT_HAS_ARG['C']=1 OPT_VAL['C']=2 func_opt_parse_option "$@" -setup_kernel_check_point round_cnt=${OPT_VAL['r']} duration=${OPT_VAL['d']} @@ -60,7 +59,7 @@ start_test # go through all the sources # get all the sources name sourcekeys=$(pactlinfo.py --showsources) -for round in $(seq 1 $round_cnt); do +for round in $(seq 1 "$round_cnt"); do for i in $sourcekeys; do sourcecard=$(pactlinfo.py --getsourcecardname "$i") || { dlogw "failed to get source $i card_name" @@ -101,10 +100,11 @@ for round in $(seq 1 $round_cnt); do sourcename=$(eval echo "$sourcename") dlogi "===== Testing: (Round: $round/$round_cnt) (source: $sourcename.$actport) =====" dlogc "parecord -v --device=$sourcename --raw --rate=$rate --format=$format --channels=$channel $file" - parecord -v --device="$sourcename" --raw --rate=$rate --format=$format --channels=$channel $file & + parecord -v --device="$sourcename" --raw --rate="$rate" --format="$format" --channels="$channel" "$file" & pid=$! - sleep $duration + sleep "$duration" # check whether process is still running + # shellcheck disable=SC2009 count=$(ps -A| grep -c $pid) || true if [[ $count -eq 0 ]]; then if wait $pid; then #checks if process executed successfully or not diff --git a/test-case/check-volume-levels.sh b/test-case/check-volume-levels.sh index b421dff1..a44ca3f5 100755 --- a/test-case/check-volume-levels.sh +++ b/test-case/check-volume-levels.sh @@ -35,7 +35,6 @@ OPT_NAME['t']='tplg' OPT_DESC['t']='tplg file, default value is env TPLG: $' OPT_HAS_ARG['t']=1 OPT_VAL['t']="$TPLG" func_opt_parse_option "$@" -setup_kernel_check_point tplg=${OPT_VAL['t']} diff --git a/test-case/check-xrun-injection.sh b/test-case/check-xrun-injection.sh index 30a2b045..22300739 100755 --- a/test-case/check-xrun-injection.sh +++ b/test-case/check-xrun-injection.sh @@ -45,7 +45,6 @@ interval=${OPT_VAL['i']} start_test logger_disabled || func_lib_start_log_collect -setup_kernel_check_point func_lib_check_sudo case $test_mode in @@ -67,7 +66,7 @@ esac func_xrun_injection() { local i=1 - while [ $i -le $count ] && [ "$(ps -p "$pid" --no-header)" ] + while [ $i -le "$count" ] && [ "$(ps -p "$pid" --no-header)" ] do # check aplay/arecord process state sof-process-state.sh "$pid" >/dev/null || { @@ -77,7 +76,7 @@ func_xrun_injection() } dlogi "XRUN injection: $i" sudo bash -c "echo '1' > $xrun_injection" - sleep $interval + sleep "$interval" (( i++ )) done } diff --git a/test-case/latency-metrics.sh b/test-case/latency-metrics.sh index fe799e90..41286eca 100755 --- a/test-case/latency-metrics.sh +++ b/test-case/latency-metrics.sh @@ -273,8 +273,6 @@ main() pkill jackd || true check_latency_options - setup_kernel_check_point - start_test logger_disabled || func_lib_start_log_collect diff --git a/test-case/multiple-pipeline.sh b/test-case/multiple-pipeline.sh index b7dd22d0..70f8c7cb 100755 --- a/test-case/multiple-pipeline.sh +++ b/test-case/multiple-pipeline.sh @@ -97,7 +97,7 @@ func_run_pipeline_with_type() [[ $tmp_count -le 0 ]] && return func_pipeline_export "$tplg" "type:$direction $opt_filter" local -a idx_lst - if [ ${OPT_VAL['r']} -eq 0 ]; then + if [ "${OPT_VAL['r']}" -eq 0 ]; then # shellcheck disable=SC2207 idx_lst=($(seq 0 $((PIPELINE_COUNT - 1)))) else @@ -172,7 +172,7 @@ main() main "$@" # TODO: move this to main() https://github.com/thesofproject/sof-test/issues/740 -for i in $(seq 1 $loop_cnt) +for i in $(seq 1 "$loop_cnt") do # set up checkpoint for each iteration setup_kernel_check_point @@ -202,7 +202,7 @@ do ps_checks dlogi "Letting playback/capture run for ${OPT_VAL['w']}s" - sleep ${OPT_VAL['w']} + sleep "${OPT_VAL['w']}" # check processes again dlogi "checking pipeline status again" diff --git a/test-case/simultaneous-playback-capture.sh b/test-case/simultaneous-playback-capture.sh index d1e3189f..f3b4544d 100755 --- a/test-case/simultaneous-playback-capture.sh +++ b/test-case/simultaneous-playback-capture.sh @@ -34,7 +34,6 @@ OPT_NAME['l']='loop' OPT_DESC['l']='loop count' OPT_HAS_ARG['l']=1 OPT_VAL['l']=1 func_opt_parse_option "$@" -setup_kernel_check_point tplg=${OPT_VAL['t']} wait_time=${OPT_VAL['w']} @@ -72,7 +71,7 @@ func_error_exit() exit 1 } -for i in $(seq 1 $loop_cnt) +for i in $(seq 1 "$loop_cnt") do # set up checkpoint for each iteration setup_kernel_check_point @@ -101,7 +100,7 @@ do arecord_pid=$! dlogi "Preparing to sleep for $wait_time" - sleep $wait_time + sleep "$wait_time" # aplay/arecord processes should be persistent for sleep duration. dlogi "check pipeline after ${wait_time}s" diff --git a/test-case/test-jack-detection-dsp-d3.sh b/test-case/test-jack-detection-dsp-d3.sh index 1cea9809..92e88f31 100755 --- a/test-case/test-jack-detection-dsp-d3.sh +++ b/test-case/test-jack-detection-dsp-d3.sh @@ -163,8 +163,6 @@ main() { func_pipeline_export "$tplg" "type:playback" - setup_kernel_check_point - start_test dlogi "Checking usbrelay availability..." diff --git a/test-case/test-jack-detection-playback-capture.sh b/test-case/test-jack-detection-playback-capture.sh index f2533cdb..d5230e91 100755 --- a/test-case/test-jack-detection-playback-capture.sh +++ b/test-case/test-jack-detection-playback-capture.sh @@ -171,8 +171,6 @@ main() { func_pipeline_export "$tplg" "type:playback" - setup_kernel_check_point - start_test dlogi "Checking usbrelay availability..." diff --git a/test-case/test-mic-privacy.sh b/test-case/test-mic-privacy.sh index cfd68083..f8483bea 100755 --- a/test-case/test-mic-privacy.sh +++ b/test-case/test-mic-privacy.sh @@ -148,8 +148,6 @@ show_control_state() main() { - setup_kernel_check_point - start_test dlogi "Checking usbrelay availability..." diff --git a/test-case/test-speaker.sh b/test-case/test-speaker.sh index 6e0df8ab..c22a66ab 100755 --- a/test-case/test-speaker.sh +++ b/test-case/test-speaker.sh @@ -36,7 +36,7 @@ logger_disabled || func_lib_start_log_collect func_pipeline_export "$tplg" "type:playback" tcnt=${OPT_VAL['l']} -setup_kernel_check_point + for idx in $(seq 0 $((PIPELINE_COUNT - 1))) do channel=$(func_pipeline_parse_value "$idx" channel) diff --git a/test-case/verify-bootsequence.sh b/test-case/verify-bootsequence.sh index 5fd77b3d..7bb7df8d 100755 --- a/test-case/verify-bootsequence.sh +++ b/test-case/verify-bootsequence.sh @@ -30,7 +30,6 @@ ALSALIB_VER=1.2.2-44 ALSAUCM_VER=1.2.3-15 func_opt_parse_option "$@" -setup_kernel_check_point start_test diff --git a/test-case/verify-firmware-presence.sh b/test-case/verify-firmware-presence.sh index 13b7f0c8..c15ac010 100755 --- a/test-case/verify-firmware-presence.sh +++ b/test-case/verify-firmware-presence.sh @@ -20,7 +20,6 @@ set -e source "$(dirname "${BASH_SOURCE[0]}")"/../case-lib/lib.sh func_opt_parse_option "$@" -setup_kernel_check_point start_test diff --git a/test-case/verify-kernel-module-load-probe.sh b/test-case/verify-kernel-module-load-probe.sh index 30ae5553..6499f0b4 100755 --- a/test-case/verify-kernel-module-load-probe.sh +++ b/test-case/verify-kernel-module-load-probe.sh @@ -18,8 +18,6 @@ source "$(dirname "${BASH_SOURCE[0]}")"/../case-lib/lib.sh func_opt_parse_option "$@" -setup_kernel_check_point - start_test dlogi "Checking if sof relative modules loaded" diff --git a/test-case/verify-pcm-list.sh b/test-case/verify-pcm-list.sh index 88abb8d4..03e03816 100755 --- a/test-case/verify-pcm-list.sh +++ b/test-case/verify-pcm-list.sh @@ -31,8 +31,6 @@ start_test tplg_path=$(func_lib_get_tplg_path "$tplg") || die "No available topology for this test case" -setup_kernel_check_point - tplg_str=$(sof-tplgreader.py "$tplg_path" -d id pcm type -o) pcm_str=$(sof-dump-status.py -i "${SOFCARD:-0}") diff --git a/test-case/verify-tplg-binary.sh b/test-case/verify-tplg-binary.sh index 5143c61a..108aed7f 100755 --- a/test-case/verify-tplg-binary.sh +++ b/test-case/verify-tplg-binary.sh @@ -23,7 +23,6 @@ OPT_NAME['t']='tplg' OPT_DESC['t']="tplg file, default value is env TPLG: $T OPT_HAS_ARG['t']=1 OPT_VAL['t']="$TPLG" func_opt_parse_option "$@" -setup_kernel_check_point tplg=${OPT_VAL['t']} start_test diff --git a/test-case/volume-basic-test.sh b/test-case/volume-basic-test.sh index b1ed73aa..0c989de9 100755 --- a/test-case/volume-basic-test.sh +++ b/test-case/volume-basic-test.sh @@ -33,7 +33,6 @@ OPT_HAS_ARG['s']=0 OPT_VAL['s']=1 set -e func_opt_parse_option "$@" -setup_kernel_check_point tplg=${OPT_VAL['t']} maxloop=${OPT_VAL['l']}