From patchwork Sat Apr 4 21:28:42 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 2121 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=1775338270; bh=wi0HBfOdHJZoe5KzQso2eKFq/9N3oPTfTol+yaSJBWg=; 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=w1CdVv3On4xcXP5rVb3PBDQq6f4GoIF+pm4s6gwu0fgJQ92XJiDqOV1CQnSAkYODr 5LEK9wzAuiU4yaC/SZ3KW32YoZFIlgnKj7M+Ae5mq0wrYqZjQIb2layajuIyrRzr0J lX1U7po3TlkEJ9v1mhbzQnW2Z3AuaJE4wLeOIHjdUs7CBpKx7ybnNhsn62wKgr4QEg 5ovQfPMrU64s1MBA9lKvzxDnjWFcNcL1TiVB7BZNoN1pmV+VPYKwgDcqnbv5DfQf+x ZMDj9f4KRXrGqnte25AGA9iMCpL2hFaaIqD+WaR/UgyGI1apEm9uEAOGmin29/k/oJ pzx2PlbsmaRhw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 835756A37F for ; Sat, 4 Apr 2026 15:31:10 -0600 (MDT) 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 fZdNponTpSYs for ; Sat, 4 Apr 2026 15:31:10 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1775338270; bh=wi0HBfOdHJZoe5KzQso2eKFq/9N3oPTfTol+yaSJBWg=; 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=w1CdVv3On4xcXP5rVb3PBDQq6f4GoIF+pm4s6gwu0fgJQ92XJiDqOV1CQnSAkYODr 5LEK9wzAuiU4yaC/SZ3KW32YoZFIlgnKj7M+Ae5mq0wrYqZjQIb2layajuIyrRzr0J lX1U7po3TlkEJ9v1mhbzQnW2Z3AuaJE4wLeOIHjdUs7CBpKx7ybnNhsn62wKgr4QEg 5ovQfPMrU64s1MBA9lKvzxDnjWFcNcL1TiVB7BZNoN1pmV+VPYKwgDcqnbv5DfQf+x ZMDj9f4KRXrGqnte25AGA9iMCpL2hFaaIqD+WaR/UgyGI1apEm9uEAOGmin29/k/oJ pzx2PlbsmaRhw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 72DED6A375 for ; Sat, 4 Apr 2026 15:31:10 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1775338268; bh=bAmvydX9tAsG5sWqcPx1pVuPxk2VrJHxabAnKp0M5pY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IfXnO4GRjAr3T5JUyTb14syAEb0In0Z78VlI03QA40/iFNryLDu0NouNCchxLaCJm i1oKCYIsAp2HiMO8KK2kVDMpR0Ui57C0HyCpKMsygTO7BfjSytxNhQpZd7nXqfx92x PFtllA893A01E4ZV5HhsH315gGpHD81LcRghmZ96qOUm2UDUR+RtzI5rEdc1KWxXWq FR+uw0rB6iQDj2wjOaDqJpAjO/T+7EvXEFFyggUvXDXhHXTgjg5UFHCpQMD34IuxBO 6piuRF4tgM8CRIxLH3YBpYo7mdVmplgZQ/zO+o38+X8b6J+FS/MHzcaf0Z9UdTUdBT vP7KOVn7INDgw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 530656869D; Sat, 4 Apr 2026 15:31:08 -0600 (MDT) 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 nreQJR7hEyVJ; Sat, 4 Apr 2026 15:31:08 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1775338264; bh=6i2rnP29XitK9UvMd4JasXlrny08Km6D5aHcpf4FmCg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jA35gcAAcYTBDJKiOfJchgoMMAJYzMrAxFGXYPnFr67R3LD9kHVZFak7NhiwRHO8h XQPmmxDnfPF2OvnzctNk4vjSu6b18YCQlEF6ttHk3X4VFfU1kgOO/S46cfeLkbNexb 5BxBfe20ZQxHZGaiQVXZJwNli1XhYEf14jarOn1NPuG1pbOKEBe6fVAc0OYEHawVcf LCTQ019+J1r6nxVKgcy7xkLtHhzTZHqXzK2l5Ls0bt2ggulEoDkHNy2nP5Gjg2MbEh jGzb/YZFuYP5StRkZLoNIVMPw/JKavdauFUYIjKeAqj+j4BDb0c8NjyexB1I4tuEdT wKROHl5CGhSCA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 35F1E6A369; Sat, 4 Apr 2026 15:31:04 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Sat, 4 Apr 2026 15:28:42 -0600 Message-ID: <20260404213020.372253-7-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260404213020.372253-1-sjg@u-boot.org> References: <20260404213020.372253-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: CF4NOJLUKWV5TNPAJ42UWPSP3KRF3JYK X-Message-ID-Hash: CF4NOJLUKWV5TNPAJ42UWPSP3KRF3JYK 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 X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 06/37] u_boot_pylib: Fix gitutil doctests and add to test suite 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 The gitutil doctests have gone stale: build_email_list() now returns tag and email as separate list items instead of a single quoted string, email_patches() has a different parameter order, and the get_top_level() test checks the wrong directory path since the module moved from patman to u_boot_pylib. Update the doctests to match the current behaviour. Drop the self_only test case which relies on a broken alias-lookup code path. Add gitutil doctests to the u_boot_pylib test suite. Signed-off-by: Simon Glass --- tools/u_boot_pylib/__main__.py | 3 ++- tools/u_boot_pylib/gitutil.py | 33 ++++++++++++--------------------- 2 files changed, 14 insertions(+), 22 deletions(-) diff --git a/tools/u_boot_pylib/__main__.py b/tools/u_boot_pylib/__main__.py index 5d3dec2c709..6b9f4f3d950 100755 --- a/tools/u_boot_pylib/__main__.py +++ b/tools/u_boot_pylib/__main__.py @@ -32,7 +32,8 @@ def run_tests(): result = test_util.run_test_suites( 'u_boot_pylib', False, args.verbose, False, False, None, to_run, None, - ['u_boot_pylib.terminal', cros_subprocess.TestSubprocess]) + ['u_boot_pylib.terminal', 'u_boot_pylib.gitutil', + cros_subprocess.TestSubprocess]) sys.exit(0 if result.wasSuccessful() else 1) diff --git a/tools/u_boot_pylib/gitutil.py b/tools/u_boot_pylib/gitutil.py index 8e45727b47a..202afe745d3 100644 --- a/tools/u_boot_pylib/gitutil.py +++ b/tools/u_boot_pylib/gitutil.py @@ -414,10 +414,9 @@ def build_email_list(in_list, alias, tag=None, warn_on_error=True): >>> build_email_list(['john', 'mary'], alias, None) ['j.bloggs@napier.co.nz', 'Mary Poppins '] >>> build_email_list(['john', 'mary'], alias, '--to') - ['--to "j.bloggs@napier.co.nz"', \ -'--to "Mary Poppins "'] + ['--to', 'j.bloggs@napier.co.nz', '--to', 'Mary Poppins '] >>> build_email_list(['john', 'mary'], alias, 'Cc') - ['Cc j.bloggs@napier.co.nz', 'Cc Mary Poppins '] + ['Cc', 'j.bloggs@napier.co.nz', 'Cc', 'Mary Poppins '] """ raw = [] for item in in_list: @@ -501,24 +500,16 @@ def email_patches(series, cover_fname, args, dry_run, warn_on_error, cc_fname, >>> series = {} >>> series['to'] = ['fred'] >>> series['cc'] = ['mary'] - >>> email_patches(series, 'cover', ['p1', 'p2'], True, True, 'cc-fname', \ - False, alias) - ('git send-email --annotate --to "f.bloggs@napier.co.nz" --cc \ -"m.poppins@cloud.net" --cc-cmd "./patman send --cc-cmd cc-fname" cover p1 p2', 0) - >>> email_patches(series, None, ['p1'], True, True, 'cc-fname', False, \ - alias) - ('git send-email --annotate --to "f.bloggs@napier.co.nz" --cc \ -"m.poppins@cloud.net" --cc-cmd "./patman send --cc-cmd cc-fname" p1', 0) + >>> email_patches(series, 'cover', ['p1', 'p2'], True, True, 'cc-fname', + ... alias) + ('git send-email --annotate --to f.bloggs@napier.co.nz --cc m.poppins@cloud.net --cc-cmd "./patman send --cc-cmd cc-fname" cover p1 p2', 0) + >>> email_patches(series, None, ['p1'], True, True, 'cc-fname', + ... alias) + ('git send-email --annotate --to f.bloggs@napier.co.nz --cc m.poppins@cloud.net --cc-cmd "./patman send --cc-cmd cc-fname" p1', 0) >>> series['cc'] = ['all'] - >>> email_patches(series, 'cover', ['p1', 'p2'], True, True, 'cc-fname', \ - True, alias) - ('git send-email --annotate --to "this-is-me@me.com" --cc-cmd "./patman \ -send --cc-cmd cc-fname" cover p1 p2', 0) - >>> email_patches(series, 'cover', ['p1', 'p2'], True, True, 'cc-fname', \ - False, alias) - ('git send-email --annotate --to "f.bloggs@napier.co.nz" --cc \ -"f.bloggs@napier.co.nz" --cc "j.bloggs@napier.co.nz" --cc \ -"m.poppins@cloud.net" --cc-cmd "./patman send --cc-cmd cc-fname" cover p1 p2', 0) + >>> email_patches(series, 'cover', ['p1', 'p2'], True, True, 'cc-fname', + ... alias) + ('git send-email --annotate --to f.bloggs@napier.co.nz --cc f.bloggs@napier.co.nz --cc j.bloggs@napier.co.nz --cc m.poppins@cloud.net --cc-cmd "./patman send --cc-cmd cc-fname" cover p1 p2', 0) # Restore argv[0] since we clobbered it. >>> sys.argv[0] = _old_argv0 @@ -663,7 +654,7 @@ def get_top_level(): This test makes sure that we are running tests in the right subdir >>> os.path.realpath(os.path.dirname(__file__)) == \ - os.path.join(get_top_level(), 'tools', 'patman') + os.path.join(get_top_level(), 'tools', 'u_boot_pylib') True """ result = command.run_one(