Skip to content

Commit 6cee092

Browse files
committed
TinyALSA: Add wrapper for tinyALSA's tests
Add check-tinyalsa wrapper used to run any test with tinyAlsa testsets. Signed-off-by: Arkadiusz Cholewinski <arkadiuszx.cholewinski@intel.com>
1 parent 36cc0a4 commit 6cee092

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

test-case/check-tinyalsa.sh

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/bin/bash
2+
3+
##
4+
## Case Name: Wrapper to run a test case given with TinyALSA
5+
## Preconditions:
6+
## TinyALSA is installed.
7+
## Description:
8+
## This script serves as a wrapper to execute a test case script using TinyALSA.
9+
## It expects the test case script file name (without path) as the first parameter,
10+
## followed by other parameters required for that test case.
11+
## Case step:
12+
## 1. check TinyALSA and SoX are installed
13+
## 2. SOF_ALSA_TOOL environment variable is set to TinyALSA
14+
## 3. The test case script is executed.
15+
## Expect result:
16+
## The test case script is executed using TinyALSA
17+
##
18+
19+
set -e
20+
21+
# Function to check if a command is available
22+
check_command() {
23+
if [ -x "$(command -v "$1")" ]; then
24+
echo "$1 is installed."
25+
else
26+
echo "$1 is not installed. Exiting..."
27+
exit 1
28+
fi
29+
}
30+
31+
# Preconditions: Check if tinyalsa executables are present on the DUT
32+
check_command "sox"
33+
check_command "tinycap"
34+
check_command "tinyplay"
35+
36+
# Ensure the test case script file name is provided
37+
if [ -z "$1" ]; then
38+
echo "Error: No test case script file name provided. Exiting..."
39+
exit 1
40+
fi
41+
42+
export SOF_ALSA_TOOL=tinyalsa
43+
44+
TESTDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
45+
46+
# shellcheck disable=SC2145
47+
[ -x "$TESTDIR/test-case/$(basename "$1")" ] && exec "$TESTDIR"/test-case/"$@"

0 commit comments

Comments
 (0)