Skip to content
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

Add audio tests #198

Merged
merged 1 commit into from
Dec 19, 2024
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
60 changes: 60 additions & 0 deletions Robot-Framework/test-suites/audio-tests/audio.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# SPDX-FileCopyrightText: 2022-2024 Technology Innovation Institute (TII)
# SPDX-License-Identifier: Apache-2.0

*** Settings ***
Documentation Testing audio applicaton
Force Tags audio lenovo-x1
Resource ../../__framework__.resource
Resource ../../resources/serial_keywords.resource
Resource ../../resources/common_keywords.resource
Resource ../../resources/connection_keywords.resource
Resource ../../resources/ssh_keywords.resource
Resource ../../config/variables.robot
Suite Setup Initialize Variables And Connect
Suite Teardown Close All Connections
Test Timeout 2 minutes


*** Test Cases ***
Record Audio And Verify
[Documentation] Record short audio with pulseaudio tool. Verify audio clip is bigger than default empty file (40Kb)
[Teardown] Execute Command rm /tmp/test*.wav sudo=True sudo_password=${PASSWORD}
[Tags] SSRCSP-T247
Connect to netvm
FOR ${vm} IN ${CHROME_VM} ${BUSINESS_VM}
Connect to VM ${vm}
# Execute Command timeouts in business-vm, but it is executing the command
Log To Console Recording audio file
Run Keyword And Ignore Error Execute Command parecord -r /tmp/test_${vm}.wav timeout=10
Sleep 5
Execute Command pkill parecord timeout=10 sudo=True sudo_password=${PASSWORD}
Sleep 1
SSHLibrary.Get File /tmp/test_${vm}.wav test_${vm}.wav
Check Audio File test_${vm}.wav
END

Check Audio devices
[Documentation] List audio sinks and sources in business-vm and chrome-vm and check status is running
[Tags] SSRCSP-T246
Connect to netvm
FOR ${vm} IN ${CHROME_VM} ${BUSINESS_VM}
Connect to VM ${vm}
${sources} Execute Command pactl list sources
${sinks} Execute Command pactl list sinks
Should Not Be Empty ${sources}
Should Not Be Empty ${sinks}
END


*** Keywords ***
Check Audio File
[Documentation] Check some basic audio data
[Arguments] ${audiofile} ${expected_duration}=5 sec
${out} Run ffmpeg -i ${audiofile}
${duration} Get Regexp Matches ${out} (?im)(Duration: )(\\d{1,2}:\\d{1,2}:\\d{1,2}.\\d{1,3}) 2
${bitrate} Get Regexp Matches ${out} (?im)(bitrate: )(\\d{1,4}) 2
Should Not Be Empty ${duration}[0]
Should Not Be Empty ${bitrate}[0]
${actual_duration} Convert Time ${duration}[0]
${expected_duration} Convert Time ${expected_duration}
Should Be True ${actual_duration} > ${expected_duration}
1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
file
grafana-loki
imagemagick
ffmpeg
iperf
(python3.withPackages (ps:
with ps; [
Expand Down
2 changes: 2 additions & 0 deletions pkgs/ghaf-robot/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
PyP100,
iperf,
imagemagick,
ffmpeg,
plugp100,
python3,
robotframework-advancedlogging,
Expand All @@ -16,6 +17,7 @@ writeShellApplication {
runtimeInputs = [
iperf
imagemagick
ffmpeg
(python3.withPackages (ps: [
# These are taken from nixpkgs
ps.robotframework
Expand Down
Loading