]> git.alsa-project.org Git - alsa-utils.git/commitdiff
alsabat: add system power management S3 test
authorKeqiao, Zhang <keqiao.zhang@intel.com>
Fri, 26 Aug 2016 15:37:55 +0000 (23:37 +0800)
committerTakashi Iwai <tiwai@suse.de>
Tue, 30 Aug 2016 05:49:46 +0000 (07:49 +0200)
Support audio pause/resume for playback and capture. The user can
pause alsabat playback/capture threads by sending a signal. The patch
provides a method for QA to quick test audio during system s3.

Signed-off-by: Keqiao, Zhang <keqiao.zhang@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
bat/alsabat-test.sh

index aa0281b07d7bbb5c07032272eaaadb74d2e24337..bc3d51231964b40c1641d74c935b9727ac950b90 100755 (executable)
@@ -15,6 +15,10 @@ logdir="tmp"
 maxfreq=16547
 minfreq=17
 
+# sleep time and pause time
+sleep_time=5
+pause_time=2
+
 # features passes vs. features all
 feature_pass=0
 feature_cnt=0
@@ -48,6 +52,35 @@ feature_test () {
        echo "$commands $1" >> $logdir/$((feature_cnt-1)).log
 }
 
+feature_test_power () {
+       echo "============================================"
+       echo "$feature_cnt: ALSA $2"
+       echo "-------------------------------------------"
+       echo "$commands $1 --log=$logdir/$feature_cnt.log"
+
+       # run alsabat in the background
+       nohup $commands $1 > $logdir/$feature_cnt.log 2>&1 &
+       sleep $pause_time
+       pid=`ps -aux |grep alsabat|head -1 |awk -F ' ' '{print $2}'`
+
+       # stop the alsabat thread
+       kill -STOP $pid > /dev/null
+       sleep 4
+
+       # do system S3
+       rtcwake -m mem -s $sleep_time
+       sleep $pause_time
+
+       # resume the alasbat thread to run
+       kill -CONT $pid > /dev/null
+
+       # wait for alsabat to complete the analysis
+       sleep $pause_time
+       cat $logdir/$feature_cnt.log |grep -i "Return value is 0" > /dev/null
+       evaluate_result $?
+       echo "$commands $1" >> $logdir/$((feature_cnt-1)).log
+}
+
 # test items
 feature_list_test () {
        init_counter
@@ -87,6 +120,7 @@ feature_list_test () {
                        "noise detect threshold in SNR(dB)"
        feature_test "--snr-pc 5" \
                        "noise detect threshold in noise percentage(%)"
+       feature_test_power "-n5s" "power management: S3 test"
 
        print_result
 }