alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: David Henningsson <david.henningsson@canonical.com>
To: tiwai@suse.de, alsa-devel@alsa-project.org
Cc: David Henningsson <david.henningsson@canonical.com>
Subject: [PATCH 4/5] hda-emu: Add playback/capture test to test suite
Date: Tue, 21 Aug 2012 10:54:02 +0200	[thread overview]
Message-ID: <1345539243-8147-5-git-send-email-david.henningsson@canonical.com> (raw)
In-Reply-To: <1345539243-8147-1-git-send-email-david.henningsson@canonical.com>

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
---
 tester/runner.py |   25 ++++++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/tester/runner.py b/tester/runner.py
index dc9f6fd..b585ad3 100644
--- a/tester/runner.py
+++ b/tester/runner.py
@@ -18,6 +18,7 @@
 
 import subprocess
 import os
+import re
 
 class ControlInfo():
     def __init__(self, runner, list_info):
@@ -27,7 +28,6 @@ class ControlInfo():
         self.name = carr[2]
 
     def add_info(self, get_info):
-        import re
         minmax_regex = re.compile("MIN/MAX: (\d+)/(\d+),\s+VAL:(( \\[\d+\\])+)")
         val_regex = re.compile(" \\[(\d+)\\]")
 
@@ -189,7 +189,6 @@ class HdaEmuRunner():
         dump = self.run_command("dump")
         pins = []
 
-        import re
         pinregex = re.compile("^Node (0x\w\w+) \\[Pin Complex\\].*")
         jackregex = re.compile("Pin Default.*\\[Jack\\]")
         for s in dump:
@@ -217,7 +216,6 @@ class HdaEmuRunner():
                 self.add_error("Tried to set " + c.name + " to " + str([int(x) for x in values]) + ", but got " + str(c.values) + " instead", "Error")
 
     def run_kcontrol_test(self):
-        import re
         minmax_regex = re.compile("MIN/MAX: (\d+)/(\d+),\s+VAL:(( \\[\d+\\])+)")
         val_regex = re.compile(" \\[(\d+)\\]")
 
@@ -234,11 +232,32 @@ class HdaEmuRunner():
                 self.run_set_kcontrol_test(c, [minval, minval])
                 self.run_set_kcontrol_test(c, [maxval, maxval])
 
+    def run_pcm_test(self):
+        pcm_regex = re.compile("Info: (\d+):.*play=(\d+), capt=(\d+)")
+        pcm_lines = self.run_command("PCM")
+        playback_test = False
+        for pcm_line in pcm_lines:
+            r = pcm_regex.match(pcm_line)
+            if r is None:
+                self.add_error("Invalid pcm response: " + pcm_line, "Error");
+                continue
+            pcm_devid = r.group(1)
+            play_count = r.group(2)
+            rec_count = r.group(3)
+            if play_count > 0:
+                playback_test = True
+                self.run_command("PCM " + pcm_devid + " playback")
+            if rec_count > 0:
+                self.run_command("PCM " + pcm_devid + " capture")
+        if not playback_test:
+            self.add_error("No playback PCM devices", "Error")
+
     def run_standard(self):
         self.start_process()
         self.run_command() # Initial parsing
         self.run_command("pm") # S3 test
         self.run_jack_plug_test()
         self.run_kcontrol_test()
+        self.run_pcm_test()
         self.stop_process()
 
-- 
1.7.9.5

  parent reply	other threads:[~2012-08-21  8:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-21  8:53 [PATCH 0/5] hda-emu: Add playback/capture test to test suite David Henningsson
2012-08-21  8:53 ` [PATCH 1/5] hda-emu: Store pointers to pcm streams instead of their content David Henningsson
2012-08-21  8:54 ` [PATCH 2/5] hda-emu: Add support for get/set converter channel count David Henningsson
2012-08-21  8:54 ` [PATCH 3/5] hda-emu: Add CX20585 to modem whitelist David Henningsson
2012-08-21  8:54 ` David Henningsson [this message]
2012-08-21  8:54 ` [PATCH 5/5] hda-emu: improve test suite summary script David Henningsson
2012-08-21  9:01 ` [PATCH 0/5] hda-emu: Add playback/capture test to test suite 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=1345539243-8147-5-git-send-email-david.henningsson@canonical.com \
    --to=david.henningsson@canonical.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=tiwai@suse.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).