-
Notifications
You must be signed in to change notification settings - Fork 59
fix: tests: SRC tests catch aplay warnings and refactor #1351
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
Open
ekurdybx
wants to merge
1
commit into
thesofproject:main
Choose a base branch
from
ekurdybx:fix-src-tests
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+136
−60
Open
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1534,47 +1534,76 @@ restore_topology() { | |
| check_topology | ||
| } | ||
|
|
||
| # Check aplay output for warnings | ||
| # Arguments: 1-aplay output | ||
| check_for_aplay_warnings() | ||
| { | ||
| dlogi "$1" | ||
| if echo "$1" | grep -q "Warning:"; then | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| dlogw "Caught aplay warning! Look for previous logs." | ||
| return 1 | ||
| fi | ||
| return 0 | ||
| } | ||
|
|
||
| # Play sound and record it | ||
| # Arguments: 1-arecord options 2-aplay options | ||
| play_and_record() | ||
| { | ||
| errors=0 | ||
| dlogi "Play [aplay $SOF_ALSA_OPTS $SOF_APLAY_OPTS $2] and capture sound [arecord $1]" | ||
| # shellcheck disable=SC2086 | ||
| arecord $SOF_ALSA_OPTS $SOF_ARECORD_OPTS $1 & PID=$! | ||
| arecord $SOF_ALSA_OPTS $SOF_ARECORD_OPTS $1 & PID=$! | ||
| # shellcheck disable=SC2086 | ||
| aplay $SOF_ALSA_OPTS $SOF_APLAY_OPTS $2 | ||
| wait $PID | ||
| aplay_output=$(aplay $SOF_ALSA_OPTS $SOF_APLAY_OPTS $2 2>&1) || errors=$((errors+1)) | ||
| wait $PID || errors=$((errors+1)) | ||
| sleep 1 | ||
| check_for_aplay_warnings "$aplay_output" || errors=$((errors+1)) | ||
|
|
||
| if [ "$errors" = 0 ]; then | ||
| return 0 | ||
| fi | ||
| return 1 | ||
| } | ||
|
|
||
| # Analyze files to look for glitches. | ||
| # Analyze file to look for glitches. | ||
| # Returns exit code 0 if there are no glitches, 1 if there are. | ||
| # Arguments: the list of filenames | ||
| # Arguments: filename | ||
| check_soundfile_for_glitches() | ||
| { | ||
| glitched_files=0 | ||
| if [ -f "$result_filename" ]; then | ||
| dlogi "Analyzing $result_filename file..." | ||
| if python3 "$SCRIPT_HOME"/tools/analyze-wav.py "$result_filename"; then | ||
| dlogi "$result_filename file is correct" | ||
| else | ||
| dlogw "GLITCHED FILE: $result_filename" | ||
| return 1 | ||
| fi | ||
| else | ||
| dlogw "MISSING FILE: $result_filename" | ||
| return 1 | ||
| fi | ||
| } | ||
|
|
||
| # Check list of soundfiles for glitches | ||
| # Returns exit code 0 if there are no glitches, 1 if there are. | ||
| # Arguments: list of filenames | ||
| check_soundfiles_for_glitches() | ||
| { | ||
| failures=0 | ||
| # shellcheck disable=SC2154 | ||
| for result_filename in "${all_result_files[@]}" | ||
| do | ||
| if [ -f "$result_filename" ]; then | ||
| dlogi "Analyzing $result_filename file..." | ||
| if python3 "$SCRIPT_HOME"/tools/analyze-wav.py "$result_filename"; then | ||
| dlogi "$result_filename file is correct" | ||
| else | ||
| dlogw "Found issues in $result_filename file" | ||
| glitched_files=$((glitched_files+1)) | ||
| fi | ||
| else | ||
| dlogw "$result_filename file not found, check for previous errors" | ||
| glitched_files=$((glitched_files+1)) | ||
| if ! check_soundfile_for_glitches "$result_filename"; then | ||
| failures=$((failures+1)) | ||
| fi | ||
| done | ||
|
|
||
| if [ $glitched_files -eq 0 ]; then | ||
| dlogi "Analysis finished, no issues found" | ||
| if [ "$failures" = 0 ]; then | ||
| dlogi "All files correct" | ||
| return 0 | ||
| else | ||
| dlogi "$glitched_files files corrupted" | ||
| dlogw "Found $failures corrupted files" | ||
| return 1 | ||
| fi | ||
| } | ||
|
|
||
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
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.