Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .ci/test-sound.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/usr/bin/env bash

set -euo pipefail

# Source common functions and settings
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
export SCRIPT_DIR
source "${SCRIPT_DIR}/common.sh"

SAMPLE_SOUND="/usr/share/sounds/alsa/Front_Center.wav"

# Override timeout for sound tests
# Sound tests need different timeout: 30s for Linux, 900s for macOS
case "${OS_TYPE}" in
Darwin)
TIMEOUT=900
;;
Linux)
TIMEOUT=30
;;
*)
TIMEOUT=30
;;
esac

# Clean up any existing semu processes before starting tests
cleanup

# Test sound device
expect <<DONE
set timeout ${TIMEOUT}
spawn make check
expect "buildroot login:" { send "root\\n" } timeout { exit 1 }
expect "# " { send "uname -a\\n" } timeout { exit 2 }
expect "riscv32 GNU/Linux" { send "aplay ${SAMPLE_SOUND} \\n" } timeout { exit 3 }
expect " Mono" { } timeout { exit 4 }
DONE

ret="$?"

MESSAGES=("OK!" \
"Fail to boot" \
"Fail to login" \
"Fail to run playback commands" \
"Playback fails" \
)

if [ "$ret" -eq 0 ]; then
print_success "${MESSAGES["$ret"]}"
else
print_error "${MESSAGES["$ret"]}"
fi

exit "$ret"
8 changes: 8 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ jobs:
run: sudo .ci/test-netdev.sh
shell: bash
timeout-minutes: 10
- name: sound test
run: .ci/test-sound.sh
shell: bash
timeout-minutes: 5

semu-macOS:
runs-on: macos-latest
Expand Down Expand Up @@ -118,6 +122,10 @@ jobs:
shell: bash
timeout-minutes: 20
if: ${{ success() }}
- name: sound test
run: .ci/test-sound.sh
shell: bash
timeout-minutes: 20

coding_style:
runs-on: ubuntu-24.04
Expand Down
Loading