From patchwork Thu Aug 14 23:35:05 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 380044 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 A8A47140090 for ; Fri, 15 Aug 2014 09:36:15 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 4DF9B4A044; Fri, 15 Aug 2014 01:35:56 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de 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 fnp2O0WFBC4E; Fri, 15 Aug 2014 01:35:56 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7D82D4B5D0; Fri, 15 Aug 2014 01:35:31 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5A6AD4A04A for ; Fri, 15 Aug 2014 01:35:23 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de 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 an9L0gh0+dJm for ; Fri, 15 Aug 2014 01:35:20 +0200 (CEST) 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 mail-ig0-f202.google.com (mail-ig0-f202.google.com [209.85.213.202]) by theia.denx.de (Postfix) with ESMTPS id 21CFF4A049 for ; Fri, 15 Aug 2014 01:35:13 +0200 (CEST) Received: by mail-ig0-f202.google.com with SMTP id r2so54274igi.1 for ; Thu, 14 Aug 2014 16:35:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=vomIkIxa1zTLgzPklyqino1Q8CbauNih2zaBaaXFZJE=; b=MJip6m0KGjbqsuUQVZ8WjmNRczD5B7TTEQS1OjM3FKdx4gRvnkNwSbDgZwuNf2ed+9 17QpuRUv7dLIXTWEzoA+y4sCrj6Zj0da7ZtXOB0YupE8HRaUIEAtxGdsXRRpc4eVIueN Ma4q8zc53FAbadw9fsuSmG/YLDAuLEB7/OO1uMAzxHPFxtZbhGR9res+Az8NVEFmmBfy 5Zd8jZOpqZdhkGhyJo3bERqMbbIHTQ3hJhJQ8f62H8n/2xy98VyqzVHfx9XUmaQ3LcLF 7VhxBYSEzBXttD/wqhPAxzePph9McEuUzitc48ykx0tmcGU7UvtftvqgCPJO/oj/kWuk qRlQ== X-Gm-Message-State: ALoCoQnlUlVcRw+gLelAHFOHZ3OvvZbT/GTjmlbm1DdLXFDdTvJBJniWmZr+9tqWSBKx3vFf0K6U X-Received: by 10.182.60.36 with SMTP id e4mr7811915obr.3.1408059311904; Thu, 14 Aug 2014 16:35:11 -0700 (PDT) Received: from corp2gmr1-2.hot.corp.google.com (corp2gmr1-2.hot.corp.google.com [172.24.189.93]) by gmr-mx.google.com with ESMTPS id t75si119505yhe.5.2014.08.14.16.35.11 for (version=TLSv1.1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 14 Aug 2014 16:35:11 -0700 (PDT) Received: from kaki.bld.corp.google.com (kaki.bld.corp.google.com [172.29.216.32]) by corp2gmr1-2.hot.corp.google.com (Postfix) with ESMTP id AF3D35A456C; Thu, 14 Aug 2014 16:35:11 -0700 (PDT) Received: by kaki.bld.corp.google.com (Postfix, from userid 121222) id 3A4462205B8; Thu, 14 Aug 2014 17:35:11 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Thu, 14 Aug 2014 17:35:05 -0600 Message-Id: <1408059307-13829-4-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 2.1.0.rc2.206.gedb03e5 In-Reply-To: <1408059307-13829-1-git-send-email-sjg@chromium.org> References: <1408059307-13829-1-git-send-email-sjg@chromium.org> Cc: Tom Rini , u-boot-review@google.com, York Sun Subject: [U-Boot] [PATCH v7 3/5] patman: Correct unit tests to run correctly X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de It seems that doctest behaves differently now, and some of the unit tests do not run. Adjust the tests to work correctly. ./tools/patman/patman --test Signed-off-by: Simon Glass --- Changes in v7: None Changes in v6: - Add new patch to fix patman unit tests Changes in v5: None tools/patman/gitutil.py | 8 ++++---- tools/patman/patchstream.py | 7 +++++-- tools/patman/terminal.py | 8 ++++++-- tools/patman/test.py | 13 +++++++------ 4 files changed, 22 insertions(+), 14 deletions(-) diff --git a/tools/patman/gitutil.py b/tools/patman/gitutil.py index e2b4959..29e6fdd 100644 --- a/tools/patman/gitutil.py +++ b/tools/patman/gitutil.py @@ -478,13 +478,13 @@ def LookupEmail(lookup_name, alias=None, raise_on_error=True, level=0): ... OSError: Recursive email alias at 'other' >>> LookupEmail('odd', alias, raise_on_error=False) - \033[1;31mAlias 'odd' not found\033[0m + Alias 'odd' not found [] >>> # In this case the loop part will effectively be ignored. >>> LookupEmail('loop', alias, raise_on_error=False) - \033[1;31mRecursive email alias at 'other'\033[0m - \033[1;31mRecursive email alias at 'john'\033[0m - \033[1;31mRecursive email alias at 'mary'\033[0m + Recursive email alias at 'other' + Recursive email alias at 'john' + Recursive email alias at 'mary' ['j.bloggs@napier.co.nz', 'm.poppins@cloud.net'] """ if not alias: diff --git a/tools/patman/patchstream.py b/tools/patman/patchstream.py index 0040468..322374c 100644 --- a/tools/patman/patchstream.py +++ b/tools/patman/patchstream.py @@ -275,7 +275,7 @@ class PatchStream: # Suppress duplicate signoffs elif signoff_match: - if (self.is_log or + if (self.is_log or not self.commit or self.commit.CheckDuplicateSignoff(signoff_match.group(1))): out = [line] @@ -312,7 +312,10 @@ class PatchStream: out = [] log = self.series.MakeChangeLog(self.commit) out += self.FormatTags(self.tags) - out += [line] + self.commit.notes + [''] + log + out += [line] + if self.commit: + out += self.commit.notes + out += [''] + log elif self.found_test: if not re_allowed_after_test.match(line): self.lines_after_test += 1 diff --git a/tools/patman/terminal.py b/tools/patman/terminal.py index 11f80d8..963f2f8 100644 --- a/tools/patman/terminal.py +++ b/tools/patman/terminal.py @@ -30,8 +30,12 @@ class Color(object): enabled: True if color output should be enabled. If False then this class will not add color codes at all. """ - self._enabled = (colored == COLOR_ALWAYS or - (colored == COLOR_IF_TERMINAL and os.isatty(sys.stdout.fileno()))) + try: + self._enabled = (colored == COLOR_ALWAYS or + (colored == COLOR_IF_TERMINAL and + os.isatty(sys.stdout.fileno()))) + except: + self._enabled = False def Start(self, color, bright=True): """Returns a start color code. diff --git a/tools/patman/test.py b/tools/patman/test.py index 8fcfe53..e8f7472 100644 --- a/tools/patman/test.py +++ b/tools/patman/test.py @@ -55,6 +55,7 @@ This adds functions to enable/disable clocks and reset to on-chip peripherals. Signed-off-by: Simon Glass --- + arch/arm/cpu/armv7/tegra2/Makefile | 2 +- arch/arm/cpu/armv7/tegra2/ap20.c | 57 ++---- arch/arm/cpu/armv7/tegra2/clock.c | 163 +++++++++++++++++ @@ -200,7 +201,7 @@ index 0000000..2234c87 self.assertEqual(result.errors, 0) self.assertEqual(result.warnings, 0) self.assertEqual(result.checks, 0) - self.assertEqual(result.lines, 67) + self.assertEqual(result.lines, 56) os.remove(inf) def testNoSignoff(self): @@ -211,18 +212,18 @@ index 0000000..2234c87 self.assertEqual(result.errors, 1) self.assertEqual(result.warnings, 0) self.assertEqual(result.checks, 0) - self.assertEqual(result.lines, 67) + self.assertEqual(result.lines, 56) os.remove(inf) def testSpaces(self): inf = self.SetupData('spaces') result = checkpatch.CheckPatch(inf) self.assertEqual(result.ok, False) - self.assertEqual(len(result.problems), 1) + self.assertEqual(len(result.problems), 2) self.assertEqual(result.errors, 0) - self.assertEqual(result.warnings, 1) + self.assertEqual(result.warnings, 2) self.assertEqual(result.checks, 0) - self.assertEqual(result.lines, 67) + self.assertEqual(result.lines, 56) os.remove(inf) def testIndent(self): @@ -233,7 +234,7 @@ index 0000000..2234c87 self.assertEqual(result.errors, 0) self.assertEqual(result.warnings, 0) self.assertEqual(result.checks, 1) - self.assertEqual(result.lines, 67) + self.assertEqual(result.lines, 56) os.remove(inf)