From patchwork Fri Jan 9 18:30:55 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1381 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=1767983509; bh=nd0Uo1Xle76TfKGZiny6yDuguO4SMN2VEilBdFiJIQE=; 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=mEcakTT73CL2/eL1virFiUKuZFu7u8Mi4zo2W1/G+ZQwMSlvQ3pi5rll/2ucYmJg5 X578TQoQc81COZUjdNa8Pvlo+w0SfYCMiwt2nBl0US5Miww/FJLq+B0HRU5TMDcRlj xCl/l9Xq68QAnWcupGIn73J4RaSwqv8GZBBi5i3RedgMqvb2J0RTMsJHpb6Vxy0y1S uiMr0GC/Z2R9HQU44BTplJlHXKfB7gvTOqStujRUUyx5CGEpWMNXN0u0fn0NRdi7A3 TUrlkcIUG3as66yt4CQNHnbMsHjnPLq+sgmAehTvmOHD9Pg4+GnEIAHd3fSgaAdO4k /7BB/lhdxUNCg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 35DFD69218 for ; Fri, 9 Jan 2026 11:31:49 -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 sdZYxHGa3SzO for ; Fri, 9 Jan 2026 11:31:49 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767983509; bh=nd0Uo1Xle76TfKGZiny6yDuguO4SMN2VEilBdFiJIQE=; 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=mEcakTT73CL2/eL1virFiUKuZFu7u8Mi4zo2W1/G+ZQwMSlvQ3pi5rll/2ucYmJg5 X578TQoQc81COZUjdNa8Pvlo+w0SfYCMiwt2nBl0US5Miww/FJLq+B0HRU5TMDcRlj xCl/l9Xq68QAnWcupGIn73J4RaSwqv8GZBBi5i3RedgMqvb2J0RTMsJHpb6Vxy0y1S uiMr0GC/Z2R9HQU44BTplJlHXKfB7gvTOqStujRUUyx5CGEpWMNXN0u0fn0NRdi7A3 TUrlkcIUG3as66yt4CQNHnbMsHjnPLq+sgmAehTvmOHD9Pg4+GnEIAHd3fSgaAdO4k /7BB/lhdxUNCg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 2430B6920A for ; Fri, 9 Jan 2026 11:31:49 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767983506; bh=8I8cp2V+eWC7lV2SeKFx89Zzx3U33jLCRKX99WrftHk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f3clCWWfAzMQa54uTIIN/gLKvOrVQ26FCE08TUNGGCQADANz0wIz7xyTWpJHWM3tY ZzXSPHBxUQxmTBo1kZafHNFnOi/33kikFub6TLQ82cv3mX5heQvoknPIUT7MPPm8O+ 7EAXdMj1MYjCd4hfBuq2xT/3DqKbHXD+YYpp0vAgdlEvksD4B/PFsG5CPrWgrWMC+P ZSArU3GR/ZvWgTRnPisMslDKydpmXW45rqRO6pjFhrsfgsrKK5M8/kY6L5V9WGmDU5 jOlUnkaxnHcT7XmLgoRxLGRDXeDz15p7mpk3mwGcVETZ/+h8FPnba1LJRn8WEznJQE EMPUy1mBYE91w== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 9770269208; Fri, 9 Jan 2026 11:31:46 -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 MlqlSmVo3AI4; Fri, 9 Jan 2026 11:31:46 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767983502; bh=e+19uvarZxE/zKpJyN+zhqmQfs+FkUfFnjSMu62duC8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GD4tUkiyKNCYvkru3X/Cxjdyyf/vYZ54gBksgWj+O73Kt6wCmVOlomVZG1b33vYZz zPVnLXtdx5PU0kc9WbWijtCxCZ6AGNe2Fa/ZQmym35dGZ9IB3Wvx0mfhA5ciXNnLR+ TMwOqf4aFaQPvLNu8QLzNj1WyIutwpR24wAA4K8DrGWUg3ycQgpTDybtGXeh82xFqw wvVp5GLWcSr24d688IOZtoxv2tsChdc+09mRgPx//wcv9vlbesCd3dYVp5VL98WRM5 GryQ6anigOE7W+PGJIiftfcaRSg3sLq+NZ3BcO4T2Gqi8FIyw+gAN6c9oKfDlRpS45 TfXXm9oUh8foQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 165BC69209; Fri, 9 Jan 2026 11:31:42 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Fri, 9 Jan 2026 11:30:55 -0700 Message-ID: <20260109183116.3262115-4-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260109183116.3262115-1-sjg@u-boot.org> References: <20260109183116.3262115-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: HGK2KZYNCI6KKNJM6NWWMKSILT54FRJP X-Message-ID-Hash: HGK2KZYNCI6KKNJM6NWWMKSILT54FRJP 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: Heinrich Schuchardt , Simon Glass , "Claude Opus 4 . 5" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 03/18] buildman: Add test for branch summary display 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 testBranchSummary() to test the -s, -S, and -B flags which show a summary of build results without triggering any new builds. The test first builds a branch, then: - Runs with -s to verify the summary output - Runs with -sS to test size display - Runs with -sSB to test bloat (function size changes) display Update the command handlers to return realistic output: - _HandleCommandSize() returns size output that varies between calls - _HandleCommandObjdump() returns output with a .rodata section - _HandleCommandNm() returns nm output with function sizes that vary This improves coverage of show_summary(), print_result_summary(), print_size_detail(), print_func_size_detail() and related code paths in builder.py and builderthread.py. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- tools/buildman/func_test.py | 75 +++++++++++++++++++++++++++++++++++-- 1 file changed, 72 insertions(+), 3 deletions(-) diff --git a/tools/buildman/func_test.py b/tools/buildman/func_test.py index 3ecbd22613f..69f6b25fa5a 100644 --- a/tools/buildman/func_test.py +++ b/tools/buildman/func_test.py @@ -367,16 +367,46 @@ class TestFunctional(unittest.TestCase): sys.exit(1) def _HandleCommandNm(self, args): - return command.CommandResult(return_code=0) + # Return nm --size-sort output with function sizes that vary between + # calls to simulate changes between commits + self._nm_calls = getattr(self, '_nm_calls', 0) + 1 + base = self._nm_calls * 0x10 + stdout = f'''{0x100 + base:08x} T main +{0x80 + base:08x} T board_init +{0x50 + base:08x} t local_func +{0x30:08x} d data_var +''' + return command.CommandResult(return_code=0, stdout=stdout) def _HandleCommandObjdump(self, args): - return command.CommandResult(return_code=0) + # Return objdump -h output with .rodata section + stdout = ''' +u-boot: file format elf32-littlearm + +Sections: +Idx Name Size VMA LMA File off Algn + 0 .text 00010000 00000000 00000000 00001000 2**2 + 1 .rodata 00001000 00010000 00010000 00011000 2**2 + 2 .data 00000100 00011000 00011000 00012000 2**2 +''' + return command.CommandResult(return_code=0, stdout=stdout) def _HandleCommandObjcopy(self, args): return command.CommandResult(return_code=0) def _HandleCommandSize(self, args): - return command.CommandResult(return_code=0) + # Return size output - vary the size based on call count to simulate + # changes between commits + self._size_calls = getattr(self, '_size_calls', 0) + 1 + text = 10000 + self._size_calls * 100 + data = 1000 + bss = 500 + total = text + data + bss + fname = args[-1] if args else 'u-boot' + stdout = f''' text data bss dec hex filename + {text} {data} {bss} {total} {total:x} {fname} +''' + return command.CommandResult(return_code=0, stdout=stdout) def _HandleCommandCpp(self, args): # args ['-nostdinc', '-P', '-I', '/tmp/tmp7f17xk_o/src', '-undef', @@ -549,6 +579,45 @@ Some images are invalid''' self.assertEqual(self._builder.count, self._total_builds) self.assertEqual(self._builder.fail, 0) + def testBranchSummary(self): + """Test building a branch and then showing a summary""" + self._RunControl('-b', TEST_BRANCH, '-o', self._output_dir) + self.assertEqual(self._builder.count, self._total_builds) + self.assertEqual(self._builder.fail, 0) + + # Now run with -s to show summary + self._make_calls = 0 + self._RunControl('-b', TEST_BRANCH, '-s', '-o', self._output_dir, + clean_dir=False) + # Summary should not trigger any builds + self.assertEqual(self._make_calls, 0) + lines = terminal.get_print_test_lines() + self.assertIn('(no errors to report)', lines[-1].text) + + # Now run with -S to show sizes as well + self._make_calls = 0 + self._RunControl('-b', TEST_BRANCH, '-sS', '-o', self._output_dir, + clean_dir=False) + self.assertEqual(self._make_calls, 0) + lines = terminal.get_print_test_lines() + # Check that size information is displayed (arch names with size deltas) + text = '\n'.join(line.text for line in lines) + self.assertIn('arm', text) + self.assertIn('sandbox', text) + self.assertIn('(no errors to report)', lines[-1].text) + + # Now run with -B to show bloat (function size changes) + self._make_calls = 0 + self._RunControl('-b', TEST_BRANCH, '-sSB', '-o', self._output_dir, + clean_dir=False) + self.assertEqual(self._make_calls, 0) + lines = terminal.get_print_test_lines() + text = '\n'.join(line.text for line in lines) + # Check function names appear in the bloat output + self.assertIn('main', text) + self.assertIn('board_init', text) + self.assertIn('(no errors to report)', lines[-1].text) + def testCount(self): """Test building a specific number of commitst""" self._RunControl('-b', TEST_BRANCH, '-c2', '-o', self._output_dir)