Skip to content
This repository has been archived by the owner on Jan 17, 2019. It is now read-only.

QA: test: add stress test script for pause/release #141

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
65 changes: 65 additions & 0 deletions test/qa/tests/stability_test/stress_pause_release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/bin/bash

# set default
TEST_TYPE='aplay'
DEV='hw:0,0'
FREQ=48000
FORMAT=S16_LE
CHL=2
DURATION=600 # testing time
TIME=0.5 # do pause/release per * second

# get parameters
while getopts ':t:D:r:f:c:' OPT &> /dev/null;
do
case $OPT in
t)
TEST_TYPE=$OPTARG;;
D)
PCM_DEV=$OPTARG;;
r)
FREQ=$OPTARG;;
f)
FORMAT=$OPTARG;;
c)
CHL=$OPTARG;;
*)
echo "Usage : ./stress_pause_release.sh -t aplay/arecord -Dpcm_device -r frequency -f format -c channel"
echo "Default will play 48K 16bit stereo wav via PCM0"
exit 7;;
esac
done

# get the test type
if [ $TEST_TYPE == aplay ]
then
WAV_FILE=/dev/zero
elif [ $TEST_TYPE == arecord ]
then
WAV_FILE=/dev/null
else
echo "Wrong test type: $TEST_TYPE, shoule be aplay or arecord."
fi

# inset expect interactive programs to simulate the action of pressing the space key
expect << EOF

spawn $TEST_TYPE -D$DEV -r $FREQ -f $FORMAT -c $CHL -i -vv -d $DURATION $WAV_FILE
expect {
{ # wait for the "message" prompt, once 'Input/Ouput occurs, output error }
"Input/output" { send_user "error\n" }
{ # once '#+' occurs, send the space key, then continue }
"*#+*" {
sleep $TIME
send " "
exp_continue
}
{ # once 'PAUSE' occurs, send the space key, then continue }
"*PAUSE*" {
sleep $TIME
send " "
exp_continue
}
}

EOF
34 changes: 34 additions & 0 deletions test/qa/tests/stability_test/stress_suspend_remume.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash

set -e

ITERATIONS=1000
COUNTER=0

while [ $COUNTER -lt $ITERATIONS ]; do
echo "Test $COUNTER"
dmesg -C

SUSPEND_TIME=$(($RANDOM%5+5)) # suspend: 5~10 seconds
echo “System will suspend after $SUSPEND_TIME seconds ...”
sleep $SUSPEND_TIME
WAKE_TIME=$(($RANDOM%5+5)) # wake: 5~10 seconds
echo "system will resume after $WAKE_TIME seconds ..."
# do system suspend and resume
rtcwake -m mem -s $WAKE_TIME

# check error
unset ERROR
ERROR=$(dmesg | grep sof-audio | grep -v "failed" | grep "error")
if [ ! -z "$ERROR" ]
then
dmesg > test_${COUNTER}_fail.log
echo "Suspend/resume failed, see test_${COUNTER}_fail.log for details"
exit 1
else
echo "Test ${COUNTER} success"
fi

dmesg > test_${COUNTER}_pass.log
let COUNTER+=1
done