From: David Henningsson <david.henningsson@canonical.com>
To: alsa-devel@alsa-project.org, tiwai@suse.de
Cc: David Henningsson <david.henningsson@canonical.com>
Subject: [PATCH] hda-emu: Improve directory/path handling for testsuite
Date: Tue, 2 Oct 2012 17:41:27 +0200 [thread overview]
Message-ID: <1349192487-7969-1-git-send-email-david.henningsson@canonical.com> (raw)
There were some shortcomings when running the test scripts from
a random directory. Also added functionality to test an entire
directory tree at the same time.
---
tester/runner.py | 9 ++++++++-
tester/summary.py | 28 ++++++++++++++++++++++++----
2 files changed, 32 insertions(+), 5 deletions(-)
With this improvement we can run it over the entire alsa-info database.
The initial result is 619 of 5911 (10%) failing, mostly due to invalid verbs sent
(no input/output-amp, invalid amp index, setting *_EN without caps, etc).
diff --git a/tester/runner.py b/tester/runner.py
index b585ad3..30118ce 100644
--- a/tester/runner.py
+++ b/tester/runner.py
@@ -44,10 +44,13 @@ class ControlInfo():
class HdaEmuRunner():
def __init__(self):
- self.child_args = "../hda-emu -M -F"
+ import os.path
+ hda_emu_path = os.path.join(os.path.dirname(os.path.realpath(__file__)),"../hda-emu")
+ self.child_args = '"' + hda_emu_path + '" -M -F'
self.alsa_info = "/proc/asound/card0/codec#0"
self.errors = 0
self.warnings = 0
+ self.fatals = 0
self.print_errors = False
self.comm_log_enabled = False
self.last_command = None
@@ -81,6 +84,8 @@ class HdaEmuRunner():
self.warnings += 1
else:
self.errors += 1
+ if severity == "Fatal":
+ self.fatals += 1
if self.print_errors:
if not self.last_command_printed:
if self.last_command:
@@ -89,6 +94,8 @@ class HdaEmuRunner():
print "Encountered during initial parsing:"
self.last_command_printed = True
print " ", message
+ if self.fatals > 0:
+ raise Exception(message)
def check_stdout(self):
s = os.read(self.child.stdout.fileno(), 65536)
diff --git a/tester/summary.py b/tester/summary.py
index 6e94c9b..0f9fbf3 100755
--- a/tester/summary.py
+++ b/tester/summary.py
@@ -18,6 +18,11 @@
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
+def defaultpath(s):
+ import os.path
+ q = os.path.dirname(os.path.realpath(__file__))
+ return os.path.join(q, s)
+
def main():
import os
import os.path
@@ -26,18 +31,28 @@ def main():
import argparse
parser = argparse.ArgumentParser(description='Hda-emu automated test wrapper.')
parser.add_argument('--verbose', '-v', action='count')
+ parser.add_argument('--directory', '-d', action='store', default=defaultpath("../codecs/canonical/"))
+ parser.add_argument('--recursive', '-r', action="store_true", default=False)
+
parser_dict = parser.parse_args()
verbose = parser_dict.verbose
+ directory = parser_dict.directory
- os.chdir(os.path.dirname(os.path.realpath(__file__)))
- directory = "../codecs/canonical/"
- files = os.listdir(directory)
+ if parser_dict.recursive:
+ files = [os.path.join(root, filename) for root, _, filenames in os.walk(directory) for filename in filenames]
+ else:
+ files = os.listdir(directory)
+ files.sort()
successes = 0
fails = 0
warnings = 0
errors = 0
+ index = 0
for f in files:
+ index += 1
+ if verbose > 2:
+ print '[{0}/{1}]: Testing {2}'.format(index, len(files), f)
try:
r = runner.HdaEmuRunner()
r.set_alsa_info_file(os.path.join(directory, f))
@@ -51,7 +66,12 @@ def main():
print '{0} errors, {1} warnings. ({2})'.format(r.errors, r.warnings, f)
else:
successes += 1
- except:
+ except KeyboardInterrupt:
+ import sys
+ sys.exit(1)
+ except Exception as e:
+ if verbose > 0:
+ print 'Fatal error for {0}: {1}'.format(f, e)
errors += 1
fails += 1
--
1.7.9.5
next reply other threads:[~2012-10-02 15:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-02 15:41 David Henningsson [this message]
2012-10-08 8:17 ` [PATCH] hda-emu: Improve directory/path handling for testsuite 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=1349192487-7969-1-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).