From patchwork Tue Jan 6 14:28:24 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1300 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=1767709809; bh=Fdb1N73sebWCGGFDVjbjIbUgMv9qvjGEqx37PAiTHFs=; 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=axeMFaATO7b3vDQmgQNuKBbYMAoZsxyESyd92asz49r52pEuMReJKGfdvb4mJEa5L REjCgUi2MONZmchGrZA8TzUjmz1lO4hsaQXSpN+3UMxkfZtvURH3H42mmXfdFXjYWD ag4lp/PyO903LC5GWYodV4FZvbViuXbaQpwDcVbWcpE9fsaVxtv1nwAJLspvQgiVdl RKcTaO3klMKWeQvWAg+RJXx0JzGK4OMkDEpKRWRBDCfkFWCNtkzqOl5KSYd0Hu3q7X RFCdHdVnOscx7sJmZ1EWF1u8HcidhLcr7CK81l3AhUeMXITOMjbvaHe5KqjYNpaNCa GsJ0v+PIu1igA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 31B0B69118 for ; Tue, 6 Jan 2026 07:30:09 -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 zzJAmC_2cUVP for ; Tue, 6 Jan 2026 07:30:09 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767709809; bh=Fdb1N73sebWCGGFDVjbjIbUgMv9qvjGEqx37PAiTHFs=; 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=axeMFaATO7b3vDQmgQNuKBbYMAoZsxyESyd92asz49r52pEuMReJKGfdvb4mJEa5L REjCgUi2MONZmchGrZA8TzUjmz1lO4hsaQXSpN+3UMxkfZtvURH3H42mmXfdFXjYWD ag4lp/PyO903LC5GWYodV4FZvbViuXbaQpwDcVbWcpE9fsaVxtv1nwAJLspvQgiVdl RKcTaO3klMKWeQvWAg+RJXx0JzGK4OMkDEpKRWRBDCfkFWCNtkzqOl5KSYd0Hu3q7X RFCdHdVnOscx7sJmZ1EWF1u8HcidhLcr7CK81l3AhUeMXITOMjbvaHe5KqjYNpaNCa GsJ0v+PIu1igA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 1DE3B69122 for ; Tue, 6 Jan 2026 07:30:09 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767709807; bh=nwT0mH+CIPpyP6ZhvFjOVhsmrBXNR6ry2FDGn0MKqkI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Il6d/WcY8KZQ7VDHBUNNECUzKSYycXM0x3AjjLGqxbPNlruyI1R9AzPm51WYHb6Hx +icZDmJdOdSnb9qcKNDtiiiqto5VrR+tHlQvhxB2KuD1gsnX+2PMA0PoclVWAnfha6 Z9OO7YSrzyXZJYoj0w1pQux4mTvl3BE7w3+YLkcZGPPIDEsztvgQi0y8swl9ESyjog 88FX28fJ87MAuuOJuSjX2ItUd4pNj0ewzF9b/Q51od5VzSakXk8luLZHCnmVCzZsds fqIaqnNSO8GLFI0RPCcOIDVAVWj7sgcUuVGBlBggjzOTUb9OpS7A2UG5C2ijt40gJd +DfgefsSaIKhg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3C25D69118; Tue, 6 Jan 2026 07:30:07 -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 4AH5s9MSW5vj; Tue, 6 Jan 2026 07:30:07 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767709803; bh=mUY7uAi/Etv/SY6Cu//tWAjv5d8l0KbkHND2JKnCfyk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WC4MtAWsnSoYd+k0jUs4On7EJ8vVBBF10ebADDdCesrdiJlN0pC2sU6KDcSBKpmIw nhEQSOxuzN41tyJSEg9HQVlCz1ZbrqkuU0H7Ry5vRiKXLIRNlWWD3qVeHQCcimGoHj e3nX0hSXOVmxtXE6vNNn33XBuB6X6G+R4+z3SqhKlmPJa2MG83P3K7zDakPrnwbrM7 G3z8dOlgEa2uE2Xaa6aZd2HRKlvry7Q4Ht/4uYQIpmGYSwygUrbAQSpH6WUHD2qIYf ejav+gP4321kvTD2im3YBFXiOi8gVAKFFSVb9L+29NtykSncpO2h8/WZzHmNwKop2w Rw/YvtolzZ/qw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 2665E69054; Tue, 6 Jan 2026 07:30:03 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Tue, 6 Jan 2026 07:28:24 -0700 Message-ID: <20260106142834.2511220-20-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: AYFVSQC3DQDONQ663L2SOR4BPQFHYBOC X-Message-ID-Hash: AYFVSQC3DQDONQ663L2SOR4BPQFHYBOC 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 Opus 4 . 5" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 19/22] buildman: Split TestBuild into multiple classes 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 Split TestBuild into a base class and five subclasses to improve code organisation and reduce method count per class: - TestBuildBase: Common setUp/tearDown - TestBuildOutput: Output and summary tests - TestBuildBoards: Board-selection tests - TestBuild: Output-directory and toolchain tests - TestBuildConfig: Config-adjustment tests - TestBuildMisc: Process-limit and other tests Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- tools/buildman/main.py | 6 ++++-- tools/buildman/test.py | 31 +++++++++++++++++++++++++++---- 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/tools/buildman/main.py b/tools/buildman/main.py index 914dfe04988..d85e8dd428d 100755 --- a/tools/buildman/main.py +++ b/tools/buildman/main.py @@ -48,8 +48,10 @@ def run_tests(skip_net_tests, debug, verbose, args): # 'entry' module. result = test_util.run_test_suites( 'buildman', debug, verbose, False, False, args.threads, test_name, [], - [test.TestBuild, func_test.TestFunctional, test_boards.TestBoards, - test_bsettings.TestBsettings, 'buildman.toolchain']) + [test.TestBuildOutput, test.TestBuildBoards, test.TestBuild, + test.TestBuildConfig, test.TestBuildMisc, func_test.TestFunctional, + test_boards.TestBoards, test_bsettings.TestBsettings, + 'buildman.toolchain']) return (0 if result.wasSuccessful() else 1) diff --git a/tools/buildman/test.py b/tools/buildman/test.py index 904f4e9a212..40ddb351b3c 100644 --- a/tools/buildman/test.py +++ b/tools/buildman/test.py @@ -153,11 +153,10 @@ class Options: self.show_errors = False self.keep_outputs = False -class TestBuild(unittest.TestCase): - """Test buildman +# pylint: disable=too-many-instance-attributes +class TestBuildBase(unittest.TestCase): + """Base class for buildman tests with common setup""" - TODO: Write tests for the rest of the functionality - """ def setUp(self): # Set up commits to build self.commits = [] @@ -207,6 +206,10 @@ class TestBuild(unittest.TestCase): def tearDown(self): shutil.rmtree(self.base_dir) + +class TestBuildOutput(TestBuildBase): + """Tests for build output and summary display""" + def make(self, cmt, brd, _stage, *_args, **_kwargs): """Mock make function for testing build output""" result = command.CommandResult() @@ -518,6 +521,10 @@ class TestBuild(unittest.TestCase): args = ['tegra20'] control.do_buildman(options, args) + +class TestBuildBoards(TestBuildBase): + """Tests for board selection""" + def test_board_single(self): """Test single board selection""" self.assertEqual(self.brds.select_boards(['sandbox']), @@ -578,6 +585,14 @@ class TestBuild(unittest.TestCase): self.assertEqual(self.brds.select_boards(['sandbox sandbox', 'sandbox']), ({'all': ['board4'], 'sandbox': ['board4']}, [])) + + +class TestBuild(TestBuildBase): + """Tests for buildman functionality + + TODO: Write tests for the rest of the functionality + """ + def check_dirs(self, build, dirname): """Check that the output directories are correct""" self.assertEqual(f'base{dirname}', build.get_output_dir(1)) @@ -720,6 +735,10 @@ class TestBuild(unittest.TestCase): expected = {os.path.join(base_dir, f) for f in to_remove} self.assertEqual(expected, result) + +class TestBuildConfig(TestBuildBase): + """Tests for config adjustment functionality""" + def test_adjust_cfg_nop(self): """check various adjustments of config that are nops""" # enable an enabled CONFIG @@ -854,6 +873,10 @@ class TestBuild(unittest.TestCase): ['MARY="mary"', 'Missing expected line: CONFIG_MARY="mary"']], result) + +class TestBuildMisc(TestBuildBase): + """Miscellaneous buildman tests""" + def get_procs(self): """Get list of running process IDs from the running file""" running_fname = os.path.join(self.base_dir, control.RUNNING_FNAME)