From patchwork Sat Feb 6 01:04:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Warren X-Patchwork-Id: 579712 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id E40E31402C0 for ; Sat, 6 Feb 2016 12:05:02 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A9C70A750D; Sat, 6 Feb 2016 02:04:58 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id A2e-D9Jvqpdu; Sat, 6 Feb 2016 02:04:58 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3CBC0A74B4; Sat, 6 Feb 2016 02:04:58 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id CA94CA74DA for ; Sat, 6 Feb 2016 02:04:54 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pcKxEeU_IM6k for ; Sat, 6 Feb 2016 02:04:54 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from avon.wwwdotorg.org (avon.wwwdotorg.org [70.85.31.133]) by theia.denx.de (Postfix) with ESMTPS id 58094A74B4 for ; Sat, 6 Feb 2016 02:04:50 +0100 (CET) Received: from severn.wwwdotorg.org (unknown [192.168.65.5]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by avon.wwwdotorg.org (Postfix) with ESMTPS id 7F83E64A4; Fri, 5 Feb 2016 18:04:31 -0700 (MST) Received: from swarren-lx1.nvidia.com (localhost [127.0.0.1]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by severn.wwwdotorg.org (Postfix) with ESMTPSA id 88411E4646; Fri, 5 Feb 2016 18:05:39 -0700 (MST) From: Stephen Warren To: Simon Glass Date: Fri, 5 Feb 2016 18:04:43 -0700 Message-Id: <1454720683-9557-2-git-send-email-swarren@wwwdotorg.org> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1454720683-9557-1-git-send-email-swarren@wwwdotorg.org> References: <1454720683-9557-1-git-send-email-swarren@wwwdotorg.org> X-NVConfidentiality: public X-Virus-Scanned: clamav-milter 0.98.6 at avon.wwwdotorg.org X-Virus-Status: Clean Cc: u-boot@lists.denx.de, Stephen Warren Subject: [U-Boot] [PATCH V2 2/2] test/py: capture the entire U-Boot version at boot X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" From: Stephen Warren The existing regex simply ensures that the captured version string doesn't go past the end of a line. We really want to grab as much as possible. Do this by explicitly including a ) character at the end of the regex to match the last character of the version test. Signed-off-by: Stephen Warren Acked-by: Simon Glass Tested-by: Simon Glass --- v2: Also remove some now-redundant code. The signon regex now never matches the text ", Build: ...", so there's no need for explicit code to chop it out. --- test/py/u_boot_console_base.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/test/py/u_boot_console_base.py b/test/py/u_boot_console_base.py index cc5427335177..7e1e9d430ffa 100644 --- a/test/py/u_boot_console_base.py +++ b/test/py/u_boot_console_base.py @@ -17,8 +17,8 @@ import sys import u_boot_spawn # Regexes for text we expect U-Boot to send to the console. -pattern_u_boot_spl_signon = re.compile('(U-Boot SPL \\d{4}\\.\\d{2}-[^\r\n]*)') -pattern_u_boot_main_signon = re.compile('(U-Boot \\d{4}\\.\\d{2}-[^\r\n]*)') +pattern_u_boot_spl_signon = re.compile('(U-Boot SPL \\d{4}\\.\\d{2}[^\r\n]*\\))') +pattern_u_boot_main_signon = re.compile('(U-Boot \\d{4}\\.\\d{2}[^\r\n]*\\))') pattern_stop_autoboot_prompt = re.compile('Hit any key to stop autoboot: ') pattern_unknown_command = re.compile('Unknown command \'.*\' - try \'help\'') pattern_error_notification = re.compile('## Error: ') @@ -312,12 +312,7 @@ class ConsoleBase(object): if m != 0: raise Exception('Bad pattern found on console: ' + self.bad_pattern_ids[m - 1]) - signon = self.p.after - build_idx = signon.find(', Build:') - if build_idx == -1: - self.u_boot_version_string = signon - else: - self.u_boot_version_string = signon[:build_idx] + self.u_boot_version_string = self.p.after while True: m = self.p.expect([self.prompt_escaped, pattern_stop_autoboot_prompt] + self.bad_patterns)