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 B300DC00140 for ; Wed, 24 Aug 2022 07:43:57 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8E73584806; Wed, 24 Aug 2022 09:43:55 +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="FwqtgVlL"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="TOY33VX8"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id F1DDF84806; Wed, 24 Aug 2022 09:43:53 +0200 (CEST) Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) (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 B64CD80F3E for ; Wed, 24 Aug 2022 09:43:51 +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 6F12E223EE; Wed, 24 Aug 2022 07:43:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1661327031; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=BxHw7Frisyn+GdK3yVjd/lg12KN5EJDJwuNn/7dkupY=; b=FwqtgVlLcxhB/RIx7bd2Bo3Ztyy3MS5jELQCQ6J4/G2oyKvgZMkuh8NonlcWpoQ5oH/ctw wX+TMHxCEOkzZD7QZEpMetz6t5X3/YTAORtHbqLH/hSqjMJjSeVqVNnI7Oonptt8h69u6x zS8ADiqDZ9htbGhy74Q088K6sZxXDtY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1661327031; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=BxHw7Frisyn+GdK3yVjd/lg12KN5EJDJwuNn/7dkupY=; b=TOY33VX8XSelHuyYfE4azpMFdkg2vLxJ6SMScfnrGqFxZrzuhD7qEH9ryV1lq/xUwCfJ7q aiLG6U1A4knULIAA== Received: from naga.suse.cz (unknown [10.100.224.114]) by relay2.suse.de (Postfix) with ESMTP id 57B502C141; Wed, 24 Aug 2022 07:43:51 +0000 (UTC) From: Michal Suchanek To: u-boot@lists.denx.de Cc: Michal Suchanek , Simon Glass Subject: [PATCH] patman: do not hardcode coverage tool Date: Wed, 24 Aug 2022 09:43:42 +0200 Message-Id: <20220824074342.28677-1-msuchanek@suse.de> X-Mailer: git-send-email 2.37.1 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 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 --- tools/patman/test_util.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) 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)) os.system(cmd) - stdout = command.output('python3-coverage', 'report') + stdout = command.output(coverage, 'report') lines = stdout.splitlines() if required: # Convert '/path/to/name.py' just the module name 'name' @@ -76,13 +78,13 @@ def run_test_coverage(prog, filter_fname, exclude_list, build_dir, required=None print(stdout) ok = False - coverage = lines[-1].split(' ')[-1] + cov_result = lines[-1].split(' ')[-1] ok = True - print(coverage) - if coverage != '100%': + print(cov_result) + if cov_result != '100%': print(stdout) - print("To get a report in 'htmlcov/index.html', type: python3-coverage html") - print('Coverage error: %s, but should be 100%%' % coverage) + print("To get a report in 'htmlcov/index.html', type: %s html" % coverage) + print('Coverage error: %s, but should be 100%%' % cov_result) ok = False if not ok: raise ValueError('Test coverage failure') -- 2.37.1