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 12C7DC19F28 for ; Sun, 31 Jul 2022 02:57:49 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2B8F884218; Sun, 31 Jul 2022 04:57:39 +0200 (CEST) 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="PPTQca3c"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 20CD484377; Sun, 31 Jul 2022 04:57:33 +0200 (CEST) Received: from mail-oa1-x2f.google.com (mail-oa1-x2f.google.com [IPv6:2001:4860:4864:20::2f]) (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 244AC84205 for ; Sun, 31 Jul 2022 04:57:30 +0200 (CEST) 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-oa1-x2f.google.com with SMTP id 586e51a60fabf-1013ecaf7e0so9955251fac.13 for ; Sat, 30 Jul 2022 19:57:30 -0700 (PDT) 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; bh=oxQO++LWou7mbg5lfiprsJItmQeOcq9hBSfHQfVytfc=; b=PPTQca3cZuydmB+24ohOWLV8bNtfhR/jvbM/doD3cpExjzkbwRco7vS0M1/EIRESbo tc9uuyPKx+ayNnL1uGyZWPPDOOf2M6qSg0My1LMckaOgSI2IrYiC5FF8fJhFwx7E0NZl 5hJx51IImyatz6IJW+O1lf+zjxWtpORkEia4g= 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; bh=oxQO++LWou7mbg5lfiprsJItmQeOcq9hBSfHQfVytfc=; b=CvVY6yeEjQxSN6P23AKgDZdcxqvpkAwqEuqsoO0kuC+mzWZR4XM5lWRWbgXdLx80VR LB+kcUHD56UiXqCPkU080v4Y9zreNXNgusAYIsFcuexC7cA01WrtskazEZr2LV4fu9L1 jx6Gu124rEAoA/OU5eDrTIW55wjeJGy0CgK6Fv9Z46H/6aDA6bJ1sRSp1yvFMoNsf+zS jxk/r0EvdgVKeGJTrjv74GXmU8vOajIJhkv/Xa3HsWugdR+EzJ56+oKCtqybh5RA6Ux+ 2j8Hq4NRuhkey2MEJSN7/b49+ky7E91V4J6FQyFfrVN3UGRzgRlCj1JNOpG4rPH3xAui bliw== X-Gm-Message-State: AJIora/5esJ6FxIbbvwaItLuj9LJdjNRp7QwBaHYDAMystMOXR524/XY enXl60+ZjEDiqbmAai+giGrW2YhKZvRGuQ== X-Google-Smtp-Source: AGRyM1tCualPx7A1HGEo2Wpise1Pq6PYZQd434TQAxzW9gYyGFPIiLYbeaqYzz4BmLNQ3y68PA7ZXA== X-Received: by 2002:a05:6870:3486:b0:10e:62b:159a with SMTP id n6-20020a056870348600b0010e062b159amr4908403oah.254.1659236248589; Sat, 30 Jul 2022 19:57:28 -0700 (PDT) Received: from sjg1.lan (c-67-190-102-125.hsd1.co.comcast.net. [67.190.102.125]) by smtp.gmail.com with ESMTPSA id 185-20020a4a00c2000000b0043610215abasm2061952ooh.16.2022.07.30.19.57.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Jul 2022 19:57:28 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass , Alper Nebi Yasak Subject: [PATCH 2/7] dtoc: Tidy up fdt_tests RunTests() Date: Sat, 30 Jul 2022 20:57:06 -0600 Message-Id: <20220731025711.871999-3-sjg@chromium.org> X-Mailer: git-send-email 2.37.1.455.g008518b4e5-goog In-Reply-To: <20220731025711.871999-1-sjg@chromium.org> References: <20220731025711.871999-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 Pass the options args in rather than using the global variables. Use snake case, fix up comments and use a ternary operator to make pylint happy. Signed-off-by: Simon Glass --- tools/dtoc/test_fdt.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/tools/dtoc/test_fdt.py b/tools/dtoc/test_fdt.py index ec257552efc..b48819831d6 100755 --- a/tools/dtoc/test_fdt.py +++ b/tools/dtoc/test_fdt.py @@ -778,17 +778,20 @@ def run_test_coverage(build_dir): ['tools/patman/*.py', '*test_fdt.py'], build_dir) -def RunTests(args): +def run_tests(args, processes): """Run all the test we have for the fdt model Args: - args: List of positional args provided to fdt. This can hold a test - name to execute (as in 'fdt -t testFdt', for example) + args (list or str): List of positional args provided. This can hold a + test name to execute (as in 'test_fdt -t testFdt', for example) + processes (int): Number of processes to use (None means as many as there + are CPUs on the system. This must be set to 1 when running under + the python3-coverage tool Returns: - Return code, 0 on success + int: Return code, 0 on success """ - test_name = args and args[0] or None + test_name = args[0] if args else None result = test_util.run_test_suites( 'test_fdt', False, False, False, None, test_name, None, [TestFdt, TestNode, TestProp, TestFdtUtil]) @@ -812,7 +815,7 @@ parser.add_option('-T', '--test-coverage', action='store_true', # Run our meagre tests if options.test: - ret_code = RunTests(args) + ret_code = run_tests(args, options.processes) sys.exit(ret_code) elif options.test_coverage: run_test_coverage(options.build_dir) -- 2.37.1.455.g008518b4e5-goog