From patchwork Tue Jan 6 14:28:11 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1287 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=1767709753; bh=9sFeGDbzEF+93zSr5aHnOFHWxbdgQEaYB23/H9UFEIw=; 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=kIhRfnZDSOrYH7G46rhbDUi8IrgDNqx6wcv1a5lMMKLGx0tSTdAE1lCmDONP8cRz8 5h7JrBmxBqxmqHEYHedHoKd5a4Y9+yAR/VRBuk2C3xScoMCAaXtEICLOGBUF1/sRA9 DJGKJ5hyMFIkPX2OMmVElKCv62N/V/WxMV8xdNnZ8x/KQAo4HkquANhh8Vqd/zKGeh QdNqBKEssIi5rbxHhaVuLCSD6ItiWZCkMv9DaJ652e3qSMjODZNMxBdC0fXKRWEKo8 Yd3SZK+0CWxU/hy4tXEK3dzJ/tY9uw8yxlPD37w7i+4WnehcDTj/AXm4n+zSHHeK+f ZITYT4U9K5Rlg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 1EC6D69054 for ; Tue, 6 Jan 2026 07:29:13 -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 0RM9T2zcQJZm for ; Tue, 6 Jan 2026 07:29:13 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767709753; bh=9sFeGDbzEF+93zSr5aHnOFHWxbdgQEaYB23/H9UFEIw=; 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=kIhRfnZDSOrYH7G46rhbDUi8IrgDNqx6wcv1a5lMMKLGx0tSTdAE1lCmDONP8cRz8 5h7JrBmxBqxmqHEYHedHoKd5a4Y9+yAR/VRBuk2C3xScoMCAaXtEICLOGBUF1/sRA9 DJGKJ5hyMFIkPX2OMmVElKCv62N/V/WxMV8xdNnZ8x/KQAo4HkquANhh8Vqd/zKGeh QdNqBKEssIi5rbxHhaVuLCSD6ItiWZCkMv9DaJ652e3qSMjODZNMxBdC0fXKRWEKo8 Yd3SZK+0CWxU/hy4tXEK3dzJ/tY9uw8yxlPD37w7i+4WnehcDTj/AXm4n+zSHHeK+f ZITYT4U9K5Rlg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 0D57569121 for ; Tue, 6 Jan 2026 07:29:13 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767709751; bh=mpUsaKtOQlKGy+D6NjQ3pgPkHRVrDPJl55ON0m61xM0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pwvz4J/zY2EdeUrNwMJJzTjdjQ+t5G/LdenAYRovx+mMcUL4ZEI0jB/DRcFY+5jr3 bB8vwBhXFmowryQ9Wngtnk9kndgqeSKRNpL6CQPToYjWX0s/cs7wRWbGiRTwyaD46/ PPUTkgDktTzrmfuxvMIhC4Ipl4EI0Pv6/bXMhls3uNqKL1lBM4fAlhA2GdgIVubuMr /OMohllRGBGT7DNSIqbuNwMIAB6+ssDNBTz86auy2kbHKBl/Zgmw9/10bUTPQI5zFR p5g2NmJmKEnWylZW/YsniISQFelz+WaiUXO7yAfxMQ/e5QhfgOpfUTdeddmdOgoqxD dKlmQwpxERwWQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id AFD3469054; Tue, 6 Jan 2026 07:29:11 -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 amhbxCmO1zZg; Tue, 6 Jan 2026 07:29:11 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767709747; bh=Pr4RSxjnfqRLhxURWAeg5ijNdgA+jx79eoZyvhwhkXY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UMlQZT1anbNeVDnPYBsCW9DMP90lVQGOqxax9ZjIcIqCMqx934Kwc8IitJ5umJr5t +jUvbdZ3dkdhO0DsAI8giiFIV98mw+fsfqcdNGZw2hHTl4awnm98duyx1gVjQ8ACiG EqfCsg1+ut2i7S+6Uj++WNBtWr5rwfyBiNvRF+7kCrHLeL+086rGWXqMl7YScZzmRf 8sB/QfrFigo6WpOwDdJxC820edXYRrgSXR9RET/11MH6gzbhRGPvii/lpO7LEmuHeR hWJeyUoLmwLbLYpmY1UGu5s6cwumpku+WH5s6H6OdA5hA0yfy7meUa/u5mf9unqd9d LW/AjtJZxPeOA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 3D0E569118; Tue, 6 Jan 2026 07:29:07 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Tue, 6 Jan 2026 07:28:11 -0700 Message-ID: <20260106142834.2511220-7-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: 2B2CF5BW3YTR7A2JFNJSTA6M4CAZM2I7 X-Message-ID-Hash: 2B2CF5BW3YTR7A2JFNJSTA6M4CAZM2I7 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 06/22] buildman: Add missing docstrings 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 Add docstrings to functions missing them to fix pylint C0116 warnings. Add a module-level docstring too. Co-developed-by: Claude Signed-off-by: Simon Glass --- tools/buildman/test.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tools/buildman/test.py b/tools/buildman/test.py index 69d81da4a22..70dcf082755 100644 --- a/tools/buildman/test.py +++ b/tools/buildman/test.py @@ -2,6 +2,8 @@ # Copyright (c) 2012 The Chromium OS Authors. # +"""Tests for the buildman build tool""" + import os import shutil import sys @@ -203,6 +205,7 @@ class TestBuild(unittest.TestCase): shutil.rmtree(self.base_dir) def make(self, commit, brd, stage, *args, **kwargs): + """Mock make function for testing build output""" result = command.CommandResult() boardnum = int(brd.target[-1]) result.return_code = 0 @@ -221,6 +224,7 @@ class TestBuild(unittest.TestCase): return result def assert_summary(self, text, arch, plus, brds, outcome=OUTCOME_ERR): + """Check that the summary text matches expectations""" col = self._col expected_colour = (col.GREEN if outcome == OUTCOME_OK else col.YELLOW if outcome == OUTCOME_WARN else col.RED) @@ -571,6 +575,7 @@ class TestBuild(unittest.TestCase): 'sandbox']), ({'all': ['board4'], 'sandbox': ['board4']}, [])) def check_dirs(self, build, dirname): + """Check that the output directories are correct""" self.assertEqual(f'base{dirname}', build.get_output_dir(1)) self.assertEqual(f'base{dirname}/fred', build.get_build_dir(1, 'fred')) self.assertEqual(f'base{dirname}/fred/done', @@ -583,6 +588,7 @@ class TestBuild(unittest.TestCase): build.get_err_file(1, 'fred')) def test_output_dir(self): + """Test output-directory naming for a commit""" build = builder.Builder(self.toolchains, BASE_DIR, None, 1, 2, checkout=False, show_unknown=False) build.commits = self.commits @@ -592,6 +598,7 @@ class TestBuild(unittest.TestCase): self.check_dirs(build, dirname) def test_output_dir_current(self): + """Test output-directory naming for current source""" build = builder.Builder(self.toolchains, BASE_DIR, None, 1, 2, checkout=False, show_unknown=False) build.commits = None @@ -599,6 +606,7 @@ class TestBuild(unittest.TestCase): self.check_dirs(build, '/current') def test_output_dir_no_subdirs(self): + """Test output-directory naming without subdirectories""" build = builder.Builder(self.toolchains, BASE_DIR, None, 1, 2, checkout=False, show_unknown=False, no_subdirs=True) @@ -607,6 +615,7 @@ class TestBuild(unittest.TestCase): self.check_dirs(build, '') def test_toolchain_aliases(self): + """Test that toolchain aliases are handled correctly""" self.assertTrue(self.toolchains.select('arm') != None) with self.assertRaises(ValueError): self.toolchains.select('no-arch') @@ -686,6 +695,7 @@ class TestBuild(unittest.TestCase): self.assertTrue(b'CROSS_COMPILE' not in env) def test_prepare_output_space(self): + """Test preparation of output-directory space""" def _touch(fname): tools.write_file(os.path.join(base_dir, fname), b'') @@ -839,14 +849,17 @@ class TestBuild(unittest.TestCase): ['MARY="mary"', 'Missing expected line: CONFIG_MARY="mary"']], result) 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) items = tools.read_file(running_fname, binary=False).split() return [int(x) for x in items] def get_time(self): + """Get current mock time for testing""" return self.cur_time def inc_time(self, amount): + """Increment mock time, handling process exit if scheduled""" self.cur_time += amount # Handle a process exiting @@ -855,6 +868,7 @@ class TestBuild(unittest.TestCase): if pid != self.finish_pid] def kill(self, pid, signal): + """Mock kill function that validates process IDs""" if pid not in self.valid_pids: raise OSError('Invalid PID')