Repository navigation
New aplay_opts() and arecord_opts() to change flags across all tests #498
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -253,6 +253,47 @@ func_lib_get_tplg_path() | |
| return 0 | ||
| } | ||
|
|
||
| # We must not quote SOF_ALSA_OPTS and disable SC2086 below for two reasons: | ||
| # | ||
| # 1. We want to support multiple parameters in a single variable, in | ||
| # other words we want to support this: | ||
| # | ||
| # SOF_ALSA_OPTS="--foo --bar" | ||
| # aplay $SOF_ALSA_OPTS ... | ||
| # | ||
| # 2. aplay does not ignore empty arguments anyway, in other words this | ||
| # does not work anyway: | ||
| # | ||
| # SOF_ALSA_OPTS="" | ||
| # aplay "$SOF_ALSA_OPTS" ... | ||
| # | ||
| # This is technically incorrect because it means our SOF_ALSA_OPTS | ||
| # cannot support whitespace, for instance this would be split in two | ||
| # options: --bar="aaaa and bbbb" | ||
| # | ||
| # SOF_ALSA_OPTS='--foo --bar="aaaa bbbb"' | ||
| # | ||
| # To do this "correctly" SOF_ALSA_OPTS etc. should be arrays. | ||
| # From https://mywiki.wooledge.org/BashGuide/Arrays "The only safe way | ||
| # to represent multiple string elements in Bash is through the use of | ||
| # arrays." | ||
| # | ||
| # However, 1. arrays would complicate the user interface 2. ALSA does not | ||
| # seem to need arguments with whitespace or globbing characters. | ||
|
|
||
| aplay_opts() | ||
| { | ||
| dlogc "aplay $SOF_ALSA_OPTS $SOF_APLAY_OPTS $*" | ||
| # shellcheck disable=SC2086 | ||
| aplay $SOF_ALSA_OPTS $SOF_APLAY_OPTS "$@" | ||
|
xiulipan marked this conversation as resolved.
Member
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. we also want to test the return status since it contains an error code when it fails. If you just stop I think the rest of the script will probably think nothing bad happened.
Collaborator
Author
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. The vast majority of the time $ SOF_ALSA_OPTS=--bogus ./test-case/check-playback.sh
2020-11-06 19:05:09 UTC [COMMAND] sof-tplgreader.py /lib/firmware/intel/sof-tplg/sof-apl-pcm512x.tplg -f 'type:playback & id:any' -b ' pcm:HDA Digital' -s 0 -e
2020-11-06 19:05:09 UTC [INFO] ===== Testing: (Round: 1/1) (PCM: Port5 [hw:0,0]<playback>) (Loop: 1/3) =====
2020-11-06 19:05:09 UTC [COMMAND] aplay --bogus -Dhw:0,0 -r 48000 -c 2 -f S16_LE -d 10 /dev/zero -v -q
aplay: unrecognized option '--bogus'
Try `aplay --help' for more information.
2020-11-06 19:05:09 UTC [ERROR] aplay on PCM hw:0,0 failed at 1/3.
2020-11-06 19:05:09 UTC [ERROR] Starting func_exit_handler(), exit status=1, FUNCNAME stack:
2020-11-06 19:05:09 UTC [ERROR] die() @ ./test-case/../case-lib/lib.sh
2020-11-06 19:05:09 UTC [ERROR] main() @ ./test-case/check-playback.sh:99Same with The other test What makes a difference with backgrounded commands is to collect ASAP their exit status with Even without considering backgrounding issues, the caller of |
||
| } | ||
| arecord_opts() | ||
| { | ||
| dlogc "arecord $SOF_ALSA_OPTS $SOF_ARECORD_OPTS $*" | ||
| # shellcheck disable=SC2086 | ||
| arecord $SOF_ALSA_OPTS $SOF_ARECORD_OPTS "$@" | ||
|
Contributor
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. same for |
||
| } | ||
|
|
||
| die() | ||
| { | ||
| dloge "$@" | ||
|
|
||
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.
I think
optsmeans options? maybe a more good name for the wrapper functionUh oh!
There was an error while loading. Please reload this page.
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.
I've been looking for a better but still short name but I didn't find any, suggestions anyone? It has to be kept relatively short because it will be used a lot.
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.
Same feeling here. If I had a better name, I should type it already.