From patchwork Thu Sep 4 12:21:06 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Henningsson X-Patchwork-Id: 4845691 X-Patchwork-Delegate: tiwai@suse.de Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B49489F2EC for ; Thu, 4 Sep 2014 13:29:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7FD65202B4 for ; Thu, 4 Sep 2014 13:29:30 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id E1245202AE for ; Thu, 4 Sep 2014 13:29:28 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id BC4592657D4; Thu, 4 Sep 2014 15:29:27 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NO_DNS_FOR_FROM, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 87137265825; Thu, 4 Sep 2014 15:07:43 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 4DE1C26581B; Thu, 4 Sep 2014 15:07:40 +0200 (CEST) Received: from youngberry.canonical.com (youngberry.canonical.com [91.189.89.112]) by alsa0.perex.cz (Postfix) with ESMTP id 2CA102658A6 for ; Thu, 4 Sep 2014 14:21:07 +0200 (CEST) Received: from hd9483857.selulk5.dyn.perspektivbredband.net ([217.72.56.87] helo=localhost.localdomain) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1XPW2E-0001P1-Rq; Thu, 04 Sep 2014 12:21:07 +0000 From: David Henningsson To: alsa-devel@alsa-project.org, tiwai@suse.de Date: Thu, 4 Sep 2014 14:21:06 +0200 Message-Id: <1409833267-9778-5-git-send-email-david.henningsson@canonical.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1409833267-9778-1-git-send-email-david.henningsson@canonical.com> References: <1409833267-9778-1-git-send-email-david.henningsson@canonical.com> Cc: David Henningsson Subject: [alsa-devel] [PATCH 4/5] hda-emu/tester: Add codec index parameter to hda-emu-tester X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Also improve runner's error handling a little. Signed-off-by: David Henningsson --- tester/hda-emu-tester.py | 2 ++ tester/runner.py | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/tester/hda-emu-tester.py b/tester/hda-emu-tester.py index 4782a97..3b994ab 100755 --- a/tester/hda-emu-tester.py +++ b/tester/hda-emu-tester.py @@ -22,6 +22,7 @@ def handle_argv(): import argparse parser = argparse.ArgumentParser(description='Hda-emu automated test wrapper.') parser.add_argument('--file', dest='file', required=True, help='alsa-info filename') + parser.add_argument('--codec-index', dest='codecindex', default=0, help='what codec to test') parser.add_argument('--print-errors', dest='print_errors', action="store_true", default=False, help='print errors, and the command that caused it') parser.add_argument('--comm-log', dest='comm_log', action="store_true", @@ -34,6 +35,7 @@ def run_test(argv): result.set_print_errors(argv.print_errors) result.set_comm_log_enabled(argv.comm_log) result.set_alsa_info_file(argv.file) + result.set_codec_index(argv.codecindex) result.run_standard() return result diff --git a/tester/runner.py b/tester/runner.py index 1e7ecf9..964da1a 100644 --- a/tester/runner.py +++ b/tester/runner.py @@ -20,6 +20,9 @@ import subprocess import os import re +class HdaEmuFatalError(Exception): + pass + class ControlInfo(): def __init__(self, runner, list_info): self.runner = runner @@ -48,15 +51,20 @@ class HdaEmuRunner(): def __init__(self): 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.child_args = '"' + hda_emu_path + '" -M -F -i' self.alsa_info = "/proc/asound/card0/codec#0" self.errors = 0 self.warnings = 0 self.fatals = 0 + self.codec_index = 0 self.print_errors = False + self.error_list = [] self.comm_log_enabled = False self.last_command = None + def set_codec_index(self, codec_index): + self.codec_index = codec_index + def set_alsa_info_file(self, filename): self.alsa_info = filename @@ -71,6 +79,7 @@ class HdaEmuRunner(): from subprocess import PIPE, STDOUT args = shlex.split(self.child_args) + args.append(str(self.codec_index)) args.append(self.alsa_info) self.child = subprocess.Popen(args, bufsize=0, stdin=PIPE, stdout=PIPE, stderr=PIPE) @@ -82,6 +91,7 @@ class HdaEmuRunner(): self.child = None def add_error(self, message, severity): + self.error_list.append(message) if severity == "Warning": self.warnings += 1 else: @@ -97,7 +107,7 @@ class HdaEmuRunner(): self.last_command_printed = True print " ", message if self.fatals > 0: - raise Exception(message) + raise HdaEmuFatalError(message) def check_stdout(self): s = os.read(self.child.stdout.fileno(), 65536)