From f5cb7203b7fffed81e0e0ab0f07056625835f3e4 Mon Sep 17 00:00:00 2001 From: Zhang Keqiao Date: Fri, 23 Nov 2018 15:03:37 +0800 Subject: [PATCH 1/2] QA: test: add stress test script for pause/resume Signed-off-by: Zhang Keqiao --- .../stability_test/stress_pause_release.sh | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100755 test/qa/tests/stability_test/stress_pause_release.sh diff --git a/test/qa/tests/stability_test/stress_pause_release.sh b/test/qa/tests/stability_test/stress_pause_release.sh new file mode 100755 index 0000000..ccb6144 --- /dev/null +++ b/test/qa/tests/stability_test/stress_pause_release.sh @@ -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 From 850884ac127c1f877b629e3cef6f2f105307af9e Mon Sep 17 00:00:00 2001 From: Zhang Keqiao Date: Fri, 23 Nov 2018 15:11:06 +0800 Subject: [PATCH 2/2] QA: test: add stress test script for suspend/resume Signed-off-by: Zhang Keqiao --- .../stability_test/stress_suspend_remume.sh | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 test/qa/tests/stability_test/stress_suspend_remume.sh diff --git a/test/qa/tests/stability_test/stress_suspend_remume.sh b/test/qa/tests/stability_test/stress_suspend_remume.sh new file mode 100755 index 0000000..26ad841 --- /dev/null +++ b/test/qa/tests/stability_test/stress_suspend_remume.sh @@ -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