From patchwork Sun Apr 5 15:21:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1266569 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=TY8tS8J1; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48wHX33g8Dz9sQx for ; Mon, 6 Apr 2020 01:24:19 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B93428188A; Sun, 5 Apr 2020 17:23:09 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="TY8tS8J1"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2BDA28188A; Sun, 5 Apr 2020 17:23:07 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x141.google.com (mail-il1-x141.google.com [IPv6:2607:f8b0:4864:20::141]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id AE65C8188A for ; Sun, 5 Apr 2020 17:23:02 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x141.google.com with SMTP id k29so12257963ilg.0 for ; Sun, 05 Apr 2020 08:23:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bCjru7uOIL4KhRQndGRUWuelY2hkwXXzTKhuZzBhy64=; b=TY8tS8J1h81qkjCQFWBmVmWan3NSeSSqqxXdQEVCQXF+4SfVslklTRcVVvPGnt0fKf 6uapfVQd5RCeY4z+0ufVajlIoGOzFQNJUJTv3RIAj0tXLzNqhYZT2QKzCUOtBz7VXlhh hSiG4+/iHTh09pMqpMk9Us7EKuhPHIsKzNXmk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=bCjru7uOIL4KhRQndGRUWuelY2hkwXXzTKhuZzBhy64=; b=jxBogKAFxPAg6sreWOiEjZzbvgbUGSccy/gVjY7Hssj6maO4Swm2ozL1CrUlbxq6XQ GX6R6CDJjY83I7yhcY7MH76aqHOxSAlhwHWJ/4mndXWbU7CyObFOqo4KGAkmITS8dZQY Fk0Ke0jgsXNqbxEjJg8WNFoVYSwIQFAXacU29X1qmn+L9SRU8vBjkglQxyPk+Y8wuSHp BYAb6adtQNUzRUtCBnfGmWWMkC7jalNFaq9oKqFjpRGDd3UqCkH/FDDrHqy5zrWDEYby QoLb8h77iJpybb/uUX0Z+WvfvwEOt4Bj80tK9wN7peiTL259FtPEBvL4t/UEd6cC7mri RTjg== X-Gm-Message-State: AGi0PuYRdGGLcdxlP/BttfouiTa9BWegTqjwcVuMfOdEWx+cYFPexsF2 CuluLuyJYb/UyXM0Db8/cGKd8pOIndLnRw== X-Google-Smtp-Source: APiQypKLQPoWmnul8sMmlwQScEg6txQcgUA4Y5YskqFszrvN6SWpXrjTzCzFpltIVEJt+dwUlH2HbQ== X-Received: by 2002:a92:1d59:: with SMTP id d86mr17923330ild.49.1586100181315; Sun, 05 Apr 2020 08:23:01 -0700 (PDT) Received: from localhost.localdomain (c-73-14-175-90.hsd1.co.comcast.net. [73.14.175.90]) by smtp.gmail.com with ESMTPSA id r5sm4405611ioc.6.2020.04.05.08.23.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Apr 2020 08:23:01 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Bin Meng , Stephen Warren , Stephen Warren , Tom Rini , Cristian Ciocaltea , Simon Glass Subject: [PATCH 10/22] buildman: Show the list of boards in magenta Date: Sun, 5 Apr 2020 09:21:19 -0600 Message-Id: <20200405092116.10.I6a438c17db351ba63e0d2fa4cc3d309cd2391763@changeid> X-Mailer: git-send-email 2.26.0.292.g33ef6b2f38-goog In-Reply-To: <20200405152131.98147-1-sjg@chromium.org> References: <20200405152131.98147-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.2 at phobos.denx.de X-Virus-Status: Clean It is quite hard to see the list of board for each error line since the colour is the same as the actual error line. Show the board list in magenta so that it is easier to distinguish them. Signed-off-by: Simon Glass --- tools/buildman/builder.py | 15 ++++++++--- tools/buildman/test.py | 57 ++++++++++++++++++++++----------------- 2 files changed, 44 insertions(+), 28 deletions(-) diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py index 238b711dec4..7cbb1a6f628 100644 --- a/tools/buildman/builder.py +++ b/tools/buildman/builder.py @@ -1249,13 +1249,20 @@ class Builder: colour: Colour to use for output """ if err_lines: - out = [] + out_list = [] for line in err_lines: boards = '' names = [board.target for board in line.boards] - boards = '(%s) ' % ','.join(names) if names else '' - out.append('%s%s%s' % (line.char, boards, line.errline)) - Print('\n'.join(out), colour=colour) + board_str = ','.join(names) if names else '' + if board_str: + out = self.col.Color(colour, line.char + '(') + out += self.col.Color(self.col.MAGENTA, board_str, + bright=False) + out += self.col.Color(colour, ') %s' % line.errline) + else: + out = self.col.Color(colour, line.char + line.errline) + out_list.append(out) + Print('\n'.join(out_list)) self._error_lines += 1 diff --git a/tools/buildman/test.py b/tools/buildman/test.py index 3ca4da849d4..5f8e37e578b 100644 --- a/tools/buildman/test.py +++ b/tools/buildman/test.py @@ -222,7 +222,7 @@ class TestBuild(unittest.TestCase): list_error_boards: Adjust the check for output produced with the --list-error-boards flag """ - def add_line_prefix(prefix, boards, error_str): + def add_line_prefix(prefix, boards, error_str, colour): """Add a prefix to each line of a string The training \n in error_str is removed before processing @@ -230,14 +230,23 @@ class TestBuild(unittest.TestCase): Args: prefix: String prefix to add error_str: Error string containing the lines + colour: Expected colour for the line. Note that the board list, + if present, always appears in magenta Returns: New string where each line has the prefix added """ - if boards: - boards = '(%s) ' % boards lines = error_str.strip().splitlines() - new_lines = [prefix + boards + line for line in lines] + new_lines = [] + for line in lines: + if boards: + expect = self._col.Color(colour, prefix + '(') + expect += self._col.Color(self._col.MAGENTA, boards, + bright=False) + expect += self._col.Color(colour, ') %s' % line) + else: + expect = self._col.Color(colour, prefix + line) + new_lines.append(expect) return '\n'.join(new_lines) # Upstream commit: no errors @@ -262,9 +271,9 @@ class TestBuild(unittest.TestCase): # Second commit: The warnings should be listed line = next(lines) + self.maxDiff = 1000 self.assertEqual(line.text, - add_line_prefix('w+', boards1234, errors[0])) - self.assertEqual(line.colour, col.YELLOW) + add_line_prefix('w+', boards1234, errors[0], col.YELLOW)) # Third commit: Still fails self.assertEqual(next(lines).text, '03: %s' % commits[2][1]) @@ -276,8 +285,8 @@ class TestBuild(unittest.TestCase): # Expect a compiler error line = next(lines) - self.assertEqual(line.text, add_line_prefix('+', boards234, errors[1])) - self.assertEqual(line.colour, col.RED) + self.assertEqual(line.text, + add_line_prefix('+', boards234, errors[1], col.RED)) # Fourth commit: Compile errors are fixed, just have warning for board3 self.assertEqual(next(lines).text, '04: %s' % commits[3][1]) @@ -294,12 +303,12 @@ class TestBuild(unittest.TestCase): # Compile error fixed line = next(lines) - self.assertEqual(line.text, add_line_prefix('-', boards234, errors[1])) - self.assertEqual(line.colour, col.GREEN) + self.assertEqual(line.text, + add_line_prefix('-', boards234, errors[1], col.GREEN)) line = next(lines) - self.assertEqual(line.text, add_line_prefix('w+', boards34, errors[2])) - self.assertEqual(line.colour, col.YELLOW) + self.assertEqual(line.text, + add_line_prefix('w+', boards34, errors[2], col.YELLOW)) # Fifth commit self.assertEqual(next(lines).text, '05: %s' % commits[4][1]) @@ -312,12 +321,12 @@ class TestBuild(unittest.TestCase): expect = [expect[0]] + expect[2:] expect = '\n'.join(expect) line = next(lines) - self.assertEqual(line.text, add_line_prefix('+', boards4, expect)) - self.assertEqual(line.colour, col.RED) + self.assertEqual(line.text, + add_line_prefix('+', boards4, expect, col.RED)) line = next(lines) - self.assertEqual(line.text, add_line_prefix('w-', boards34, errors[2])) - self.assertEqual(line.colour, col.CYAN) + self.assertEqual(line.text, + add_line_prefix('w-', boards34, errors[2], col.CYAN)) # Sixth commit self.assertEqual(next(lines).text, '06: %s' % commits[5][1]) @@ -329,12 +338,12 @@ class TestBuild(unittest.TestCase): expect = [expect[0]] + expect[2:] expect = '\n'.join(expect) line = next(lines) - self.assertEqual(line.text, add_line_prefix('-', boards4, expect)) - self.assertEqual(line.colour, col.GREEN) + self.assertEqual(line.text, + add_line_prefix('-', boards4, expect, col.GREEN)) line = next(lines) - self.assertEqual(line.text, add_line_prefix('w-', boards4, errors[0])) - self.assertEqual(line.colour, col.CYAN) + self.assertEqual(line.text, + add_line_prefix('w-', boards4, errors[0], col.CYAN)) # Seventh commit self.assertEqual(next(lines).text, '07: %s' % commits[6][1]) @@ -345,15 +354,15 @@ class TestBuild(unittest.TestCase): expect = expect_str[3:8] + [expect_str[-1]] expect = '\n'.join(expect) line = next(lines) - self.assertEqual(line.text, add_line_prefix('+', boards4, expect)) - self.assertEqual(line.colour, col.RED) + self.assertEqual(line.text, + add_line_prefix('+', boards4, expect, col.RED)) # Now the warnings lines expect = [expect_str[0]] + expect_str[10:12] + [expect_str[9]] expect = '\n'.join(expect) line = next(lines) - self.assertEqual(line.text, add_line_prefix('w+', boards4, expect)) - self.assertEqual(line.colour, col.YELLOW) + self.assertEqual(line.text, + add_line_prefix('w+', boards4, expect, col.YELLOW)) def testOutput(self): """Test basic builder operation and output