All of lore.kernel.org
 help / color / mirror / Atom feed
From: keqiao.zhang@intel.com
To: alsa-devel@alsa-project.org
Cc: keqiao.zhang@intel.com
Subject: [PATCH 2/2] alsabat: add system power management S3 test
Date: Fri, 26 Aug 2016 23:37:55 +0800	[thread overview]
Message-ID: <1472225875-18081-3-git-send-email-keqiao.zhang@intel.com> (raw)
In-Reply-To: <1472225875-18081-1-git-send-email-keqiao.zhang@intel.com>

From: "Keqiao, Zhang" <keqiao.zhang@intel.com>

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>
---
 bat/alsabat-test.sh | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/bat/alsabat-test.sh b/bat/alsabat-test.sh
index aa0281b..bc3d512 100755
--- a/bat/alsabat-test.sh
+++ b/bat/alsabat-test.sh
@@ -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
 }
-- 
2.5.0

  parent reply	other threads:[~2016-08-26  7:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-26 15:37 [PATCH 0/2] alsabat: add power management S3 test keqiao.zhang
2016-08-26 15:37 ` [PATCH 1/2] alsabat: fix alsabat -86 error keqiao.zhang
2016-08-26 15:37 ` keqiao.zhang [this message]
2016-08-30  5:50 ` [PATCH 0/2] alsabat: add power management S3 test Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1472225875-18081-3-git-send-email-keqiao.zhang@intel.com \
    --to=keqiao.zhang@intel.com \
    --cc=alsa-devel@alsa-project.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.