-
-
Notifications
You must be signed in to change notification settings - Fork 3
scripts: ci: qemu-run.sh: make audio device optional #945
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
base: develop
Are you sure you want to change the base?
Conversation
The QEMU audio device emulation caused issues in github.com/dasharo/meta-dts testing CIs. Check this issue for more inf.: Dasharo/dasharo-issues#1382 . Because the audio device is not used in the CIs - it could be disabled optionally. Signed-off-by: Daniil Klimuk <daniil.klimuk@3mdeb.com>
The change is caused by: codespell................................................................Failed - hook id: codespell - exit code: 65 scripts/ci/qemu-run.sh:161: hda ==> had Signed-off-by: Daniil Klimuk <daniil.klimuk@3mdeb.com>
4da57cc
to
8fa988e
Compare
-device virtio-rng-pci,max-bytes=1024,period=1000 \ | ||
-device virtio-net,netdev=vmnic \ | ||
-netdev user,id=vmnic,hostfwd=tcp::5222-:22 \ | ||
-drive file=${HDD_PATH},if=ide" | ||
|
||
QEMU_PARAMS_OS_SAUND="-device ich9-intel-hda \ |
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.
QEMU_PARAMS_OS_SAUND="-device ich9-intel-hda \ | |
QEMU_PARAMS_OS_AUDIO="-device ich9-intel-hda \ |
@@ -22,6 +22,7 @@ then | |||
exit 1 | |||
fi | |||
|
|||
NO_AUDIO_EMUALTION="" |
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.
NO_AUDIO_EMUALTION="" | |
NO_AUDIO_EMULATION="" |
@@ -38,7 +39,7 @@ QEMU_FW_FILE="./qemu_q35.rom" | |||
|
|||
usage() { | |||
cat <<EOF | |||
Usage: ./$(basename ${0}) QEMU_MODE ACTION | |||
Usage: ./$(basename ${0}) QEMU_MODE ACTION ARGUMENTS |
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.
Usage: ./$(basename ${0}) QEMU_MODE ACTION ARGUMENTS | |
Usage: ./$(basename ${0}) [OPTIONS]... QEMU_MODE ACTION |
@@ -62,6 +63,10 @@ This is the QEMU wrapper script for the Dasharo Open Source Firmware Validation. | |||
HDD2_PATH optional path of the second hard drive to connect to the machine if | |||
ACTION "os" is used. Relative to DIR | |||
|
|||
Additional ARGUMENTS: |
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.
Additional ARGUMENTS: | |
OPTIONS: |
@@ -129,10 +134,6 @@ cleanup() { | |||
|
|||
trap cleanup INT | |||
|
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.
parse_args() { | |
while [[ $# -gt 0 ]]; do | |
case $1 in | |
-v|--verbose) | |
set -x | |
shift | |
;; | |
-h|--help) | |
usage | |
exit 0 | |
;; | |
-*) | |
usage | |
echo "Unknown option $1" | |
exit 1 | |
;; | |
*) | |
POSITIONAL_ARGS+=( "$1" ) | |
shift | |
;; | |
esac | |
done | |
} | |
parse_args "$@" | |
set -- "${POSITIONAL_ARGS[@]}" |
That way:
- You don't need to remove next if
- You can use arguments anywhere
If you apply then bring back
if [ $# -ne 2 ]; then
usage
fi
And add --help
and --verbose
to usage.
I mostly use this template: https://github.com/m-iwanicki/scripts/blob/main/scripts/script-template.sh when writing scripts.
ACTION="$2" | ||
shift 2 | ||
|
||
# Check for additional parameters before deciding on QEMU_PARAMS. Because the | ||
# additional parameters might change the QEMU_PARAMS. | ||
while [[ $# -gt 0 ]]; do | ||
case $1 in | ||
"--no-audio-emulation") | ||
NO_AUDIO_EMUALTION="true" | ||
shift | ||
;; | ||
*) | ||
echo -e "Additional argument: ${1} not supported\n" | ||
usage | ||
exit 1 | ||
;; | ||
esac | ||
done |
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.
ACTION="$2" | |
shift 2 | |
# Check for additional parameters before deciding on QEMU_PARAMS. Because the | |
# additional parameters might change the QEMU_PARAMS. | |
while [[ $# -gt 0 ]]; do | |
case $1 in | |
"--no-audio-emulation") | |
NO_AUDIO_EMUALTION="true" | |
shift | |
;; | |
*) | |
echo -e "Additional argument: ${1} not supported\n" | |
usage | |
exit 1 | |
;; | |
esac | |
done |
Implement previous suggestion
@@ -2,6 +2,7 @@ | |||
# |
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.
Remove everything from this file and add hda
to .codespellrc
file
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.
correct .codespellrc
format: #945 (comment)
while [[ $# -gt 0 ]]; do | ||
case $1 in | ||
"--no-audio-emulation") | ||
NO_AUDIO_EMUALTION="true" |
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.
NO_AUDIO_EMUALTION="true" | |
NO_AUDIO_EMULATION="true" |
case "${ACTION}" in | ||
firmware) | ||
MEMORY="1G" | ||
;; | ||
os) | ||
MEMORY="4G" | ||
QEMU_PARAMS="${QEMU_PARAMS} ${QEMU_PARAMS_OS}" | ||
|
||
if [[ "$NO_AUDIO_EMUALTION" != "true" ]]; then |
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.
if [[ "$NO_AUDIO_EMUALTION" != "true" ]]; then | |
if [[ "$NO_AUDIO_EMULATION" != "true" ]]; then |
case "${ACTION}" in | ||
firmware) | ||
MEMORY="1G" | ||
;; | ||
os) | ||
MEMORY="4G" | ||
QEMU_PARAMS="${QEMU_PARAMS} ${QEMU_PARAMS_OS}" | ||
|
||
if [[ "$NO_AUDIO_EMUALTION" != "true" ]]; then | ||
QEMU_PARAMS="${QEMU_PARAMS} ${QEMU_PARAMS_OS_SAUND}" |
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.
QEMU_PARAMS="${QEMU_PARAMS} ${QEMU_PARAMS_OS_SAUND}" | |
QEMU_PARAMS="${QEMU_PARAMS} ${QEMU_PARAMS_OS_AUDIO}" |
The QEMU audio device emulation caused issues in github.com/dasharo/meta-dts testing CIs. Check this issue for more inf.: Dasharo/dasharo-issues#1382 . Because the audio device is not used in the CIs - it could be disabled optionally.