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 213B2ECAAD1 for ; Wed, 31 Aug 2022 10:37:51 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0F7C684882; Wed, 31 Aug 2022 12:37:49 +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="wGig4oqq"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="4eh3qTAl"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 24F98848DE; Wed, 31 Aug 2022 12:37:47 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) (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 9117F8455B for ; Wed, 31 Aug 2022 12:37:44 +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-out2.suse.de (Postfix) with ESMTP id 5B3171FA1A; Wed, 31 Aug 2022 10:37:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1661942264; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DKDWZgY7YSqkL3Yeb3Ik2DUrIbUG5EPAMoGLIsGTCJI=; b=wGig4oqqNwmLYmSQsEUP7ioWOu3LJVPELnNavvTzuZD9gbtV3OIGJlzFndoeB1kozg+idG EczSK2dwFAjmZe2GCP5/ZPgjAby9PSfyEnk3Uz0rsLrSYWiX/WQ7g2pFgiJMAdIfDvsxrV HUv7MvgQVBckwjPr09Z7RR9IBo47EbY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1661942264; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DKDWZgY7YSqkL3Yeb3Ik2DUrIbUG5EPAMoGLIsGTCJI=; b=4eh3qTAlAUVGrkkgTCYlw4Jgdqddtl45oP7DCQRAOGwI+EOeKz8GQec4gjjXLFpfRN++Yz xxfxV4xKewWjmVAg== 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 3D7392C141; Wed, 31 Aug 2022 10:37:44 +0000 (UTC) Date: Wed, 31 Aug 2022 12:37:43 +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: <20220831103743.GR28810@kitsune.suse.cz> References: <0c73060925b6fa31a423fad5f5fddb7452c3dd8e.1661410032.git.msuchanek@suse.de> <0555b362-eabc-6648-abff-d91f7899dd72@theobroma-systems.com> <20220830101149.GM28810@kitsune.suse.cz> <25118582-c21e-5277-c8e0-6b1b3a2b8d66@theobroma-systems.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <25118582-c21e-5277-c8e0-6b1b3a2b8d66@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 Hello, On Wed, Aug 31, 2022 at 12:08:32PM +0200, Quentin Schulz wrote: > Hi Michal, > > On 8/30/22 12:11, Michal Suchánek wrote: > > 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. > > > > I don't understand this point? If coverage cannot run with the python from > the host, then it won't just be possible to run it... so... we don't care? > Is there something we can do about this I'm missing? Host can have multiple python versions with varying tools installed. > > I would like to advocate for COVERAGE to default to "coverage" or "python3 > -m coverage" since this is more likely to be a sane default for everybody, > using pip or distro installs. "coverage" will likely break current test environment but "python3 -m coverage" may just work, and also test that expanding the arguments works correctly. Thanks Michal