Skip to content

Commit 8a46815

Browse files
committed
test-cplay: add test
Signed-off-by: Emilia Kurdybelska <emiliax.kurdybelska@intel.com>
1 parent aa8e581 commit 8a46815

File tree

2 files changed

+6
-35
lines changed

2 files changed

+6
-35
lines changed

case-lib/lib.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1604,11 +1604,12 @@ analyze_mixed_sound()
16041604
fi
16051605
}
16061606

1607-
# Generates 20s .mp3 file for testing
1607+
# Generates 20s 2-channels .mp3 file for testing
16081608
# Arguments: 1 - output filename
16091609
generate_mp3_file()
16101610
{
1611-
ffmpeg -f lavfi -i "sine=frequency=1000:duration=20" "$1"
1611+
mkdir -p "$HOME/Music"
1612+
ffmpeg -f lavfi -i "sine=frequency=1000:duration=20" -ac 2 "$1"
16121613
}
16131614

16141615
# Load socwatch and check if module was loaded correctly
Lines changed: 3 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -97,28 +97,6 @@ analyze_socwatch_results()
9797
fi
9898
}
9999

100-
check_for_PC10_state()
101-
{
102-
pc10_count=$(awk '/Package C-State Summary: Entry Counts/{f=1; next} f && /PC10/{print $3; exit}' "$socwatch_output".csv)
103-
if [ -z "$pc10_count" ]; then
104-
die "PC10 State not achieved"
105-
fi
106-
dlogi "Entered into PC10 State $pc10_count times"
107-
108-
pc10_per=$(awk '/Package C-State Summary: Residency/{f=1; next} f && /PC10/{print $3; exit}' "$socwatch_output".csv)
109-
pc10_time=$(awk '/Package C-State Summary: Residency/{f=1; next} f && /PC10/{print $5; exit}' "$socwatch_output".csv)
110-
dlogi "Spent $pc10_time ms ($pc10_per %) in PC10 State"
111-
112-
json_str=$( jq -n \
113-
--arg id "$i" \
114-
--arg cnt "$pc10_count" \
115-
--arg time "$pc10_time" \
116-
--arg per "$pc10_per" \
117-
'{$id: {pc10_entires_count: $cnt, time_ms: $time, time_percentage: $per}}' )
118-
119-
results=$(jq --slurp 'add' <(echo "$results") <(echo "$json_str"))
120-
}
121-
122100
check_the_pcms()
123101
{
124102
aplay "-Dplug${pcm_p}" -d 1 /dev/zero -q || die "Failed to play on PCM: ${pcm_p}"
@@ -128,7 +106,6 @@ check_the_pcms()
128106
# Checks for soundfile needed for test, generates missing ones
129107
prepare_test_soundfile()
130108
{
131-
mkdir -p "$HOME/Music"
132109
if [ ! -f "$audio_filename" ]; then
133110
generate_mp3_file "$audio_filename"
134111
fi
@@ -137,13 +114,12 @@ prepare_test_soundfile()
137114
run_test()
138115
{
139116
check_the_pcms
140-
# audio_filename="$HOME/Music/test.mp3"
141-
# prepare_test_soundfile
117+
audio_filename="$HOME/Music/test-2ch.mp3"
118+
prepare_test_soundfile
142119

143120
socwatch_output="$LOG_ROOT/socwatch-results/socwatch_report"
144121

145-
# play_command="cplay -D${pcm_p} -d ${duration} ${audio_filename}"
146-
play_command=(aplay -Dplug${pcm_p} -d ${duration} /dev/zero)
122+
play_command="cplay -c 0 -d 50 -I MP3 ${audio_filename} -v"
147123
run_with_socwatch "$socwatch_output" "${play_command[@]}"
148124

149125
analyze_socwatch_results
@@ -153,13 +129,7 @@ main()
153129
{
154130
export RUN_SOCWATCH=true
155131
start_test
156-
if [ "$pcm_p" = "" ]||[ "$pcm_c" = "" ];
157-
then
158-
dloge "No playback or capture PCM specified."
159-
exit 2
160-
fi
161132
logger_disabled || func_lib_start_log_collect
162-
163133
run_test
164134
}
165135

0 commit comments

Comments
 (0)