Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 17D77C61DA4 for ; Fri, 24 Feb 2023 01:22:03 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4C72985B7E; Fri, 24 Feb 2023 02:20:25 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="bDSe7c2Z"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8E258859A6; Fri, 24 Feb 2023 02:19:17 +0100 (CET) Received: from mail-il1-x12b.google.com (mail-il1-x12b.google.com [IPv6:2607:f8b0:4864:20::12b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 9616A85AF7 for ; Fri, 24 Feb 2023 02:19:00 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x12b.google.com with SMTP id i12so749293ila.5 for ; Thu, 23 Feb 2023 17:19:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Ph1WiHBQ3QHGawHCVcvt6rkzCNL8DOSvXs5vmSn3Y2c=; b=bDSe7c2ZaJpSDEJUHgn8Cvp0UVLyOGCCBeTIwgkgEYFUP/fE+8dB3aQnUr7r0f0r5L ilYccbNvw6rBBZcxKpII6b+MknNyZQbgg7ZsvXRn1oqqJDkGmZ5bpy9b2zbIvYTgN+u9 FfMcPSU76FlEZSmpXODwIeF59IvOb65RI6RSI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Ph1WiHBQ3QHGawHCVcvt6rkzCNL8DOSvXs5vmSn3Y2c=; b=6hrAYt1C50zpGKB5+ikfSijrZyQlPH4lq+PhHmDpmZovewzsVCSfsdX4wsl6W2cZ2s jS8//1YKZcxhOroeiBCZulBVPLZHI5orN3RtXIZu7nZ8+Z04ttPMUK0rrCJ5BVovdeQT P6IDzEiBZgN0Y40Qk1dxVXTe8eNrYdZdBpvonpL9Z+LoGAW07LtshND6bmTcCcoBihfW z8TNseStvnPkkJ8PRO8la08WH0UlzbmoiT1ZBSyMW5LUJwAN5iKBJSg0g9rtdRT4JN6M Kxc9LF9BKzh+ohxlPhmBe0UB6Hh1BWSQZP/GBKxNUtlG4OeByo7Lhmy/mSzD+67cvklh ivdQ== X-Gm-Message-State: AO0yUKWcuff385038tzEVua3+RUo1gd8AIY0F1uaFUhVWgbne/1Udxci NVcyU6E/Xm9fE7iAX6a5ao1XdQDJRHuJU2AI X-Google-Smtp-Source: AK7set8SlZaNCuT6lWgPm2BxcJP2TfV2xe7f/eAFNPEdXtdVXvVJv1Lc9q+fRKSfAxRkWu+gwXZf0g== X-Received: by 2002:a92:260a:0:b0:315:7a34:227 with SMTP id n10-20020a92260a000000b003157a340227mr8993067ile.32.1677201540075; Thu, 23 Feb 2023 17:19:00 -0800 (PST) Received: from sjg1.roam.corp.google.com (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id q3-20020a92d403000000b003127b668eafsm2677214ilm.19.2023.02.23.17.18.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Feb 2023 17:18:59 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Alper Nebi Yasak , Neha Malcom Francis , Stefan Herbrechtsmeier , Philippe Reynes , Peng Fan , Heinrich Schuchardt , Simon Glass Subject: [PATCH v2 18/24] binman: Move the main code into a function Date: Thu, 23 Feb 2023 18:18:18 -0700 Message-Id: <20230224011824.2111976-19-sjg@chromium.org> X-Mailer: git-send-email 2.39.2.637.g21b0678d19-goog In-Reply-To: <20230224011824.2111976-1-sjg@chromium.org> References: <20230224011824.2111976-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean Put this code into a function so it is easy for it be run when packaged. Signed-off-by: Simon Glass --- Changes in v2: - Add patch to split out the main code into a function tools/binman/main.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tools/binman/main.py b/tools/binman/main.py index eef17b7b55f..92d2431aea7 100755 --- a/tools/binman/main.py +++ b/tools/binman/main.py @@ -85,7 +85,7 @@ def RunTests(debug, verbosity, processes, test_preserve_dirs, args, toolpath): return (0 if result.wasSuccessful() else 1) -def RunTestCoverage(toolpath): +def RunTestCoverage(toolpath, build_dir): """Run the tests and check that we get 100% coverage""" glob_list = control.GetEntryModules(False) all_set = set([os.path.splitext(os.path.basename(item))[0] @@ -97,7 +97,7 @@ def RunTestCoverage(toolpath): test_util.run_test_coverage('tools/binman/binman', None, ['*test*', '*main.py', 'tools/patman/*', 'tools/dtoc/*', 'tools/u_boot_pylib/*'], - args.build_dir, all_set, extra_args or None) + build_dir, all_set, extra_args or None) def RunBinman(args): """Main entry point to binman once arguments are parsed @@ -117,7 +117,7 @@ def RunBinman(args): if args.cmd == 'test': if args.test_coverage: - RunTestCoverage(args.toolpath) + RunTestCoverage(args.toolpath, args.build_dir) else: ret_code = RunTests(args.debug, args.verbosity, args.processes, args.test_preserve_dirs, args.tests, @@ -141,8 +141,12 @@ def RunBinman(args): return ret_code -if __name__ == "__main__": +def start_binman(): args = cmdline.ParseArgs(sys.argv[1:]) ret_code = RunBinman(args) sys.exit(ret_code) + + +if __name__ == "__main__": + start_binman() -- 2.39.2.637.g21b0678d19-goog