-
Notifications
You must be signed in to change notification settings - Fork 59
test-case: Add automated tests for Chrome Next Generation #1302
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
majunkier
merged 1 commit into
thesofproject:main
from
ekurdybx:automate-sample-rates-test
Oct 24, 2025
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,3 +5,5 @@ python3-graphviz | |
| python3-construct | ||
| python3-pytest | ||
| python3-pandas | ||
| python3-soundfile | ||
| python3-pydub | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,127 @@ | ||
| #!/bin/bash | ||
|
|
||
| ## | ||
| ## Case Name: check-8bit-play-rec | ||
| ## Preconditions: | ||
| ## - sox installed | ||
| ## Description: | ||
| ## This test verifies 8-bit audio playback and recording functionality using ALSA devices. | ||
| ## It generates test chirp signals in multiple 8-bit formats (unsigned 8-bit, A-LAW, MU-LAW), plays them back, records the output, | ||
| ## and checks the integrity of the recorded files. The test ensures that the pipeline correctly handles 8-bit audio data for both playback and capture. | ||
| ## Case steps: | ||
| ## 1. Generate chirp signals in unsigned 8-bit, A-LAW, MU-LAW, and S32_LE formats using sox. | ||
| ## 2. Play each chirp file and record the output using arecord and aplay with the specified ALSA devices. | ||
| ## 3. Convert raw recordings to WAV format for analysis. | ||
| ## 4. Analyze the recorded files for integrity. | ||
| ## Expected results: | ||
| ## - All chirp files are played and recorded without errors. | ||
| ## - The recorded files are successfully generated and converted. | ||
| ## - No failures are reported during analysis. | ||
| ## | ||
|
|
||
| set -e | ||
|
|
||
| # It is pointless to perf component in HDMI pipeline, so filter out HDMI pipelines | ||
| # shellcheck disable=SC2034 | ||
| NO_HDMI_MODE=true | ||
|
|
||
| # shellcheck source=case-lib/lib.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' | ||
| OPT_HAS_ARG['t']=1 OPT_VAL['t']="$TPLG" | ||
|
|
||
| OPT_NAME['p']='playback_device' OPT_DESC['p']='ALSA pcm playback device. Example: hw:0,1' | ||
| OPT_HAS_ARG['p']=1 OPT_VAL['p']='' | ||
|
|
||
| OPT_NAME['c']='capture_device' OPT_DESC['c']='ALSA pcm capture device. Example: hw:0,1' | ||
| OPT_HAS_ARG['c']=1 OPT_VAL['c']='' | ||
|
|
||
| OPT_NAME['s']='sof-logger' OPT_DESC['s']="Open sof-logger trace the data will store at $LOG_ROOT" | ||
| OPT_HAS_ARG['s']=0 OPT_VAL['s']=1 | ||
|
|
||
| func_opt_parse_option "$@" | ||
|
|
||
| init_globals() | ||
| { | ||
| tplg=${OPT_VAL['t']} | ||
| playback_dev=${OPT_VAL['p']} | ||
| capture_dev=${OPT_VAL['c']} | ||
|
|
||
| rec8_opt="-c 2 -r 48000 -d 7" | ||
| rec_opt="-f S32_LE -c 2 -r 48000 -d 7" | ||
| play_opt="-c 2 -r 48000" | ||
|
|
||
| chirp_u8_filename="$LOG_ROOT/chirp_u8.wav" | ||
| chirp_alaw_filename="$LOG_ROOT/chirp_alaw.raw" | ||
| chirp_mulaw_filename="$LOG_ROOT/chirp_mulaw.raw" | ||
| chirp_s32_filename="$LOG_ROOT/chirp_s32.wav" | ||
|
|
||
| u8_play_filename="$LOG_ROOT/rec_play_u8.wav" | ||
| alaw_play_filename="$LOG_ROOT/rec_play_alaw.wav" | ||
| mulaw_play_filename="$LOG_ROOT/rec_play_mulaw.wav" | ||
|
|
||
| u8_rec_filename="$LOG_ROOT/rec_u8.wav" | ||
| alaw_rec_filename="$LOG_ROOT/rec_alaw.wav" | ||
| mulaw_rec_filename="$LOG_ROOT/rec_mulaw.wav" | ||
|
|
||
| all_result_files=("$u8_play_filename" "$alaw_play_filename" "$mulaw_play_filename" "$u8_rec_filename" "$alaw_rec_filename" "$mulaw_rec_filename") | ||
| } | ||
|
|
||
| generate_chirps() | ||
| { | ||
| dlogi "Generating chirps" | ||
| sox -n --encoding unsigned-integer -b 8 -r 48000 -c 2 "$chirp_u8_filename" synth 5 sine 100+20000 norm -3 | ||
| sox -n --encoding a-law -b 8 -r 48000 -c 2 "$chirp_alaw_filename" synth 5 sine 100+20000 norm -3 | ||
| sox -n --encoding mu-law -b 8 -r 48000 -c 2 "$chirp_mulaw_filename" synth 5 sine 100+20000 norm -3 | ||
| sox -n --encoding signed-integer -b 32 -r 48000 -c 2 "$chirp_s32_filename" synth 5 sine 100+20000 norm -3 | ||
| } | ||
|
|
||
| cleanup() | ||
| { | ||
| if [ -f "tmp1.raw" ]; then sudo rm tmp1.raw; fi | ||
| if [ -f "tmp2.raw" ]; then sudo rm tmp2.raw; fi | ||
| } | ||
|
|
||
| run_tests() | ||
| { | ||
| generate_chirps | ||
|
|
||
| set +e | ||
| play_and_record "-D$capture_dev $rec_opt $u8_play_filename" "-D$playback_dev $play_opt -t wav $chirp_u8_filename" | ||
| play_and_record "-D$capture_dev $rec_opt $alaw_play_filename" "-D$playback_dev $play_opt -t raw -f A_LAW $chirp_alaw_filename" | ||
| play_and_record "-D$capture_dev $rec_opt $mulaw_play_filename" "-D$playback_dev $play_opt -t raw -f MU_LAW $chirp_mulaw_filename" | ||
|
|
||
| play_and_record "-D$capture_dev $rec8_opt -f U8 $u8_rec_filename" "-D$playback_dev $chirp_s32_filename" | ||
| play_and_record "-D$capture_dev $rec8_opt -f A_LAW -t raw tmp1.raw" "-D$playback_dev $chirp_s32_filename" | ||
| play_and_record "-D$capture_dev $rec8_opt -f MU_LAW -t raw tmp2.raw" "-D$playback_dev $chirp_s32_filename" | ||
|
|
||
| sox --encoding a-law -r 48000 -c 2 tmp1.raw "$alaw_rec_filename" | ||
| sox --encoding u-law -r 48000 -c 2 tmp2.raw "$mulaw_rec_filename" | ||
| set -e | ||
|
|
||
| if check_soundfile_for_glitches "${all_result_files[@]}"; then | ||
| dlogi "All files correct" | ||
| else | ||
| die "Detected corrupted files!" | ||
| fi | ||
| } | ||
|
|
||
| main() | ||
| { | ||
| init_globals | ||
|
|
||
| start_test | ||
| logger_disabled || func_lib_start_log_collect | ||
|
|
||
| setup_kernel_check_point | ||
| func_lib_check_sudo | ||
| func_pipeline_export "$tplg" "type:any" | ||
|
|
||
| run_tests | ||
| cleanup | ||
| } | ||
|
|
||
| { | ||
| main "$@"; exit "$?" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| #!/bin/bash | ||
|
|
||
| ## | ||
| ## Case Name: check-float-play-rec | ||
| ## Preconditions: | ||
| ## - sox installed | ||
| ## Description: | ||
| ## Verify float audio playback and capture using ALSA devices. The test generates a float-encoded chirp and a 32-bit signed integer chirp, | ||
| ## plays one while recording the other format and vice versa. This validates that the audio pipeline correctly handles FLOAT and S32_LE sample formats | ||
| ## and that sample conversion between formats works as expected. | ||
| ## Case steps: | ||
| ## 1. Generate a 48 kHz stereo chirp in 32-bit float and 32-bit signed integer formats using sox. | ||
| ## 2. Use arecord/aplay to play the float chirp and record with S32_LE format, then play the S32_LE chirp and record with FLOAT_LE format. | ||
| ## 3. Save both recorded files into the log directory for later analysis. | ||
| ## 4. Analyze the recorded files for integrity and correct format. | ||
| ## Expected results: | ||
| ## - Both playback and recording complete without errors. | ||
| ## - The recorded files are created in the log directory and match expected sample formats. | ||
| ## - No failures are reported during analysis. | ||
| ## | ||
|
|
||
| set -e | ||
|
|
||
| # It is pointless to perf component in HDMI pipeline, so filter out HDMI pipelines | ||
| # shellcheck disable=SC2034 | ||
| NO_HDMI_MODE=true | ||
|
|
||
| # shellcheck source=case-lib/lib.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' | ||
| OPT_HAS_ARG['t']=1 OPT_VAL['t']="$TPLG" | ||
|
|
||
| OPT_NAME['p']='playback_device' OPT_DESC['p']='ALSA pcm playback device. Example: hw:0,1' | ||
| OPT_HAS_ARG['p']=1 OPT_VAL['p']='' | ||
|
|
||
| OPT_NAME['c']='capture_device' OPT_DESC['c']='ALSA pcm capture device. Example: hw:0,1' | ||
| OPT_HAS_ARG['c']=1 OPT_VAL['c']='' | ||
|
|
||
| OPT_NAME['s']='sof-logger' OPT_DESC['s']="Open sof-logger trace the data will store at $LOG_ROOT" | ||
| OPT_HAS_ARG['s']=0 OPT_VAL['s']=1 | ||
|
|
||
| func_opt_parse_option "$@" | ||
|
|
||
| init_globals() | ||
| { | ||
| tplg=${OPT_VAL['t']} | ||
| playback_dev=${OPT_VAL['p']} | ||
| capture_dev=${OPT_VAL['c']} | ||
|
|
||
| rec_opt="-c 2 -r 48000 -d 7" | ||
|
|
||
| chirp_float_filename="$LOG_ROOT/chirp_float_48k.wav" | ||
| chirp_s32_filename="$LOG_ROOT/chirp_s32_48k.wav" | ||
|
|
||
| rec_play_filename="$LOG_ROOT/rec_play_float.wav" | ||
| rec_filename="$LOG_ROOT/rec_float.wav" | ||
|
|
||
| all_result_files=("$rec_play_filename" "$rec_filename") | ||
| } | ||
|
|
||
| generate_chirps() | ||
| { | ||
| dlogi "Generating chirps" | ||
| sox -n --encoding float -r 48000 -c 2 -b 32 "$chirp_float_filename" synth 5 sine 100+20000 norm -3 | ||
| sox -n --encoding signed-integer -L -r 48000 -c 2 -b 32 "$chirp_s32_filename" synth 5 sine 100+20000 norm -3 | ||
| } | ||
|
|
||
| run_tests() | ||
| { | ||
| generate_chirps | ||
|
|
||
| set +e | ||
| play_and_record "-D$capture_dev $rec_opt -f S32_LE $rec_play_filename" "-D$playback_dev $chirp_float_filename" | ||
| play_and_record "-D$capture_dev $rec_opt -f FLOAT_LE $rec_filename" "-D$playback_dev $chirp_s32_filename" | ||
| set -e | ||
|
|
||
| if check_soundfile_for_glitches "${all_result_files[@]}"; then | ||
| dlogi "All files correct" | ||
| else | ||
| die "Detected corrupted files!" | ||
| fi | ||
| } | ||
|
|
||
| main() | ||
| { | ||
| init_globals | ||
|
|
||
| start_test | ||
| logger_disabled || func_lib_start_log_collect | ||
|
|
||
| setup_kernel_check_point | ||
| func_lib_check_sudo | ||
| func_pipeline_export "$tplg" "type:any" | ||
|
|
||
| run_tests | ||
| } | ||
|
|
||
| { | ||
| main "$@"; exit "$?" | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.