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 2A12AECAAD4 for ; Tue, 30 Aug 2022 10:11:55 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id BE9BD848B8; Tue, 30 Aug 2022 12:11:53 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=suse.de 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=suse.de header.i=@suse.de header.b="Q4dnqj6p"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="bPcdkXO6"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E45B6848DB; Tue, 30 Aug 2022 12:11:52 +0200 (CEST) Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 9B1B38483D for ; Tue, 30 Aug 2022 12:11:50 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=msuchanek@suse.de Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 61E43222CD; Tue, 30 Aug 2022 10:11:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1661854310; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=oubZj1YTd1LcW1P0t+a2fbl+zZHpmlTGy3QALWsuVkg=; b=Q4dnqj6pE7GGMQVHhrm+Ef2/+MOyzoPVBcrNEAKzS6AZIcv0ULm2JO1dtoJ/r2ow9BYB/l lUFyyIuZeKAthu8SKrOKGGWph6dxssehT/bcCDPP9MzHolWHtryxeqd16iU2L1Jbl+MxSO 4HbjLz4MuzvLTxpp7bbHIRterK1XiM4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1661854310; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=oubZj1YTd1LcW1P0t+a2fbl+zZHpmlTGy3QALWsuVkg=; b=bPcdkXO6/EtJukDcb7efU+FdEc1+08LEZYlcZFfb5S2ni69e/WKqMyVvV/uDgvUX7EEto2 6e7xqT4Psto5wLCQ== Received: from kitsune.suse.cz (kitsune.suse.cz [10.100.12.127]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 4B7012C141; Tue, 30 Aug 2022 10:11:50 +0000 (UTC) Date: Tue, 30 Aug 2022 12:11:49 +0200 From: Michal =?iso-8859-1?Q?Such=E1nek?= To: Quentin Schulz Cc: U-Boot Mailing List , Simon Glass Subject: Re: [PATCH 1/2] patman: do not hardcode coverage tool Message-ID: <20220830101149.GM28810@kitsune.suse.cz> References: <0c73060925b6fa31a423fad5f5fddb7452c3dd8e.1661410032.git.msuchanek@suse.de> <0555b362-eabc-6648-abff-d91f7899dd72@theobroma-systems.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0555b362-eabc-6648-abff-d91f7899dd72@theobroma-systems.com> User-Agent: Mutt/1.10.1 (2018-07-13) 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 On Tue, Aug 30, 2022 at 12:01:55PM +0200, Quentin Schulz wrote: > Hi Michal, > > On 8/25/22 08:49, Michal Suchanek wrote: > > The coverage tool name varies across distributions. > > > > Add COVERAGE variable to specify the tool name. > > > > Also there is one place where prefix is prepended to the tool path, > > remove the prefix. > > > > Signed-off-by: Michal Suchanek > > --- > > doc/develop/testing.rst | 3 +++ > > tools/patman/test_util.py | 18 ++++++++++-------- > > 2 files changed, 13 insertions(+), 8 deletions(-) > > > > diff --git a/doc/develop/testing.rst b/doc/develop/testing.rst > > index 1abe4d7f0f..054fbfc814 100644 > > --- a/doc/develop/testing.rst > > +++ b/doc/develop/testing.rst > > @@ -17,6 +17,9 @@ To run most tests on sandbox, type this:: > > in the U-Boot directory. Note that only the pytest suite is run using this > > command. > > +Note: external tool `python3-coverage` is used by tests. The environment > > +variable `COVERAGE` can be set to alternative name or location of this tool. > > + > > Some tests take ages to run and are marked with @pytest.mark.slow. To run just > > the quick ones, type this:: > > diff --git a/tools/patman/test_util.py b/tools/patman/test_util.py > > index 0f6d1aa902..e11806b626 100644 > > --- a/tools/patman/test_util.py > > +++ b/tools/patman/test_util.py > > @@ -15,6 +15,8 @@ from patman import command > > from io import StringIO > > +coverage = os.environ.get('COVERAGE', 'python3-coverage') > > + > > buffer_outputs = True > > use_concurrent = True > > try: > > @@ -58,11 +60,11 @@ def run_test_coverage(prog, filter_fname, exclude_list, build_dir, required=None > > prefix = '' > > if build_dir: > > prefix = 'PYTHONPATH=$PYTHONPATH:%s/sandbox_spl/tools ' % build_dir > > - cmd = ('%spython3-coverage run ' > > - '--omit "%s" %s %s %s -P1' % (prefix, ','.join(glob_list), > > + cmd = ('%s run ' > > + '--omit "%s" %s %s %s -P1' % (coverage, ','.join(glob_list), > > prog, extra_args or '', test_cmd)) > > What about using > python3 -m coverage run > instead? > This way we wouldn't rely on the binary name the host distribution chooses > (python3-coverage for Ubuntu, coverage for Fedora). > > I'm not sure there is a need to give the user the ability to override this > value since I expect only coverage.py is supported at the moment? Then you run into the problems that you do not have coverage on python3.4 but only python3.6 or whatever is the relevant version for your distribution ATM. In other words the only general solution is to specify the tool AFAICT. Thanks Michal