From patchwork Tue Jan 6 14:28:21 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1297 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767709796; bh=eV8h22ABD1oOn9e5IF/mUrh363qeHVzW/EF+D7cWizs=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=EJYpdintz7c/yjSJ40vlvRpKVMCULLV34/OosDuhLP6DGd3eRwF4wBj8CjFcOVf3e pyZaP13I2gzQNzQzf3e2LT5pbMx3wLX9dCXdMNZIBai67nuFcp8rsEaH8ab67hkasL qIss5No7jaCaa5IRHMHFvr5Zxlb1h3vCC3GJVUMeRsKcEUFmB74v4dXbLMpIJ+lw0r u8pONk9MdafeJKjlnDKS40FYq02qzcQcl5rwYJQkJZBHfC8y+pgbYu2Vzh6NWUByon +bZAx68CscFNMGzPRa3ZfgQMptTV8s94l10VDKjbiZjbcSv3uuf995m0udgOSZuElo CsUpiEXkPnwFA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 172A769142 for ; Tue, 6 Jan 2026 07:29:56 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 10vjkB1kiIZ8 for ; Tue, 6 Jan 2026 07:29:56 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767709796; bh=eV8h22ABD1oOn9e5IF/mUrh363qeHVzW/EF+D7cWizs=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=EJYpdintz7c/yjSJ40vlvRpKVMCULLV34/OosDuhLP6DGd3eRwF4wBj8CjFcOVf3e pyZaP13I2gzQNzQzf3e2LT5pbMx3wLX9dCXdMNZIBai67nuFcp8rsEaH8ab67hkasL qIss5No7jaCaa5IRHMHFvr5Zxlb1h3vCC3GJVUMeRsKcEUFmB74v4dXbLMpIJ+lw0r u8pONk9MdafeJKjlnDKS40FYq02qzcQcl5rwYJQkJZBHfC8y+pgbYu2Vzh6NWUByon +bZAx68CscFNMGzPRa3ZfgQMptTV8s94l10VDKjbiZjbcSv3uuf995m0udgOSZuElo CsUpiEXkPnwFA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 02A3669083 for ; Tue, 6 Jan 2026 07:29:56 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767709794; bh=cufVL6kHUbtiPS1JYIEk/yevjWTbdG8xc5V8TIGhA5E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ni7neQvcn5v8E5GmouUr5bIKCrFPeaFBumBYnfxwXxQ1Brho8MTGLTH/SHjX7G8Fq hNMzyA8YSLqRflaSrob91U5KuM6LWFBKII3ji+Uiqt2YS+/8EHGCHL3KM9y84AL9ws 15O5p2+6+OzIyx7mTt85Xqq3RC+B8UMV/DIato+6me/j+jCOn+7aLoiw0yZIpToIJv 5XxEBBz7eIHjSl43NojTAPDFoy9QqRMKNg3cvr3m05pds1+tmIuX1kga8C6JjnnlwT 61+LzCB26VSUqgvMb9PT2HSzTg+66LLy1Tf9eVEVZzceyeHKi0AvIa2UD7zHndYrUR cQSJb5v/6Axsw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 0325369122; Tue, 6 Jan 2026 07:29:54 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id gKd5A5BeuX94; Tue, 6 Jan 2026 07:29:53 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767709789; bh=8j8VAR4ylS3ziawqkIrYYc01X5+VhT96UgJwN5LNXHg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gERIsi2g/Sh7LPSgGEpqtw/x6FJGrSHwtIAS7+V1/fUgv0ucg4guAxVryNSAYIMnu qqAhz85pZsHtq4/1njG7T8LIFAp/WpqLoMWAeiPSwEwsFdis0lS45uTkHwfJobOORn cjWy+bNkq6G2ss+uuiuDHIdSt0xRfFgPSnexO3MXMtDzXagGVpftOCGt7BbAUuc5H/ 83FhjObX6kf3mJs/ciEjmHQmoIGWpNOH1uY59EU/Mtj2cXSejhX6tCfK3FLsoXa5fD +/e96nxFOVgZpy/2aSiZbzAR5Y90iiAPTurcRnLomvMEHZA3U0xHJ24K8SJLYN6SFI BcLJ1HuDOmthA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 5F64B69054; Tue, 6 Jan 2026 07:29:49 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Tue, 6 Jan 2026 07:28:21 -0700 Message-ID: <20260106142834.2511220-17-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260106142834.2511220-1-sjg@u-boot.org> References: <20260106142834.2511220-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: X265BSVZQCP2ID2ZNDFPLPMTX752CWDO X-Message-ID-Hash: X265BSVZQCP2ID2ZNDFPLPMTX752CWDO X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass , Claude X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 16/22] buildman: Rename constants to UPPER_CASE in test.py List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Rename module-level constants to use UPPER_CASE naming style to conform to Python conventions and fix pylint C0103 warnings. Co-developed-by: Claude Signed-off-by: Simon Glass --- tools/buildman/test.py | 88 +++++++++++++++++++++--------------------- 1 file changed, 44 insertions(+), 44 deletions(-) diff --git a/tools/buildman/test.py b/tools/buildman/test.py index 361d65ccf81..588044fe20c 100644 --- a/tools/buildman/test.py +++ b/tools/buildman/test.py @@ -27,9 +27,9 @@ from u_boot_pylib import command from u_boot_pylib import terminal from u_boot_pylib import tools -use_network = True +USE_NETWORK = True -settings_data = ''' +SETTINGS_DATA = ''' # Buildman settings file [toolchain] @@ -39,7 +39,7 @@ main: /usr/sbin x86: i386 x86_64 ''' -settings_data_wrapper = ''' +SETTINGS_DATA_WRAPPER = ''' # Buildman settings file [toolchain] @@ -49,7 +49,7 @@ main: /usr/sbin wrapper = ccache ''' -settings_data_homedir = ''' +SETTINGS_DATA_HOMEDIR = ''' # Buildman settings file [toolchain] @@ -59,7 +59,7 @@ main = ~/mypath x86 = ~/mypath-x86- ''' -migration = '''===================== WARNING ====================== +MIGRATION = '''===================== WARNING ====================== This board does not use CONFIG_DM. CONFIG_DM will be compulsory starting with the v2020.01 release. Failure to update may result in board removal. @@ -67,7 +67,7 @@ See doc/develop/driver-model/migration.rst for more info. ==================================================== ''' -errors = [ +ERRORS = [ '''main.c: In function 'main_loop': main.c:260:6: warning: unused variable 'joe' [-Wunused-variable] ''', @@ -108,16 +108,16 @@ make: *** [sub-make] Error 2 ] -# hash, subject, return code, list of errors/warnings -commits = [ +# hash, subject, return code, list of ERRORS/warnings +COMMITS = [ ['1234', 'upstream/master, migration warning', 0, []], - ['5678', 'Second commit, a warning', 0, errors[0:1]], - ['9012', 'Third commit, error', 1, errors[0:2]], - ['3456', 'Fourth commit, warning', 0, [errors[0], errors[2]]], - ['7890', 'Fifth commit, link errors', 1, [errors[0], errors[3]]], + ['5678', 'Second commit, a warning', 0, ERRORS[0:1]], + ['9012', 'Third commit, error', 1, ERRORS[0:2]], + ['3456', 'Fourth commit, warning', 0, [ERRORS[0], ERRORS[2]]], + ['7890', 'Fifth commit, link errors', 1, [ERRORS[0], ERRORS[3]]], ['abcd', 'Sixth commit, fixes all errors', 0, []], ['ef01', 'Seventh commit, fix migration, check directory suppression', 1, - [errors[4]]], + [ERRORS[4]]], ] BOARDS = [ @@ -159,13 +159,13 @@ class TestBuild(unittest.TestCase): # Set up commits to build self.commits = [] sequence = 0 - for commit_info in commits: + for commit_info in COMMITS: comm = commit.Commit(commit_info[0]) comm.subject = commit_info[1] comm.return_code = commit_info[2] comm.error_list = commit_info[3] if sequence < 6: - comm.error_list += [migration] + comm.error_list += [MIGRATION] comm.sequence = sequence sequence += 1 self.commits.append(comm) @@ -178,7 +178,7 @@ class TestBuild(unittest.TestCase): # Add some test settings bsettings.setup(None) - bsettings.add_file(settings_data) + bsettings.add_file(SETTINGS_DATA) # Set up the toolchains self.toolchains = toolchain.Toolchains() @@ -218,7 +218,7 @@ class TestBuild(unittest.TestCase): result.stderr = (''.join(cmt.error_list) % {'basedir' : self.base_dir + '/.bm-work/00/'}) elif cmt.sequence < 6: - result.stderr = migration + result.stderr = MIGRATION result.combined = result.stdout + result.stderr return result @@ -265,7 +265,7 @@ class TestBuild(unittest.TestCase): # We should get two starting messages, an update for every commit built # and a summary message - self.assertEqual(count, len(commits) * len(BOARDS) + 3) + self.assertEqual(count, len(COMMITS) * len(BOARDS) + 3) build.set_display_options(**kwdisplay_args) build.show_summary(self.commits, board_selected) if echo_lines: @@ -321,7 +321,7 @@ class TestBuild(unittest.TestCase): boards4 = 'board4' if list_error_boards else '' # Upstream commit: migration warnings only - self.assertEqual(next(lines).text, f'01: {commits[0][1]}') + self.assertEqual(next(lines).text, f'01: {COMMITS[0][1]}') if not filter_migration_warnings: self.assert_summary(next(lines).text, 'arm', 'w+', @@ -332,10 +332,10 @@ class TestBuild(unittest.TestCase): outcome=OUTCOME_WARN) self.assertEqual(next(lines).text, - add_line_prefix('+', boards01234, migration, col.RED)) + add_line_prefix('+', boards01234, MIGRATION, col.RED)) # Second commit: all archs should fail with warnings - self.assertEqual(next(lines).text, f'02: {commits[1][1]}') + self.assertEqual(next(lines).text, f'02: {COMMITS[1][1]}') if filter_migration_warnings: self.assert_summary(next(lines).text, 'arm', 'w+', @@ -347,10 +347,10 @@ class TestBuild(unittest.TestCase): # Second commit: The warnings should be listed self.assertEqual(next(lines).text, - add_line_prefix('w+', boards1234, errors[0], col.YELLOW)) + add_line_prefix('w+', boards1234, ERRORS[0], col.YELLOW)) # Third commit: Still fails - self.assertEqual(next(lines).text, f'03: {commits[2][1]}') + self.assertEqual(next(lines).text, f'03: {COMMITS[2][1]}') if filter_migration_warnings: self.assert_summary(next(lines).text, 'arm', '', ['board1'], outcome=OUTCOME_OK) @@ -360,10 +360,10 @@ class TestBuild(unittest.TestCase): # Expect a compiler error self.assertEqual(next(lines).text, - add_line_prefix('+', boards234, errors[1], col.RED)) + add_line_prefix('+', boards234, ERRORS[1], col.RED)) # Fourth commit: Compile errors are fixed, just have warning for board3 - self.assertEqual(next(lines).text, f'04: {commits[3][1]}') + self.assertEqual(next(lines).text, f'04: {COMMITS[3][1]}') if filter_migration_warnings: expect = f"{'powerpc':>10}: " expect += ' ' + col.build(col.GREEN, '') @@ -381,22 +381,22 @@ class TestBuild(unittest.TestCase): # Compile error fixed self.assertEqual(next(lines).text, - add_line_prefix('-', boards234, errors[1], col.GREEN)) + add_line_prefix('-', boards234, ERRORS[1], col.GREEN)) if not filter_dtb_warnings: self.assertEqual( next(lines).text, - add_line_prefix('w+', boards34, errors[2], col.YELLOW)) + add_line_prefix('w+', boards34, ERRORS[2], col.YELLOW)) # Fifth commit - self.assertEqual(next(lines).text, f'05: {commits[4][1]}') + self.assertEqual(next(lines).text, f'05: {COMMITS[4][1]}') if filter_migration_warnings: self.assert_summary(next(lines).text, 'powerpc', '', ['board3'], outcome=OUTCOME_OK) self.assert_summary(next(lines).text, 'sandbox', '+', ['board4']) - # The second line of errors[3] is a duplicate, so buildman will drop it - expect = errors[3].rstrip().split('\n') + # The second line of ERRORS[3] is a duplicate, so buildman will drop it + expect = ERRORS[3].rstrip().split('\n') expect = [expect[0]] + expect[2:] expect = '\n'.join(expect) self.assertEqual(next(lines).text, @@ -405,10 +405,10 @@ class TestBuild(unittest.TestCase): if not filter_dtb_warnings: self.assertEqual( next(lines).text, - add_line_prefix('w-', boards34, errors[2], col.CYAN)) + add_line_prefix('w-', boards34, ERRORS[2], col.CYAN)) # Sixth commit - self.assertEqual(next(lines).text, f'06: {commits[5][1]}') + self.assertEqual(next(lines).text, f'06: {COMMITS[5][1]}') if filter_migration_warnings: self.assert_summary(next(lines).text, 'sandbox', '', ['board4'], outcome=OUTCOME_OK) @@ -416,17 +416,17 @@ class TestBuild(unittest.TestCase): self.assert_summary(next(lines).text, 'sandbox', 'w+', ['board4'], outcome=OUTCOME_WARN) - # The second line of errors[3] is a duplicate, so buildman will drop it - expect = errors[3].rstrip().split('\n') + # The second line of ERRORS[3] is a duplicate, so buildman will drop it + expect = ERRORS[3].rstrip().split('\n') expect = [expect[0]] + expect[2:] expect = '\n'.join(expect) self.assertEqual(next(lines).text, add_line_prefix('-', boards4, expect, col.GREEN)) self.assertEqual(next(lines).text, - add_line_prefix('w-', boards4, errors[0], col.CYAN)) + add_line_prefix('w-', boards4, ERRORS[0], col.CYAN)) # Seventh commit - self.assertEqual(next(lines).text, f'07: {commits[6][1]}') + self.assertEqual(next(lines).text, f'07: {COMMITS[6][1]}') if filter_migration_warnings: self.assert_summary(next(lines).text, 'sandbox', '+', ['board4']) else: @@ -437,13 +437,13 @@ class TestBuild(unittest.TestCase): self.assert_summary(next(lines).text, 'sandbox', '+', ['board4']) # Pick out the correct error lines - expect_str = errors[4].rstrip().replace('%(basedir)s', '').split('\n') + expect_str = ERRORS[4].rstrip().replace('%(basedir)s', '').split('\n') expect = expect_str[3:8] + [expect_str[-1]] expect = '\n'.join(expect) if not filter_migration_warnings: self.assertEqual( next(lines).text, - add_line_prefix('-', boards01234, migration, col.GREEN)) + add_line_prefix('-', boards01234, MIGRATION, col.GREEN)) self.assertEqual(next(lines).text, add_line_prefix('+', boards4, expect, col.RED)) @@ -595,7 +595,7 @@ class TestBuild(unittest.TestCase): build.commits = self.commits build.commit_count = len(self.commits) subject = self.commits[1].subject.translate(builder.trans_valid_chars) - dirname = f'/{2:02d}_g{commits[1][0]}_{subject[:20]}' + dirname = f'/{2:02d}_g{COMMITS[1][0]}_{subject[:20]}' self.check_dirs(build, dirname) def test_output_dir_current(self): @@ -633,7 +633,7 @@ class TestBuild(unittest.TestCase): def test_toolchain_download(self): """Test that we can download toolchains""" - if use_network: + if USE_NETWORK: with terminal.capture(): url = self.toolchains.locate_arch_url('arm') self.assertRegex(url, 'https://www.kernel.org/pub/tools/' @@ -663,7 +663,7 @@ class TestBuild(unittest.TestCase): # Test config with ccache wrapper bsettings.setup(None) - bsettings.add_file(settings_data_wrapper) + bsettings.add_file(SETTINGS_DATA_WRAPPER) tc = self.toolchains.select('arm') self.assertEqual('ccache arm-linux-', @@ -685,7 +685,7 @@ class TestBuild(unittest.TestCase): # Test config with ccache wrapper bsettings.setup(None) - bsettings.add_file(settings_data_wrapper) + bsettings.add_file(SETTINGS_DATA_WRAPPER) tc = self.toolchains.select('arm') env = tc.make_environment(False) @@ -711,7 +711,7 @@ class TestBuild(unittest.TestCase): build = builder.Builder(self.toolchains, base_dir, None, 1, 2) build.commits = self.commits - build.commit_count = len(commits) + build.commit_count = len(COMMITS) # pylint: disable=protected-access result = set(build._get_output_space_removals()) expected = {os.path.join(base_dir, f) for f in to_remove} @@ -1088,7 +1088,7 @@ class TestBuild(unittest.TestCase): """Test using ~ in a toolchain or toolchain-prefix section""" # Add some test settings bsettings.setup(None) - bsettings.add_file(settings_data_homedir) + bsettings.add_file(SETTINGS_DATA_HOMEDIR) # Set up the toolchains home = os.path.expanduser('~')